Check app installed linux

How can I list all applications installed in my system?

is also not an option because it shows all installed packages and it contains drivers, kernels and libraries.

6 Answers 6

I came up with this answer for people who wants to use bash in a good way. It’s clear that the answer of the question is related to the listing of the files from /usr/share/applications , but the problem is that ls command shouldn’t be parsed ever. In the past, I was doing the same mistake, but now I learned that the best way is to use a for loop to iterate over the files, even if I must use some more keys from my precious keyboard:

for app in /usr/share/applications/*.desktop; do echo "$"; done 

I also used in the previous command string manipulation operations: removed from app first 24 characters which are /usr/share/applications/ and last 8 characters which are .desktop .

Another place where you can find applications shown by the Dash is ~/.local/share/applications/*.desktop . So you need to run the following command as well:

for app in ~/.local/share/applications/*.desktop; do echo "$"; done 

To unify the previous two commands, you can use:

for app in /usr/share/applications/*.desktop ~/.local/share/applications/*.desktop; do app="$"; echo "$"; done 

To get the list of all your installed applications with their names, the easiest way is to do:

sudo apt-get install aptitude aptitude -F' * %p -> %d ' --no-gui --disable-columns search '?and(~i. section(libs), !?section(kernel), !?section(devel))' 

It will get you a nice list of all installed packages that are not libraries, not kernels, not development package like this:

* zip -> Archiver for .zip files * zlib1g -> compression library - runtime * zlib1g-dev -> compression library - development * zsh -> shell with lots of features * zsh-common -> architecture independent files for Zsh 

It’s more complete since it also lists non-GUI applications that won’t appear in the .desktop files

I can not agree with this answer to this question. The answer is nice, but not in this place. Is clear enough that the OP wants a list with applications which can be found in the Dash. And there is not place for zsh , zsh-common and others!

@RaduRădeanu I just used tail to show an excerpt of my installed packages, which ends with z, if I had used head, they will start with a, 2) he wants applications listed in the «dash»? Are you sure?

Braiam, came on, it is not about which start with z or with a. When you hit Super+A on your keyboard what can you see appearing on your screen starting from the top-left corner?

@RaduRădeanu OP’s title says that he wants to list all applications installed in his system excluding libraries, drivers, kernels and others.. He mentions one of the way (which he uses) to get the app-list, which is using Super + A and that just displays a subset of the applications installed in the system; but this covers most if not all.. the answer would be even complete with —no-gui removed.

Читайте также:  Libpng12 0 linux mint

Run the below command to see all the installed applications,

ls /usr/share/applications | awk -F '.desktop' ' < print $1>' - 

If you want to get the list of all installed applications, then run the below command,

ls /usr/share/applications | awk -F '.desktop' ' < print $1>' - > ~/Desktop/applications.txt 

It will stores the above command output to applications.txt file inside your ~/Desktop directory.

OR

Also run the below command on terminal to list the installed applications,

find /usr/share/applications -maxdepth 1 -type f -exec basename <> .desktop \; | sort 

To get the list in text file, run the below command

find /usr/share/applications -maxdepth 1 -type f -exec basename <> .desktop \; | sort > ~/Desktop/applications.txt 

Desktop entries for all the installed applications are stored inside /usr/share/applications directory, where file names are in the format of application-name.desktop .Removing the .desktop part from the file names will give you the total list of installed applications.

As @Radu suggested, you can also find desktop entries for your additional installed applications inside ~/.local/share/applications directory.

find /usr/share/applications ~/.local/share/applications -maxdepth 1 -type f -exec basename <> .desktop \; 

Thanks Radu however how many times have you seen a filename containing a newline? Never? Thought so . So I should never ever use something very useful because of an edge case that virtually never happens? I think I’ll keep parsing ls — for representational purposes and for non-critical tasks such as the one above — and try to keep in mind this limitation, thank you for the heads up!

Not sure why most of the answers posted involves extracting the filename of .desktop shortcuts. Your .desktop shortcut filename can be anything but what matters is the Name field inside the shortcut file. If you want to build the list of installed application names showing in Dash, just «grep» that field under [Desktop Entry]

Rudimental code, with bash

#!/bin/bash for file in /usr/share/applications/*.desktop; do while IFS== read -r key val do if [[ -z $key ]]; then continue else if [[ $key =~ ^\[Desktop\ Entry ]]; then interesting_field=1 elif [[ $key =~ ^\[ ]]; then interesting_field=0 fi fi [[ $interesting_field -eq 1 ]] && [[ $key == "Name" ]] && echo $val done < $file done 

But this does not take into account shortcuts that are hidden from being showed in Dash. Someone with better understand of .desktop spec might want to further expand this code to exclude those kinda of shortcuts

Edit : another attempt, with Python

#!/usr/bin/python from os import listdir from os.path import isfile, join import ConfigParser SHORTCUTDIR = "/usr/share/applications/" shortcuts = [ file for file in listdir(SHORTCUTDIR) if isfile(join(SHORTCUTDIR, file)) and file.endswith(".desktop") ] dash_shortcuts = [] for f in shortcuts: c = ConfigParser.SafeConfigParser() c.read(SHORTCUTDIR + f) try: if c.getboolean('Desktop Entry', 'NoDisplay') is True: continue except ConfigParser.NoOptionError: pass try: if "unity" in c.get('Desktop Entry', 'NotShowIn').lower(): continue except ConfigParser.NoOptionError: pass try: if "unity" not in c.get('Desktop Entry', 'OnlyShowIn').lower(): continue except ConfigParser.NoOptionError: pass dash_shortcuts += [ c.get("Desktop Entry", "Name") ] for s in sorted(dash_shortcuts, key=str.lower): print s 

Источник

Читайте также:  Обновить платформу 1с 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.

Источник

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

I want to find out if a program - Chromium for example - is installed on Ubuntu or not. Manually or as a package. How do I know if a program is installed via command line?

5 Answers 5

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.

Читайте также:  Chown and chgrp in 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:

enter image description here

To listing all installed packages, just use

Use Ubuntu Software Center type chromium

If you see the green icon like this:

enter image description here

That means it is installed 🙂

nice answer helpful. but here when i hit dpkg -l to check all package installed, it listed all but i was unable to see list till 1st program. Do you knw how can i see it till 1st program

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

enter image description here

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 . 

Источник

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