Clear all Linux / UNIX bash shell aliases

See all Bash/Shell scripting related FAQ
How do I clear all Linux and UNIX bash shell aliases in single command? I have twenty bash shell aliases defined and I just need to delete them in a current session. How do I get rid of all of them?

You need to use unalias command on Linux or Unix to remove bash shell aliases. The alias command used to create aliases. It works on bash, ksh, csh and other Unix shells. This page shows how to clear or remove bash shell alises using command-line options.

How to see a list of bash shell aliases

To get a list of aliases for the current user, run:
alias -p

How to defined a new bash shell alias

The syntax is:
alias name='value'
The following command create a new alias named c for the commonly used clear command:
alias c='clear'
Next, to clear the screen, instead of typing clear, the user would only have to type the letter c and press the ENTER key:
In this example, when user type nano, open a text editor named vim:
alias nano='vim'

unalias command syntax to remove aliases

The syntax is:
unalias name
unalias [option] name

To remove alias called foo, enter:
unalias foo
To clear alias named c, enter:
unalias c
Please note that alias command with no arguments or with the -p option prints the list of aliases:
$ alias
Sample outputs:

alias ll='ls -lh'
alias ls='ls --color=auto'
alias vi='vim '
alias c='clear'
alias d="/usr/local/bin/chkdomain $@"

How to clear all Linux / UNIX bash shell aliases

To remove all bash shell aliases NAMEs from the list of defined aliases pass the -a option as follows and it will remove all alias definitions:
unalias -a
Verify it:
Above command removed all bash shell alias.

Sample Linux session that remove all bash shell aliases

How to remove or clear all Linux and Unix bash shell aliases

How to remove or clear all Linux and Unix bash shell aliases

Getting help of alias and unalias command

Visit this page or type the following commands:
help alias
help unalias
man alias

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

3 comments… add one
  • vinod kumar Jul 26, 2007 @ 6:46

    Where to check common error in logs

  • vinod Jul 27, 2007 @ 10:04

    How to find and install a new hardware

  • CMREDDY Sep 28, 2012 @ 7:08

    how i can fixed the alias commands on a terminal..

Leave a Reply

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

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.