Riaan's SysAdmin Blog

My tips, howtos, gotchas, snippets and stuff. Use at your own risk!

Bash

Bash History Plus Comment

If you like using Control-R in bash to find previous commands here is a useful tip. You can add a comment to a command and then when you use Control-R searching by typing you can find it by your comment. Example I use apt update. Run command including your comment (shell will ignore the comment of course). Then when Control-R searching type your string you used in the comment.

 # apt update ; apt upgrade #quickupdate

Now hit Control-R and type to search "quick".

(reverse-i-search)`quick': apt update ; apt upgrade #quickupdate

admin

Bio Info for Riaan