How do I remove an alias?

The command to remove an alias is unalias so....

 unalias gs

Manual:

NAME

unalias - remove alias definitions

SYNOPSIS

unalias alias-name...

unalias -a

DESCRIPTION

The unalias utility shall remove the definition for each alias name specified. See Alias Substitution . The aliases shall be removed from the current shell execution environment; see Shell Execution Environment .

-a Removes All aliases


TL;DR: The command to remove a shell alias is unalias. See the unalias manual. Run:

unalias gs

But if your gs command is not an alias (most likely), it will not help. The response will be something like:

bash: unalias: gs: not found

To find the type of the command trouble you're in, use type built-in shell command:

type gs

On my system it says it is an executable:

gs is /usr/bin/gs

Compare that with a common alias ll:

alias ll='ls -l'
type ll

ll is aliased to `ls -l'

See help type for detailed description of the type shell built-in command

You can also check if it is a symbolic link with:

ls -la /usr/bin/gs

On my system it isn't:

-rwxr-xr-x 1 root root 14520 Aug 24 17:03 /usr/bin/gs

Otherwise there would be an arrow like this:

-rwxr-xr-x 1 root root 14520 Aug 24 17:03 /usr/bin/gs -> /some/other/file

As pointed out by others, removing the alias from the current shell session is temporary. For permanent removal, you will need to find where it is defined, such as alias gs=xyz, and remove it there, or add unalias gs to your ~/.profile or ~/.bashrc file.

If it is not an alias, you can locate the package that installed the command and uninstall it. On Debian/Ubuntu for instance:

dpkg -S /usr/bin/gs

ghostscript: /usr/bin/gs

sudo apt-get remove ghostscript

If unalias is not working, as is currently the case with fish-shell (refer to this issue #7132 from fish-shell github page for more details), you can use functions with -e (erase functions) to erase the alias.

functions -e [alias name]