Solved

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

Posted on 2014-09-16
2
354 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 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

691 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