8

I have Debian Squeeze installed on my Raspberry Pi and I'm trying to learn some basic Linux commands. I stumbled upon an article titled Funny things to do in the terminal and proceeded to install cowsay using.

$ sudo apt-get install cowsay

I get an error when trying to use it.

bash: cowsay: command not found

I then proceeded to install it again, but it let me know I have the latest version installed. I'm still new to Linux so I'm not sure if I'm going about this the right way.

sudo / -name cowsay returns:

  • /usr/games/cowsay
  • /usr/share/doc/cowsay
  • /usr/share/cowsay

UPDATE

The new Debian Squeeze aka Raspbian "Wheezy" aka the recommended distro as of 7/17/2012 doesn't have this problem anymore.

2
  • 1
    What command are you using that fails?
    – Malvineous
    Jul 16, 2012 at 3:54
  • I've tried cowsay --help, cowsay, and cowsay 'whattup' Also, including sudo in front of those commands does not help.
    – EGHDK
    Jul 16, 2012 at 4:02

1 Answer 1

10

Running sudo find / -name cowsay verified that cowsay is installed. Since prefacing the cowsay command with /usr/games worked, the problem is that the /usr/games directory is not in your path. To fix this add the following

PATH="$PATH:/usr/games"
export PATH

to the .bash_profile file in your home directory.

How to do it:

Type the following command to edit your bash profile.

$ nano ~/.bash_profile

Append the following lines to the end of the file.

PATH="$PATH:/usr/games"
export PATH`

Save your changes and exit. When you open a new terminal, you should be able to enter.

$ cowsay “$USER is my friend”
7
  • 1
    Doesn't this back the point that linux is too hard to learn? How would someone solve this without the internet? Was this a fluke? If I try to install this on a friends Pi will I get the same problem? Is it the fault of the distro?
    – EGHDK
    Jul 16, 2012 at 4:51
  • 3
    No Linux is not too hard to learn. Anything new is difficult. If it helps we all had a learning curve when learning Linux/Unix. You had a similar learning curve when learning to use a mac or PC. You just don't remember it being that difficult. You may want to get a book on linux. Before the internet we hounded system admins and BBS with questions. If you installed this on another Pi with the same disk image and using the same cowsay package you would get the same problem. This should have been done (or verified) by the cowsay package when you installed it. Jul 16, 2012 at 5:20
  • So is this the method to fix anything that gives me the command not found error?
    – EGHDK
    Jul 16, 2012 at 13:50
  • @EGHDK no it is not that simple. In any complex system several things can go wrong. For example you might get the same error message if the file did not exist or if you misspell the command. However, once you ran the find command we new the file existed and we new from the commands you tried that you spelled it correctly so the next logical thing to check was if it worked when given the full path to the file "/usr/games/cowsay" when that worked we new what the problem was. Just like the mechanic or the Dr. we ran some tests checked the results and narrowed in on a solution. Jul 16, 2012 at 14:40
  • 1
    Potential bug with the package? Jul 16, 2012 at 16:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.