Solved

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

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
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.

778 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