≡ Menu

Bash command history

How to delete a single command from history on a Linux, OS X and Unix Bash shell

I‘m working in Ubuntu bash terminal application and remotely on a RHEL server in cloud platform. I typed the wrong and dangerous command. I no longer wish to remember dangerous command in the history file. How can I remove or delete a single command from bash history file?
[click to continue…]

Sysadmin because even developers need heroes!!!

Bash History: Correct / Repeat The Last Command With a Substitution

I often type the wrong command as follows under Linux bash shell:

rsync -av dir1 user@server1.cyberciti.biz:/path/to/dir1


cp -av file1*.txt file2*.txt /path/to/dest

I need to correct those command as follows:

rsync -av dir5 user@server1.cyberciti.biz:/path/to/dir1
cp -av delta1*.txt delta2*.txt /path/to/dest

How do I replace dir1 with dir5 or file with delta and repeat the last command under bash shell?
[click to continue…]