For example, to open the Inkscape Vector Graphics Editor, I enter inkscape in the terminal.

How can I find such names from other programs?

  • In the documentation. - mkkik
  • a counter question, how did you know the name "Inkscape Vector Graphics Editor"? - Fat-Zer
  • Such a name is "Inkscape Vector Graphics Editor" or "inkscape"? - Enikeyschik
  • @ Fat-Zer, read in the menu. Well this is obvious. - aleksandr barakin 1:22
  • @alexanderbarakin, not at all ... of course it was the expected answer, but you could see somewhere else, maybe in the synaptic, maybe somewhere else ... so I decided to clarify before spending time on a good answer;) - Fat-Zer

3 answers 3

short answer:

you can use this script:

#!/bin/bash [ $# -eq 0 ] && { echo "usage: $0 search string"; exit 1; } d=${XDG_DATA_DIRS:-/usr/local/share:/usr/share} h=${XDG_DATA_HOME:-${HOME}/.local/share} a=${d}:${h}: s=${a//://applications } f="$@" find ${s} -type f -name \*.desktop 2>/dev/null | \ xargs grep -li "${f}" | xargs grep '^Exec' 

an example of use with an example of the result (the case register is not important):

 $ bash Ρ„Π°ΠΉΠ»-с-этим-скриптом inkscape vector Exec=inkscape %F Exec=inkscape 

long answer with explanations:

what you see in the menu is made up of files with the .desktop suffix, which are searched for, according to the standard , in directories:

 $XDG_DATA_DIRS/applications $XDG_DATA_HOME/applications 

if such environment variables are not defined, you should use:

 XDG_DATA_DIRS=/usr/local/share/:/usr/share/ XDG_DATA_HOME=$HOME/.local/share/ 

as a colon, as is usual in unix , directories are separated when several are placed in one variable.


Ie, it is necessary to find the files (in order not to complicate, we proceed from the fact that the above variables are not defined):

 $ find {/usr/share,/usr/local/share,~/.local/share}/applications/ -type f -name \*.desktop 2>/dev/null 

then select from the list those files that mention the search string (for example, Inkscape Vector ):

 $ ... | xargs grep -l 'Inkscape Vector' 

and then output the lines beginning with Exec from the selected files (it is in these lines that it is written what should be launched when clicking on the menu item):

 $ ... | xargs grep '^Exec' 

after connecting to one line, this is a long command:

 $ find {/usr/share,/usr/local/share,~/.local/share}/applications/ -type f -name \*.desktop 2>/dev/null | xargs grep -l 'Inkscape Vector' | xargs grep '^Exec' 

on my system, she issued two lines:

 Exec=inkscape %F Exec=inkscape 

of them, I hope, it is obvious that the inkscape program should be executed.


ps by localized names (for example: Π Π΅Π΄Π°ΠΊΡ‚ΠΎΡ€ Π²Π΅ΠΊΡ‚ΠΎΡ€Π½ΠΎΠΉ Π³Ρ€Π°Ρ„ΠΈΠΊΠΈ ) is also great looking for:

 $ find {/usr/share,/usr/local/share,~/.local/share}/applications/ -type f -name \*.desktop 2>/dev/null | xargs grep -l 'Π Π΅Π΄Π°ΠΊΡ‚ΠΎΡ€ Π²Π΅ΠΊΡ‚ΠΎΡ€Π½ΠΎΠΉ Π³Ρ€Π°Ρ„ΠΈΠΊΠΈ' | xargs grep '^Exec' Exec=inkscape %F Exec=inkscape 
  • one
    I would add that in most DE, under the right mouse button in the menu there is an β€œedit” item that launches the goove editor of this .desktop file itself, where you can see the command without any extra gestures ... - Fat-Zer
  • @ Fat-Zer, I do not use any de, because I can not even check. therefore it is better to abstain. write your answer, please. - aleksandr barakin

How to learn the name of the program under the menu item?

It depends on the Linux distribution. But, anyway, you have a certain analogue of the start button. Clicking on which you get the menu. And further, two options:

  1. In the drop-down menu somewhere there is an item called something like "Edit main menu"
  2. By clicking the right mouse button on this button, you will see the context menu, which will be the item "Edit menu"

Either first or second, launch the menu editor, find the item you need, open its properties and see the name of the module being launched.

By the way, the option of studying shortcuts on the desktop (* .desktop files) is not very good, as there are a lot of items in the menu for launching programs that have no shortcuts.

  • All items in the menu for launching programs are ultimately represented by desktop files. This is the standard freedesktop.org and AFAIK for today there are no DE, which do not obey. - Fat-Zer

Like about Windows , all programs have their own executable file. In the folder with the installed program Inkscape Vector Graphics Editor lies the file inkscape , which starts. You can start it by simply specifying the full path to it.

In order not to specify full paths, you can put links to executable files in the /bin and /sbin directories (as well as their options for users /usr/bin and /usr/sbin ). Then you can call the files just by writing inkscape and Linux itself will find the executable file.

You can prescribe paths in Bash yourself, just like it is done in Windows through the Path , only with a different mechanism.

In any case, when you put a package, you do not know where it places its contents and what executable files are called, so it’s best to look in the documentation.