0

I installed cowsay, to try fun ways to learn linux commands. Using:

sudo apt install cowsay

And when I tried using it, like this: cowsay helloworld It did not work, I got bash: cowsay: command not found

I couldn't understand why. After trying to look it up, I realized that I could make it work by typing the full path:

/usr/games/cowsay helloworld and it worked. (edited to correct user to usr)

Is there a way to make it work from anywhere by just typing cowsay helloworld, without the full path?

ctrl-alt-delor
  • 27,473
  • 9
  • 58
  • 102
Alch72
  • 3
  • 1
  • 3

1 Answers1

4

You need to add /usr/games to your $PATH variable.

To do so (on a permanent basis):

  1. Edit your .bashrc file, for example, by typing vim ~/.bashrc.
  2. Add the following line to the .bashrc file and save it

    PATH=$PATH:/usr/games
    
  3. Type source ~/.bashrc to make it take effect.

Rasulli
  • 101
  • 4