How to Remove an Alias in Linux

  1. Remove an alias in the current shell session

    If you only want to remove an alias temporarily (until you close the terminal), run:

    unalias alias_name

Example:

unalias ll

To remove ALL aliases in the current session:

unalias -a
  1. Permanently remove an alias

    Persistent aliases are stored in your shell configuration files, such as:

    ~/.bashrc ~/.bash_profile ~/.profile ~/.zshrc /etc/bash.bashrc /etc/profile

Steps to remove permanently:

  1. Open your config file:

    nano ~/.bashrc
    
  2. Find the alias line, such as:

    alias ll='ls -la'
    
  3. Delete it or comment it out:

    # alias ll='ls -la'
    
  4. Reload your shell configuration:

    source ~/.bashrc
    

    Or restart your terminal.

  5. Check where an alias is defined

    To determine whether something is an alias and what file defines it:

    type alias_name

Example:

type ll

If you need to search your config files:

grep -R "alias ll" ~/.*

Replace ‘ll’ with the alias name you are investigating.

Quick Reference

Remove alias (current session): unalias alias_name

Remove all aliases (session): unalias -a

Remove alias permanently: Remove or comment the alias line in ~/.bashrc, ~/.zshrc, etc.

Reload shell config: source ~/.bashrc

Check alias definition: type alias_name