I want to remove gs alias from my PC. When I type gs it will open GhostScript. But I checked everywhere in the home directory .alias .bash_aliases .bashrc
I also overwrite the gs with my custom alias.
I can't remove it. And I also type alias in terminal, in the list I couldn't find it.
Please I want to remove it...
43 Answers
The command to remove an alias is unalias so....
unalias gsNAME
unalias - remove alias definitions
SYNOPSIS
unalias alias-name...
unalias -aDESCRIPTION
7The 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 .
-aRemoves All aliases
TL;DR: The command to remove a shell alias is unalias. See the unalias manual. Run:
unalias gsBut 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 gsOn 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 llll 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/gsOn 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/gsghostscript: /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]