When I’m using the command line on Ubuntu it’s often for very repetitive tasks for which I would have typed in the same endless command a thousand times if it weren’t for the CTRL-R search function that let’s me execute commands from the history list quickly by typing a part of it. There is one tiny drawback, however. There are some commands which are a subset of others, such as logging into a server via ssh to get a shell or to automatically execute a job on the same serer. Here’s an example:
ssh martin@xyz.com ssh martin@xyz.com '/home/martin/xyz.sh'
Both commands are identical at the beginning so as a consequence I sometimes have to type in CTRL-R a number of times before I get to the shorter one. There must be a better way to do this! And indeed there is as a colleague of mine recently showed me.
Continue reading Linux: Adding Your Own Bash Shortcut Functions