First type history to see your bash command history.

Find the entry/command you'd like to erase from history and note the id on the left column.

history -d 1234

Replace 1234 with the actual ID.

Example:

$ history
  640  cd ~
  641  ls -la
  642  crontab -e
  643  exit
  644  free -h
  645  df -h
$ history -d 645
$ history
  640  cd ~
  641  ls -la
  642  crontab -e
  643  exit
  644  free -h

As you can see, the df -h command was erased from the history.


Next Post Previous Post