Check installed programs linux

How do I list all installed programs?

Hm, I’m interested in Red Hat, Ubuntu, and cygwin. Is there a distribution-free way to list the programs with some command line argument?

4 Answers 4

That depends on your distribution.

  • Aptitude-based distributions (Ubuntu, Debian, etc): dpkg -l
  • RPM-based distributions (Fedora, RHEL, etc): rpm -qa
  • pkg*-based distributions (OpenBSD, FreeBSD, etc): pkg_info
  • Portage-based distributions (Gentoo, etc): equery list or eix -I
  • pacman-based distributions (Arch Linux, etc): pacman -Q
  • Cygwin: cygcheck —check-setup —dump-only *
  • Slackware: slapt-get —installed

All of these will list the packages rather than the programs however. If you truly want to list the programs, you probably want to list the executables in your $PATH , which can be done like so using bash’s compgen :

Or, if you don’t have compgen :

#!/bin/bash IFS=: read -ra dirs_in_path "; do for file in "$dir"/*; do [[ -x $file && -f $file ]] && printf '%s\n' "$" done done 

It would be better to distinguish between package managers instead of «distributions». NetBSD’s pkgsrc runs on any Linux, and some package managers can be used on multiple Uinces.

Answering the second part of the question (nothing really to be added to Chris’ answer for the first part):

There is generally no way of listing manually installed programs and their components. This is not recorded anywhere if you didn’t use a package manager. All you can do is find the binaries in standard locations (like Chris suggested) and in a similar way, guess where some libraries or some manual pages etc. came from. That is why, whenever possible, you should always install programs using your package manager.

Programs should be reachable via the PATH, so just list everything in the path:

Expect a result of about 3k-4k programs.

To exclude a probable minority of false positives, you may refine the approach:

for d in $ ; do for f in $d/* ; do test -x $f && test -f $f && echo $f done done 

It didn’t make a difference for me.

Источник

Shell command to check installed programs in linux

Again, third party shells that one adds to that list are in the area of the package hierarchy, and the command to find the installed ones is thus If you have the sqlports package installed, you can also use to make SQL queries against the database to find installed shell packages. Again, the list of approved shells is obtainable with and again this is not the same as the list of installed shells.

Читайте также:  Installing putty on linux

Show every installed command-line shell?

On FreeBSD, TrueOS/PC-BSD, DragonFly BSD, et al.

The list of approved shells, i.e. shells that the administrator permits users to change their login shell to with the chsh command, is in the conventional /etc/shells file. A simple

However, this is not quite the list of installed shells. Although many third party shells (the operating system itself coming with the Almquist and TENEX C shells) install themselves into /etc/shells when installed from packages or ports, this isn’t guaranteed and of course the administrator may have changed /etc/shells so that there is a shell that was installed but that is not approved .

The list of installed shells is not hard to come by, though. As aforementioned, the Almquist and TENEX C shells come with the operating system, as /bin/sh and /bin/tcsh (a.k.a. /bin/csh ) respectively. To them one adds the list of shells that are installed from packages. In the FreeBSD package system, all shells are in the shells/ area of the package hierarchy, so one simply uses the pkg tool to query the installed package database:

pkg query "%o %n-%v %c" | awk '/^shells\// '

This will catch fish, rc, v7sh, heirloom-sh, and suchlike if one has them installed but will also yield a handful of false positives for packages that are in the shells/ hierarchy but that aren’t per se shells, such as bash-completion.

Further reading

On OpenBSD

OpenBSD is like FreeBSD, TrueOS et al. with some differences. One still runs

to see the list of approved shells, and there is still the difference between approved and installed shells.

OpenBSD has an older package manager, though, and a different set of shells that come in the operating system itself.

On OpenBSD, the operating system itself comes with the Korn shell (pdksh, specifically) and the C shell (not TENEX C shell) as /bin/sh (a.k.a. /bin/ksh ) and /bin/csh (not /bin/tcsh ) respectively.

Again, third party shells that one adds to that list are in the shells/ area of the package hierarchy, and the command to find the installed ones is thus

pkg_info -P -A | grep '^shells/'

If you have the sqlports package installed, you can also use sqlite3 to make SQL queries against the /usr/local/share/sqlports database to find installed shell packages.

Читайте также:  Не открывается steam linux

Further reading

On Debian, Ubuntu, et al.

Again, the list of approved shells is obtainable with

On Debian and Ubuntu, every shell is managed by the package manager. There are no shells that «come with the operating system».

Again, all shell packages are handily marked. APT (the Advanced Packaging Tool) has the notion of «sections» rather than a hierarchy as the BSD ports/packages worlds have, and shell packages are in the Shells section.

There are several tools that can query the package manager’s database. I choose aptitude here. One runs

This is aptitude ‘s «shorthand» search syntax. The «true» search syntax would be ‘?installed ?section(shells)’ which is somewhat more to type. Furthermore: you can get aptitude to print out more information about each package with its -F command-line option. Consider

aptitude search -F '%p %v %t %d' '~i~sshells'

Further reading

  • Shells. packages.debian.org.
  • Daniel Burrows and Manuel A. Fernandez Montecelo (2016). aptitude users’ manual . Debian.

You could use the /etc/shells file. It should contain a list of valid login shells.

Script to check if some program is already installed, apt-mark showinstall will list all packages marked install (already installed, or queued for installation). After that, it’s a simple matter of

How to List All Installed Packages in Ubuntu 18.04 Linux

Find if a Program is installed with a Script

http://filmsbykris.com/wordpress/?p=196Got Questions? visit http://FilmsByKris.com/forumChat Duration: 8:02

Check if a program is installed Linux

Check if certain programs are installed

To find out if nmap is installed, you could do:

dpkg --get-selections | grep nmap 

So, to check if nmap is installed and install it if it isn’t, you could do the following:

dpkg --get-selections | grep nmap || apt-get install nmap 
rpm -qa | grep nmap || yum install nmap 

How to check if a specific program (shell command) is available on a, It behaves like the `which` command in Linux shell. * If executable is found, it will return absolute path to it, or an empty string.

How can I find out if a specific program is installed? [duplicate]

And there’s always apt-cache policy (no sudo needed).

oli@bert:/$ apt-cache policy gnuift gnuift: Installed: (none) Candidate: 0.1.14-11 Version table: 0.1.14-11 0 500 http://archive.ubuntu.com/ubuntu/ oneiric/universe amd64 Packages 
oli@bert:/$ apt-cache policy firefox firefox: Installed: 8.0+build1-0ubuntu0.11.10.3 Candidate: 8.0+build1-0ubuntu0.11.10.3 Version table: *** 8.0+build1-0ubuntu0.11.10.3 0 500 http://archive.ubuntu.com/ubuntu/ oneiric-updates/main amd64 Packages 500 http://archive.ubuntu.com/ubuntu/ oneiric-security/main amd64 Packages 100 /var/lib/dpkg/status 7.0.1+build1+nobinonly-0ubuntu2 0 500 http://archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages 

Or dpkg : dpkg -l | grep -E ‘^ii’ | grep . When it’s not installed it won’t show output. When it is, it’ll show something like:

oli@bert:~$ dpkg -l | grep -E '^ii' | grep firefox ii firefox 8.0+build1-0ubuntu0.11.10.3 Safe and easy web browser from Mozilla ii firefox-branding 8.0+build1-0ubuntu0.11.10.3 Safe and easy web browser from Mozilla - transitional package ii firefox-globalmenu 8.0+build1-0ubuntu0.11.10.3 Unity appmenu integration for Firefox ii firefox-gnome-support 8.0+build1-0ubuntu0.11.10.3 Safe and easy web browser from Mozilla - GNOME support ii firefox-locale-en 8.0+build1-0ubuntu0.11.10.3 English language pack for Firefox 

It’s obviously a fuzzier search but handy if you’re not sure which package you’re looking for.

Читайте также:  Scan port open linux

For manually installed things.

A bit harder but if they’re on the current path, you could just run them. That’s a bit of mission so I’d rather just run:

oli@bert:/$ which chromium-browser /usr/bin/chromium-browser 
oli@bert:/$ which gnuift # returns nothing 

Which is better?

That depends on the sanity of user. There’s nothing to stop somebody installing something called chromium-browser that isn’t Chromium. They could even package it up incorrectly and install that. Neither method can be 100% certain.

But assuming the owner is sane — packages should be good enough for most people.

e,g, Chromium , Run in terminal chromium-browser if it’s install, it will be open. If it’s not you will get

chromium-browser: command not found 

To check whether a package is install also

dpkg -l | grep chromium-browser 

You will get like this if it is installed:

To listing all installed packages, just use

Use Ubuntu Software Center type chromium

If you see the green icon like this:

That means it is installed 🙂

For a graphical view, open the Software Centre , and click on the Installed button at the top:

You may want to click the Show X technical items button if you’re interested in system stuff, but Chromium would be there on the list anyway.

If you want a command line solution, then dpkg is your friend:

$ dpkg -l Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Description +++-==============-==============-============================================ ii accountsservic 0.6.14-1git1ub query and manipulate user account informatio ii acl 2.2.51-3 Access control list utilities ii acpi-support 0.138 scripts for handling many ACPI events ii acpid 1:2.0.10-1ubun Advanced Configuration and Power Interface e ii acroread 9.4.6~enu-0one Adobe Reader ii acroread-commo 9.4.6~enu-0one Adobe Reader - Common Files ii adduser 3.112+nmu1ubun add and remove users and groups ii adium-theme-ub 0.3.1-0ubuntu1 Adium message style for Ubuntu ii aisleriot 1:3.2.1-0ubunt Solitaire card games ii alacarte 0.13.2-2ubuntu easy GNOME menu editing tool ii alsa-base 1.0.24+dfsg-0u ALSA driver configuration files ii alsa-utils 1.0.24.2-0ubun Utilities for configuring and using ALSA . 

Check if a program is installed Linux, Check if a program is installed Linux — Debian — dpkg — shell script — BASH http Duration: 6:09

Источник

Оцените статью
Adblock
detector