Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: How to know the binary name of an application to run it from the Terminal??

  1. #1
    Join Date
    Mar 2013
    Beans
    15

    How to know the binary name of an application to run it from the Terminal??

    I want to run all the applications through the terminal rather than double clicking on its icon.
    For that i need to know the binary name of the applications.
    eg. gedit text1.txt
    evince mytext.pdf
    how can one know the binary name of all the applications to be able to run from the terminal??

  2. #2
    iMac71 is offline Gee! These Aren't Roasted!
    Join Date
    Dec 2012
    Beans
    166

    Re: How to know the binary name of an application to run it from the Terminal??

    what you wish is very easy to get: simply do these steps:
    • enter the name of your desired application in the search field of the ubuntu software center;
    • when the icon of that application appears, click on "more info";
    • scroll the window until you see the "Version" field: here you find the name you're looking for.
    Last edited by iMac71; March 12th, 2013 at 05:59 AM.

  3. #3
    Join Date
    Mar 2013
    Beans
    15

    Re: How to know the binary name of an application to run it from the Terminal??

    In the end it turned out to be a silly question.
    Thanks!!

  4. #4
    iMac71 is offline Gee! These Aren't Roasted!
    Join Date
    Dec 2012
    Beans
    166

    Re: How to know the binary name of an application to run it from the Terminal??

    I'm not so sure that your question be really silly.
    For instance, I used the above procedure for creating my own installation script, where there are the binary names of all the applications I want to install after having installed a new release of Ubuntu.

  5. #5
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How to know the binary name of an application to run it from the Terminal??

    package names you install and names of binaries you run are not necessarily the same.

    To browse available packages you can use
    Code:
    apt-cache seach <keyword>
    and to get the list of installed ones
    Code:
    dpkg --get-selections
    To get the actual command of gui programs you can look in .desktop files located in /usr/share/applications

    Code:
    grep ^Exec= /usr/share/applications/*.desktop
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

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

    Re: How to know the binary name of an application to run it from the Terminal??

    @Vaphell, if you don't mind, please look at this laborious code that I came up with to relate .desktop files, Name= and Exec=. I'm sure you'll boil it down to a line or two!

    Code:
    grep '^Name=' /usr/share/applications/*.desktop > ~/Desktop/mgtl1.txt && grep -h '^Exec=' /usr/share/applications/*.desktop > ~/Desktop/mgtl2.txt && paste -d':' ~/Desktop/mgtl1.txt ~/Desktop/mgtl2.txt > ~/Desktop/mgtl3.txt && perl -p -i -e 's/\/usr\/share\/applications\///'g ~/Desktop/mgtl3.txt && perl -p -i.bak -e 's/\n/\n\n/'g ~/Desktop/mgtl3.txt && perl -p -i.bak -e 's/:/\n/'g ~/Desktop/mgtl3.txt
    Also, see this: http://ubuntuforums.org/showpost.php...76&postcount=6 and http://ubuntuforums.org/showthread.p...5#post12473245

  7. #7
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: How to know the binary name of an application to run it from the Terminal??

    @vasa1
    Would this do what you want? Edit. Corrected to work for any order and number of Name=/Exec= lines in a .desktop
    Code:
    sed -nrs '/^\[Desktop Entry\]/d;/^(\[|Name=|Exec=)/p;${g;p}' /usr/share/applications/*.desktop
    Last edited by schragge; March 13th, 2013 at 03:35 PM.

  8. #8
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: How to know the binary name of an application to run it from the Terminal??

    You could also just launch the program normally and then use...
    Code:
    ps ax
    to list all running processes. The application you have just launched will be near the bottom.
    Cheesemill

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

    Re: How to know the binary name of an application to run it from the Terminal??

    Quote Originally Posted by schragge View Post
    @vasa1
    Would this do what you want
    Code:
    sed -n '/^Name=/p;/^Exec=/{G;p}' /usr/share/applications/*.desktop
    Hi, please redirect that to a file and then look for the ones involving LibreOffice. The problem there is that the LibreOffice .desktop files (and a few others) don't always have Name= first and Exec= second. Also, there are instances of Name=, Exec=, Exec=, Name in one .desktop file. And those .desktop files are why I took a long route. I've referred to that problem in the links I provided.

  10. #10
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: How to know the binary name of an application to run it from the Terminal??

    @vasa1
    I've edited my post, please take another look.
    PS. I don't have LibreOffice installed, so cannot test it.
    Last edited by schragge; March 12th, 2013 at 05:40 PM.

Page 1 of 2 12 LastLast

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
  •