How do I run an installed program? (Command line)

8,308

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:

Share:
8,308
Antenni
Author by

Antenni

Updated on September 18, 2022

Comments

  • Antenni
    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 a README 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
      George Udosen over 6 years
      Please run which cowsay and let me see the output!
    • Antenni
      Antenni over 6 years
      Hi! 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
      Terrance over 6 years
      cowsay is supposed to be in the /usr/games/ folder. Check echo $PATH and see if that folder is in your path.
    • George Udosen
      George Udosen over 6 years
      So it isn't installed, try re-install!
    • George Udosen
      George Udosen over 6 years
      Run sudo dpkg -l cowsay and post the results into your question.
    • Antenni
      Antenni over 6 years
      Sorry 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
      George Udosen over 6 years
      please run echo $PATH | grep /usr/games and post the result let see it's your path
    • Antenni
      Antenni over 6 years
    • Terrance
      Terrance over 6 years
      cowsay is definitely installed. You need to add the /usr/games/ to your path. One way to try this out is to run a command PATH=$PATH:/usr/games from the terminal then try to run cowsay. This is not permanent, it is just a test.
    • Antenni
      Antenni over 6 years
      Ok, it seems to work that way! pic Thank you! :)