?
Solved

what does this command mean "history -d $((HISTCMD-1))"

Posted on 2014-09-16
2
Medium Priority
?
371 Views
Last Modified: 2014-09-16
from the command history, I see a command like this:

history -d $((HISTCMD-1))

I don't understand what this command does, could you please help.

thanks.
0
Comment
Question by:Jason Yu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 40326528
history is a command to manipulate the command line history.

Its "-d" flag is used to delete a command at a specific position (offset).

HISTCMD is a variable containing the future sequence number of the next command.

$(( )) is a shell construct to perform arithmetic operations.

So your command will delete the "current" entry from the shell's history, i. e. the "history -d ..." command itself - for whatever it's worth.
0
 

Author Comment

by:Jason Yu
ID: 40326702
thank you very much, I got it. it's the user wanting to hide his commands.
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month9 days, 14 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question