How do I find packages to install via apt-get

  • After doing a man apt-get and cursory Google search it's not clear how I find new programs to install (from the internet) using apt-get (which is amazingly powerful and simple coming from another Linux distro).

    I'm using Ubuntu Server 8.04 LTS (an inherited system used for some random work), so no GUI.

    Anyone have quick advice here?

  • Peter Smit

    Peter Smit Correct answer

    10 years ago

    I always use packages.ubuntu.com

    Also you can use apt-cache search for command-line searching. Or you can use the GUI package manager (Ubuntu Software Center / Synaptic) for searching software.

    How do I "import" a package from packages.ubuntu.com?

  • If you search for "nvidia settings".

    apt-cache search nvidia settings
    

    The output is:

    nvidia-settings - Werkzeug für die Konfiguration des NVIDIA-Grafiktreibers
    nvidia-settings-updates - Tool of configuring the NVIDIA graphics driver
    

    You see 2 packages nvidia-settings and nvidia-settings-updates.

    To find the related binary to the package nvidia-settings.

    dpkg -L nvidia-settings | grep bin
    

    The output is:

    /usr/bin
    /usr/lib/nvidia-settings/bin
    /usr/lib/nvidia-settings/bin/nvidia-settings
    

    nvidia-settings is the binary name to start the program.

  • With binaries in particular there is an application that is automatically run if you run a command that is not installed. For example,

    $ bonnie++
    The program 'bonnie++' is currently not installed.  You can install it by typing:
    sudo apt-get install bonnie++
    

    Other than that, there are searches: apt-cache search <query> or aptitude search <query> which can be preferable if you want to get really involved with filters.

  • I think, you are referring to the binary program name included in the package. I use this technique to find this:

    simply type dpkg -L <package-name> in a terminal, it will display all files installed by that package, then you can recognize the binary program names by looking at their location. Usually programs are installed in /usr/bin directory or /sbin directory.

    Let's see an example:

    [email protected]:~$ dpkg -L gnome-screenshot 
    /.
    /usr
    /usr/bin
    /usr/bin/gnome-screenshot
    /usr/share
    /usr/share/GConf
    /usr/share/GConf/gsettings
    /usr/share/GConf/gsettings/gnome-screenshot.convert
    /usr/share/applications
    /usr/share/applications/gnome-screenshot.desktop
    /usr/share/man
    /usr/share/man/man1
    /usr/share/man/man1/gnome-screenshot.1.gz
    /usr/share/gnome-screenshot
    /usr/share/gnome-screenshot/gnome-screenshot.ui
    /usr/share/glib-2.0
    /usr/share/glib-2.0/schemas
    /usr/share/glib-2.0/schemas/org.gnome.gnome-screenshot.gschema.xml
    /usr/share/doc
    /usr/share/doc/gnome-screenshot
    /usr/share/doc/gnome-screenshot/copyright
    /usr/share/doc/gnome-screenshot/NEWS.gz
    /usr/share/doc/gnome-screenshot/changelog.Debian.gz
    

    Note that, the program name of gnome-screenshot package is gnome-screenshot.

    You asked

    Is there any standard way to know the <packageName> for the desired program?

    Sometimes the terminal can tell your the package name required to be installed to have a desired program. It happens when the program is in Standard repository and you have enabled those repository.

    For example, If I type gnome-documents when no such package is installed, the terminal will tell be this:

    [email protected]:~$ gnome-documents
    The program 'gnome-documents' is currently not installed.  You can install it by typing:
    sudo apt-get install gnome-documents
    

    But, in this case, I should at least know the program name

    Yah it is similar but not same Because he just wants to find new programs/packages... While in my case I know the package names and I want to know there apt-get names...i.e. as in the example I know the package name: "NVIDIA X Server Settings"(actual name) And want to know apt-get name: "nvidia-settings"

  • You can try the program 'aptitude' from the command line. It is a graphical package manager. Remember to append sudo to the program to do any real installations. 'sudo aptitude'. You can also use aptitude just like apt-get; "sudo aptitude install". I prefer apt-get for single packages that I know the names for.

    Also, are you just on a command line? If you have a desktop you can use System -> Preferences -Synaptic, or the Ubuntu Software Center. They function nearly the same however they have a simpler package search.

    I find the Software Center most useful with Google a close second when I know what I want but don't know a package name. (And the Meerkat Software Center is new, improved and more Googly).

    Is the software center new to Lucid Lynx? I have an older image I inherited (Ubuntu Server 8.04 LTS)

    r00fus - It became included in Ubuntu 9.10 I believe.

  • You can get a (long) list of installable packages by typing apt-get install and then hitting TAB twice (for autocomplete). This is limited because it doesn't tell you what the packages do (Synaptic or Software Centre would be better for this) but it can be useful when you can't remember the exact name of a package. You can also type the first part of the package name (eg openoffice) to get a shorter list of more relevant packages.

    Hmm.. just tested this doesn't seem to work, when I double tab, it seems to want to complete the command with a local file (ex: i see .aptitude .bashrc .bash_history ... )

    That's strange, I get `Display all 39603 possibilities? (y or n)` which gives a list of packages.

  • Use command-line tool if you know the package name you want. I you don't, use software center. You can get the package name via software center and use it in the terminal, if you really need to use apt-get tool from command line. And usually package name is the same as program name.

  • you can run (preferably in your ~/.bashrc)

    . /etc/bash_completion
    

    when you type:

    sudo apt-get in<hit tab twice here>
    

    it will propose install then start typing part of the name - for example nvidia

    and you will see the available choices starting with nvidia

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM