The alias command is useful for setting up shortcuts for long commands, or even more clever things. For example, to make short command from DetectorPro post: How to find only today files in Linux, we could make a new command, lsnew, by doing this:

alias lsnew=" ls -al --time-style=+%D | grep `date +%D` "

But there are other uses of alias. For example, common mistyping mistakes. How many times have you accidentally left out the space when changing to the parent directory? Worry no more!

alias cd..="cd .."

Alternatively, how about rewriting some existing commands?

alias ls="ls -al"

saves a few keypresses if, like us, you always want the complete list.

To have these shortcuts enabled for every session, just add the alias commands to your user .bashrc file in your home directory.

Did you enjoy this post? Why not leave a comment below and continue the conversation, or Subscribe to Feed and get articles like this delivered automatically to your Email or feed reader.