In Ubuntu, where to see all programs just like the "program files" in windows, from which I can launch a program from a list of all program installed?
13 Answers
Just for fun
Since OP mentioned: from which I can launch a program from a list of all program installed?
Below a small script that lists all (globally) installed GUI applications. Choose one to launch it, or type a few of its characters and press Return to run the application:
To use
- Copy the script below into an empty file, save it as
list_apps.py Test- run it by the command (open a terminal window, type the command and press Return):
python3 /path/to/list_apps.pyIf all works fine, add it to a shortcut key: choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:
python3 /pat/to/list_apps.pyto a shortcut key combination you like.
The script
#!/usr/bin/env python3
import subprocess
import os
dr = "/usr/share/applications"
apps = []
for f in [f for f in os.listdir(dr) if f.endswith(".desktop")]: try: content = open(dr+"/"+f).read() if not "NoDisplay=true" in content: lines = content.splitlines() name = [l for l in lines if l.startswith("Name=")][0].replace("Name=", "") command = [l for l in lines if l.startswith("Exec=")][0].replace("Exec=", "") apps.append([name, command]) except: pass
apps.sort(key=lambda x: x[0]); apps = sum(apps, [])
displ_list = '"'+'" "'.join(apps)+'"'
try: chosen = subprocess.check_output([ "/bin/bash", "-c", 'zenity --list '+\ '--column="Applications" '+\ '--column="commands" '+\ '--hide-column=2 --height 450 '+\ '--width 300 '+\ '--print-column=2 '+displ_list ]).decode("utf-8").split("|")[-1].strip() chosen = chosen[:chosen.rfind(" ")] if "%" in chosen else chosen subprocess.Popen([ "/bin/bash", "-c", chosen ])
except subprocess.CalledProcessError: passHow it works
The script lists all .desktop files in /usr/share/applications, and checks if the line NoDisplay=true is in the file (which means it is not meant to be used as a GUI). Then it looks into the files, looks up the application name and the command to run it.
The result is listed in a zenity list, to choose from. If you pick one, the corresponding command is executed.
That's it.
Extended version
If you also would like to have a short description on the application, As mentioned in the Comment= line of its .desktop file, use the version below:
#!/usr/bin/env python3
import subprocess
import os
dr = "/usr/share/applications"
apps = []
for f in [f for f in os.listdir(dr) if f.endswith(".desktop")]: try: content = open(dr+"/"+f).read() if not "NoDisplay=true" in content: lines = content.splitlines() name = [l for l in lines if l.startswith("Name=")][0].replace("Name=", "") command = [l for l in lines if l.startswith("Exec=")][0].replace("Exec=", "") comment = [l for l in lines if l.startswith("Comment=")] comment = comment[0].replace("Comment=", "") if comment else "No description" apps.append([name, command, comment]) except: pass
apps.sort(key=lambda x: x[0]); apps = sum(apps, [])
displ_list = '"'+'" "'.join(apps)+'"'
try: chosen = subprocess.check_output([ "/bin/bash", "-c", 'zenity --list '+\ '--column="Applications" '+\ '--column="commands" '+\ '--column="Description" '+\ '--hide-column=2 --height 450 '+\ '--width 500 '+\ '--print-column=2 '+displ_list ]).decode("utf-8").split("|")[-1].strip() chosen = chosen[:chosen.rfind(" ")] if "%" in chosen else chosen subprocess.Popen([ "/bin/bash", "-c", chosen ])
except subprocess.CalledProcessError: pass 2 On ubuntu not all the program are listed in the application menu.
To see them all you will need to open a consoleand type
dpkg -lThis will display all application (the one which run in the UI and the one running in the console)
1If you want to launch applications from the list a nice option is Classic Gnome indicator.
sudo apt-get install classicmenu-indicatorSee here:
7