How do I use shell aliases under Linux?

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


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:

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts