Skip to content

MacOS unalias bash

The MacOS unalias command is used to remove shortcuts created with the alias command in the bash shell. By specifying the alias to be removed, you can revert a shortcut to its original command. This command is particularly useful for managing your shell environment and ensuring that commands work as intended.

unalias Syntax:

Terminal window
unalias [-a] [name ...]

Options:

OptionDescription
-aRemove all aliases.

Parameters:

ParameterDescription
nameName of the alias(es) to be removed.

unalias Usage:

List all defined aliases

Terminal window
unalias -a

Display all defined aliases in the current shell session.

Remove a specific alias

Terminal window
unalias ll

Remove the alias “ll” if it has been defined previously.

Remove multiple aliases at once

Terminal window
unalias l ls

Remove the aliases “l” and “ls” if they have been defined previously.

Remove all aliases

Terminal window
unalias -a

Remove all defined aliases in the current shell session.

How do I use unalias in MacOS?

To use the unalias command in MacOS, execute the following command:

Terminal window
unalias <alias_name>

How to remove all aliases in MacOS using unalias?

To remove all aliases in MacOS using unalias, you can use the following command:

Terminal window
unalias -a

Can I unalias multiple aliases at once in MacOS?

Yes, you can unalias multiple aliases at once in MacOS by providing multiple alias names after the unalias command. Here is an example:

Terminal window
unalias alias1 alias2

How can I force unalias to remove an alias in MacOS?

To force unalias to remove an alias in MacOS, use the following command:

Terminal window
unalias -a alias_name

How to display a list of current aliases in MacOS?

To display a list of current aliases in MacOS, you can use the following command:

Terminal window
alias

Does unalias remove aliases permanently in MacOS?

Yes, unalias removes aliases permanently in MacOS. If you unalias an alias, it will no longer be available for use in the current session or future sessions.

Can unalias be used to remove built-in shell commands in MacOS?

No, the unalias command in MacOS cannot be used to remove built-in shell commands. It is specifically used to remove user-defined aliases.

Applications of the unalias command

  • Removing an existing alias
  • Resolving conflicts between aliases and commands
  • Resetting an alias to its default state