Linux tip: Use alias command to set shortcut for long Linux commands

By Detector | 10 January 2009



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.

Tags | , , ,

| |

Comments are closed.





Archives

Add to Technorati Favorites
website stats
TwitterCounter for @ukion