David Carew's Blog

AKA

I will admit to some occasional laziness. Like a lot of people, I have a bad habit of scrolling back up through my terminal history to find commands I need instead of typing them out. This is the bad kind of laziness. you can do slightly better by using control-r to search through that history, but it’s still not great.

.bash_aliases is there for a reason. Use it. It is much more convenient not to have to remember what the command was called or how far up it is in the backscroll. The ergonomics are also better because things like filenames and domains can be turned into paprameters instead of remembering that this command wants them in this order, and make sure to have that flag. You can also encapsulate things like which directory to run in.

As a bonus here’s the most recent addition to my own aliases file, a little script to find frequently used commands to potentially make aliases from:

alias most-used-commands='cat "$HISTFILE" | sort | uniq -c | sort -g -k1'