Solved

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

Posted on 2014-09-16
2
340 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
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

809 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