[Linux] Tip for heavy users of Ctrl + R

After a lengthy JIRA tip, I’m about to blog a Keyboard Ninja tip for users who do a lot of Ctrl + R thingy to navigate Bash history.

This came up when I didn’t want to use a session manager like PAC but rely on Bash history. I have a server IP address and SSH access.

So, instead of doing just ssh -v shaakunthala@xxx.xxx.xxx.xxx thing, I do this:

ssh -v shaakunthala@xxx.xxx.xxx.xxx #jirauat

Those who are familiar with scripting know this: Whatever you type after the hash sign won’t effect, because Bash interprets that as a comment. However, Bash history records the complete line.

Later, I don’t have to remember the IP address, but, when I type Ctrl + R followed by jirauat, it comes up quickly. Just hit Enter!

(reverse-i-search)`jiraua': ssh -v shaakunthala@xxx.xxx.xxx.xxx #jirauat

And that’s how you easily save few keystrokes plus an additional minute without having to recall numbers.

[Linux] Tip for heavy users of Ctrl + R

Leave a comment