About Linux FAQ

Browse More FAQs:

How do I use shell aliases under Linux?

Posted by Vivek Gite [Last updated: August 27, 2006]

Q. What is a shell alias and how do I use them under Linux?

A. An alias is nothing but a short form of a Linux or UNIX command. You use aliases to save the time. To create an alias use the alias command.

Task: Display current aliases

Type alias command with no arguments or with the -p option prints the list
of aliases in the form alias NAME=VALUE on screen:

$ alias

Output:

alias cp='cp -i'
alias l.='ls -d .* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

Task : Create an alias

To create an alias use the alias command as follows:

$ alias c=’clear’

Now, type c and hit enter key to run clear the screen aka run screen command.

Task : Remove or delete an alias

To remove or delete an alias use

$ unalias c

Verify that an alias deleted:

$ alias

See also:

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.