Shell aliases are woefully underused. Painfully, I frequently see people do the following:
- Type a shell command with the same 4 arguments cd into the same folders
- ssh into the same machines or devices
- Run the same sequence of commands
Aliases are super easy. Just open your ~/.bashrc file (or equivalent) and start adding them. I’ll now give a bunch of examples I use.
I have many variations I use on the “ls” command. I don’t even remember what the arguments mean anymore because I’ve been using these shortcuts for so long.
# default arguments I like… READ THE REST
alias l='ls -AG'
# Long listing
alias ll='ls -aAlGh'
# Do a grep afterwards (My most often used)
alias lg='ls -AlGOh@ | grep -i '
# Newest files at bottom (My second most often used)
alias lt='ls -AltrGhu'
# Largest files at bottom
alias lz='ls -AlGrhS'
# Extended attributes