Question: 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.

Answer: 
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](http://mywiki.wooledge.org/ParsingLs). 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](http://tldp.org/LDP/abs/html/string-manipulation.html) 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

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

**Regarding apps with .desktop files**: 

* [the answer by Danatela](https://askubuntu.com/a/433621/248158) deals with apps that have .desktop files in `/usr/share/applications`
* as [pointed out by Radu](https://askubuntu.com/a/433761/248158), 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](http://ubuntuforums.org/showthread.php?t=2124743&p=12554337#post12554337) 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](https://stackoverflow.com/q/948008) and [this answer there](https://stackoverflow.com/a/949006) will help identify them.