7

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?

Jacob Vlijm
  • 83,767
  • 1
    Probably software center is best, although there is no equivalent of "program files" in linux. – Panther Jan 06 '16 at 16:47

3 Answers3

8

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:

enter image description here

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.py
    
  • If 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.py
    

    to 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:
    pass

How 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:

enter image description here

#!/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
Jacob Vlijm
  • 83,767
4

On ubuntu not all the program are listed in the application menu.

To see them all you will need to open a console and type

dpkg -l

This will display all application (the one which run in the UI and the one running in the console)

Angel115
  • 250
  • 2
    No, that displays the list of software packages that are installed. Many packages ( especially those that contain command line programs ) contain multiple applications, and many packages contain none ( they are libraries or data files used by other applications ). – psusi Jan 06 '16 at 22:03
3

If you want to launch applications from the list a nice option is Classic Gnome indicator.

sudo apt-get install classicmenu-indicator

enter image description here

See here: http://www.howtogeek.com/189929/how-to-install-and-launch-the-classic-gnome-menu-in-ubuntu-14.04/

Muzaffar
  • 5,597
  • It does work on Unity. It is intended for Unity. – Muzaffar Jan 13 '16 at 14:50
  • Thank you very much for the answer. I install it in my superuser account. However, it only shows a very small part of the pragrams. Interstingly, it works perfectly in my other normal user account and shows all the programs as shown in your figure. Do you have any idea why, and how to fix it? – velut luna Jan 24 '16 at 01:36
  • Maybe, the Main Menu entries should be edited. Try searching it from the list of the apps. – Muzaffar Jan 24 '16 at 02:14
  • Thanks Muzaffar, one more thing, how to uninstall it, just in case I want to later? – velut luna Jan 24 '16 at 02:25
  • Thanks Muzaffar, one more thing, how to uninstall it, just in case I want to later? – velut luna Jan 24 '16 at 02:34
  • sudo apt-get purge classicmenu-indicator – Muzaffar Jan 24 '16 at 04:36