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...

  • 6
    gs isn't an alias, it's the name of the GhostScript binary. If you want gs to do nothing then you would have to uninstall ghostscript from your system although this probably isn't a good idea as a lot of other software depends on it.
    – Cheesemill
    Jul 27, 2013 at 18:52
  • @Cheesemill and that explains the ? I had in my head. Why do you assume it is aliased jean000? :)
    – Rinzwind
    Jul 27, 2013 at 18:58
  • 6
    You can use type gs to check if the command is an executable file, an alias, a bash function or a bash builtin.
    – Håken Lid
    Oct 9, 2015 at 19:33
  • 3
    alias --help, unhelpfully, does not reveal any useful answer to this question Apr 14, 2017 at 20:50
  • Actually /usr/bin/ghostscript is a symbolic link to /usr/bin/gs. So file $(which gs) should show ELF which is your executable file and of course, file $(which ghostscript) should show "symbolic link to gs".
    – mchid
    Aug 8 at 22:10

3 Answers 3


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

 unalias gs



unalias - remove alias definitions


unalias alias-name...

unalias -a


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

  • 1
    not working I got unalias: no such hash table element: gs
    – jean000
    Jul 27, 2013 at 18:41
  • 19
    Then you do NOT have it alias'd.
    – Rinzwind
    Jul 27, 2013 at 18:45
  • 11
    caution: unalias -a will remove all alias definitions from the current shell execution environment., possibly including other innocent ones.
    – Huey
    Nov 21, 2014 at 12:48
  • 1
    @assylias I missed that :) edited
    – Rinzwind
    May 20, 2015 at 11:42
  • 6
    unalias removes an alias or aliases from the current shell, but if they are 'stored' in for example ~/.bashrc, they will come back when you create a new shell (or terminal window). So you should remove the definition of the aliases from where they are stored in order to get rid of them, unless they are temporary aliases.
    – sudodus
    Mar 19, 2018 at 17:02

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]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .