Results 1 to 8 of 8

Thread: Way to find terminal name for applications

  1. #1
    Join Date
    Mar 2005
    Location
    Sweden, Uppsala
    Beans
    944
    Distro
    Ubuntu 12.04 Precise Pangolin

    Way to find terminal name for applications

    Hi.
    I old Ubuntu with gnome2 you could right-click the startup-link and choose preference and under Command you see the 'terminal name' for example:

    'Log File Viewer' has the command 'gnome-system-log'

    But now the you start an application in 12.04 Unity thru: Home-button and typing, the application appear very nice, but how do I find the name if I for instance need to run the application as super user?

    /Cheers
    /Azyx

    Ubuntu 16.04LTS 64bit, 16.04 Lubuntu 32-bit on eeePCs and OSX on a G4 800MHz iMac (iLamp). I think I have an W7 on one of my Virtualbox machine under 16.04LTS?

  2. #2
    Join Date
    Jul 2011
    Beans
    3,037
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Way to find terminal name for applications

    Probably not the most elegant solution, but the folder /usr/share/applications has a lot of .desktop files, among them gnome-system-log.desktop. If you look into this file (it is a text file) you see

    Code:
    [Desktop Entry]
    Name=Log File Viewer
    Comment=View or monitor system log files
    Exec=gnome-system-log
    Icon=logview
    Terminal=false
    Type=Application
    StartupNotify=true
    Categories=GTK;GNOME;System;Monitor;
    NotShowIn=KDE;
    X-GNOME-DocPath=gnome-system-log/gnome-system-log.xml
    X-GNOME-Bugzilla-Bugzilla=GNOME
    X-GNOME-Bugzilla-Product=gnome-utils
    X-GNOME-Bugzilla-Component=logview
    X-GNOME-Bugzilla-Version=3.4.1
    X-Ubuntu-Gettext-Domain=gnome-system-log
    The screen name is Log File Viewer and application name gnome-system-log is executed. So the name that appears behind exec is the command that gets executed.

  3. #3
    hakermania's Avatar
    hakermania is offline Τώρα ξέρεις τι γράφω εδώ!
    Join Date
    Aug 2009
    Location
    Greece
    Beans
    1,705
    Distro
    Ubuntu Development Release

    Re: Way to find terminal name for applications

    2F4U is correct, that is the best way (to look at the Exec field of the corresponding desktop file from /usr/share/applications)

    Alternatively, you can open the System Monitor while the application is running so as to relieve its name. Note that by doing this there is a (very) rare case not to be able to launch the application through terminal just by typing its name you saw at the System Monitor, simply because it is not in $PATH.

  4. #4
    Join Date
    Dec 2007
    Beans
    12,521

    Re: Way to find terminal name for applications

    So I guess some competent person could write a script to go through all the .desktop files and pull out just the relevant lines:
    Code:
    [Desktop Entry]
    Name=Log File Viewer
    Comment=View or monitor system log files
    Exec=gnome-system-log
    to give something like:
    Code:
    Name=Log File Viewer --- Exec=gnome-system-log
    Name=... --- Exec=...
    Name=... --- Exec=...

  5. #5
    Join Date
    Jun 2011
    Location
    United Kingdom
    Beans
    Hidden!
    Distro
    Lubuntu Development Release

    Re: Way to find terminal name for applications

    Code:
    for files in /usr/share/applications/*.desktop; do grep -e "^Exec=" -e "^Name=" $files | sed 's/Exec=/Command: /g' | sed 's/Name=/Name: /g' && echo "-------------------------------"  ; done
    seems to work okay. Returns list of commands and programs, separated by program.

    Hope that helps.

  6. #6
    Join Date
    Dec 2007
    Beans
    12,521

    Re: Way to find terminal name for applications

    Quote Originally Posted by MG&TL View Post
    ...
    Hope that helps.
    I could have done that
    Would have taken me a few weeks though.

    Anyway, I modified it a bit to get the output as a file:
    Code:
    for files in /usr/share/applications/*.desktop; do grep -e "^Exec=" -e "^Name=" $files | sed 's/Exec=/Command: /g' | sed 's/Name=/Name: /g' >> mgtl.txt ; done

  7. #7
    Join Date
    Mar 2005
    Location
    Sweden, Uppsala
    Beans
    944
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Way to find terminal name for applications

    You are great Thanks a lot every one

    Cheers
    /Azyx

    Ubuntu 16.04LTS 64bit, 16.04 Lubuntu 32-bit on eeePCs and OSX on a G4 800MHz iMac (iLamp). I think I have an W7 on one of my Virtualbox machine under 16.04LTS?

  8. #8
    Join Date
    Dec 2007
    Beans
    12,521

    Re: Way to find terminal name for applications

    @MG&TL, small problem ... some .desktop files have Exec before Name. LibreOffice components have this order

    Actually, it's worse: they have Exec, Name and then a little lower down in the same .desktop file, there's Name, Exec. !!!

    It's not a big deal but is there a way to ensure that the output is always in Name, Command order whether or not the .desktop has Name first and more than one Name= and Exec=?
    Last edited by vasa1; January 25th, 2013 at 12:41 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •