How can I list all applications installed in my system?

I know, I just can hit Super+A to see all installed apps in Ubuntu, but I need a command to list their names. The command

dpkg --get-selections | awk '{print $1}'

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

6 Answers

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 "${app:24:-8}"; 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.


Update:

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 "${app:37:-8}"; done

To unify the previous two commands, you can use:

for app in /usr/share/applications/*.desktop ~/.local/share/applications/*.desktop; do app="${app##/*/}"; echo "${app::-8}"; done
0

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

8

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.

Update:

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 \;
2

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
4

If you need list of applications shown when you hit Super+A, you can use ls /usr/share/applications. The only thing you should do is replace .desktop ending which is quite simple task. I do it with sed:

ls /usr/share/applications | sed s/.desktop// - > installed-apps.txt

But you can do it after you received the list using the text editor.

4

The questioner wants to list the names of all installed "apps".

Regarding apps with .desktop files:

  • the answer by Danatela deals with apps that have .desktop files in /usr/share/applications
  • as pointed out by Radu, apps with .desktop files may also be found in ~/.local/share/applications
  • at this point, it may be noted that apps with .desktop files can have two names
    • one "name" is available by querying the Dash in Unity or from menus in Xubuntu (for example). This name is derived from the Name= line in the respective .desktop file. One example is "Character Map".
    • the other "name" is the one to be used when running the app from the terminal and is the first word after Exec=. In the case of "Character Map", that would be gucharmap.
  • the two names (and the .desktop file) could be related using:
    • sed -ns '1F;/^\[Desktop Entry\]/,/^\[/{/^Name=/p;/^Exec=/h};${z;x;G;p}' /usr/share/applications/*.desktop
    • and
    • sed -ns '1F;/^\[Desktop Entry\]/,/^\[/{/^Name=/p;/^Exec=/h};${z;x;G;p}' $HOME/.local/share/applications/*.desktop

Regarding apps without .desktop files:

Depending on how one defines "app", some don't have .desktop files.

  • would something like conky, poppler-utils, qpdf, xdotool and wmctrl be considered "apps"? How are these to be identified and listed by their names (assuming one has installed them)?
  • What about awk, find, grep, ls and sed to name some more? Are they apps or are they not?

If anything that has a command is thought of as an app, then Linux command to list all available commands and aliases and this answer there will help identify them.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like