facebook youtube pinterest twitter reddit whatsapp instagram

What is unlias & How Do I Use It in Linux?

The unalias command is a Linux utility that is used to remove an alias that has been defined on the system.

Using unlias

To use the unalias command, you simply need to specify the name of the alias that you want to remove. For example, if you had defined an alias called ll that represented the ls -l command, you could remove the alias with the following unalias command:

unalias ll

This will remove the ll alias from your system, and you will no longer be able to use it in the terminal. You can also use the -a option with the unalias command to remove all aliases that have been defined on the system. For example:

unalias -a

This will remove all defined aliases from your system, so use this option with caution.

To see a list of all the aliases that have been defined on your system, you can use the alias command without any options or arguments.

This will display a list of all the aliases that have been defined, along with the commands that they represent.

Persisting unalias Changes Across Sessions

To make the changes made by the unalias command persist across shell sessions, you will need to remove the alias from your shell's configuration file. The configuration file for your shell is a file that is executed whenever you open a new terminal or shell session.

Removing the alias from this file, will not be defined whenever you open a new shell session, so you won't have to use the unalias command to remove it manually every time.

The name and location of the configuration file for your shell will depend on the type of shell that you are using. Some common shells and their corresponding configuration files are:

  • Bash: ~/.bashrc or ~/.bash_profile
  • Zsh: ~/.zshrc
  • Fish: ~/.config/fish/config.fish


To remove an alias from your shell's configuration file, you can use a text editor to open the appropriate file and search for the alias command for the alias that you want to remove.

For example, if you were using Bash and wanted to remove the ll alias that we used earlier, you could search for the following line in your ~/.bashrc file:

alias ll='ls -l'

Once you have found the line that defines the alias, simply delete it from the file and save your changes.

The next time you open a new shell session, the ll alias will not be defined, and you will not be able to use it in the terminal.

Keep in mind that the changes you make to your shell's configuration file will only apply to new shell sessions. If you have already opened a shell session and want to remove the alias from your current session, you will need to source the configuration file to load the changes into your current shell session.

You can do this by running the following command:

source ~/.bashrc

Replace ~/.bashrc with the path to your shell's configuration file if it is different. This will load the changes that you made to the configuration file, and the ll alias will no longer be defined in your current shell session.



Related Post(s)

  • The ac Command in Unix & Linux

    The ac command is a Unix utility that is used to display statistics about users' connect time. It displays the total connect time for all users or for a specific user. The connect time is the amount o

  • What is Linux adduser and addgroup commands

    The adduser and addgroup commands are Linux utilities that are used to create new user and group accounts on a Linux system. The adduser command is used to create a new user account, while the addgrou

  • What is alias and How Do I Use It in Linux?

    The alias command can be used to represent a longer command or series of commands in Linux. Aliases allow you to type a shorter and easier-to-remember name instead of the full command, which can save

  • What is apt-get and How Do I Use It?

    apt-get is a command line tool used for managing packages on a Debian-based Linux system. It is a part of the Advanced Packaging Tool (apt) system, which is used to manage the installation, removal, a

  • What is ar Command in Linux and How Do I Use It?

    ar is a command line tool used for creating, modifying, and extracting files from archives. An archive is a single file that contains multiple files, often in a compressed format. GNU ar is part of the GNU Compiler Collection (GCC) and is commonly us

  • What is as Command in Linux and How Do I Use It?

    The as command in Linux is a tool for assembling (compiling) assembly language source code into machine code that can be executed on a computer. Assembly language is a low-level programming language