13

I'm using zsh which uses gs as an alias for git status. But on Ubuntu, gs is an alias for ghostscript. I tried uninstalling ghostscript, but then I get this instead:

The program 'gs' is currently not installed. You can install it by typing:
sudo apt install ghostscript
zsh: command not found: gs

I've also tried:

unalias gs

As explained here:

How to remove an alias?

But that gives me unalias: no such hash table element: gs.

How do I solve this?

uvasal
  • 513
  • 4
    AFAIK gs isn't an alias for ghostcript, it's a binary program provided by the ghostscript package – steeldriver Jun 30 '16 at 13:50
  • Ok, but how would I get rid of that and have it do what I want it to do? – uvasal Jun 30 '16 at 13:52
  • I guess your real question should be "why is zsh dropping to command-not-found for gs when I have defined an alias for it?" – steeldriver Jun 30 '16 at 13:57
  • 2
    Are you sure zsh has this alias set up? Aliases are found before executables so the behavior you describe suggests that there is no such alias. Could you show us the relevant line from your ~/.zshrc file? Does it work as expected if you run alias gs="git status" and then gs? – terdon Jun 30 '16 at 14:05
  • @terdon That was it, thanks. And in fact, for some reason the git status was mapped to gst. On mac it isn't. Please add as answer and I will accept – uvasal Jun 30 '16 at 16:01

1 Answers1

16

It sounds like you simply don't have this alias defined. Aliases take precedence over hashed executables like gs, the presence of gs on your system wouldn't affect the alias at all. So, just add this line to your ~/.zshrc:

alias gs='git status'

Save the file, open a new terminal and you should be all set.

Now, ghostscript is quite useful and you might want to reinstall it. If you do, you can run it as \gs or command gs.

terdon
  • 100,812