How do I run an installed program? (Command line)
Generally when you install a program, you will be able to run it from the command line by typing the name of the program installed. Note that this name will not always match the name of the package (e.g. alsa-tools provides as10k1, hda-verb, sbiload and us428control).
As discussed in the comments by George and Terrance, the program must also be in your PATH variable so that you don't require the full path to run it. For some reason "cowsay" is not, so you can temporarily add it as described by Terrance using:
PATH=$PATH:/usr/games
If this works, you can permanently add this location to your path variable. This can be done by modifying .profile, .pam_environment, or other locations as described in the references below. For example, adding the following to ~/.profile should work:
export PATH="$PATH:/usr/games"
The above will take effect on the next login.
References:
- How to add a directory to the PATH?
- https://help.ubuntu.com/community/EnvironmentVariables#Persistent_environment_variables
Antenni
Updated on September 18, 2022Comments
-
Antenni over 1 year
(This is all in the command line/prompt) Hi!
So, my problem is MOST BASIC in nature, and it's like this:
If I want, for an example, to install and run 'cowsay' -program, I assume I do it like:
sudo apt-get install cowsay
BUT now, if I just try to use it, like:
cowsay "Cow goes moo"
I get: command not found
So, ok, maybe the program is not installed..?
So I type:
dpkg -L cowsay
And, no, it is installed alright, maybe it's just not registered into some default library cache of programs...(if that even is a thing)?
In short, I have no idea how to proceed. The objects listed via
dpkg
are a lot of files with.cow -format
, a few.gz -packages
and aREADME file
, aka no.exe
.bin
executables that I can find. The readme file has, as far as I can tell, nothing of use. It's just copyright information and short history of the program.Thank you for your time! :)
-
George Udosen over 6 yearsPlease run
which cowsay
and let me see the output! -
Antenni over 6 yearsHi! When I type:
root@l4126:/# which cowsay
It just gives me:root@l4126:/#
As in empty line. Sorry, I am having some issues with posting actual screen-captures. -
Terrance over 6 yearscowsay is supposed to be in the
/usr/games/
folder. Checkecho $PATH
and see if that folder is in your path. -
George Udosen over 6 yearsSo it isn't installed, try re-install!
-
George Udosen over 6 yearsRun
sudo dpkg -l cowsay
and post the results into your question. -
Antenni over 6 yearsSorry for the delay, I am still learning the interface. But this is what that path looks like, so this is not installed? I am very confused. :/ !Screen Capture
-
George Udosen over 6 yearsplease run
echo $PATH | grep /usr/games
and post the result let see it's your path -
Antenni over 6 years
-
Terrance over 6 yearscowsay is definitely installed. You need to add the
/usr/games/
to your path. One way to try this out is to run a commandPATH=$PATH:/usr/games
from the terminal then try to run cowsay. This is not permanent, it is just a test. -
Antenni over 6 yearsOk, it seems to work that way! pic Thank you! :)
-