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

```
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