Shell aliases
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.
“ls” command
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
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
alias lx='ls -aAlGh@O'
# kitchen sink
alias le='ls -aAlGh@eOR'
Common sets of flags
When I run “du” or “top” I always use the same flags, so I have this set…
Keep reading with a 7-day free trial
Subscribe to Tech Reflect to keep reading this post and get 7 days of free access to the full post archives.