Sometimes you accidentally generate entries in the bash history that you do not want to have there (e.g. commands with credentials).
Here's how to remove single entries.
You can look at the bash history with the history
command.
To see e.g. the last 5 entries, use history | tail -n 5
:
>history | tail -n 5
1994 my-secret-command
1995 cd xyz-mnt/
1996 ls
1997 cd appliance/
1998 cd ..
Each entry has a number. You can use that to delete it: history -d 1994
. Note that as you delete entries, the numbers of the following entries will change.
Posted by Judith Roth to makandra dev (2020-12-02 09:43)