Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Every time I try to get a program from terminal I don't find it because it doesn't match the real name. Example: Disks name in terminal is gnome-disks.

So what the easiest way to know all programs equivalent names in terminal without suffering of try to find the name every time?

share|improve this question

marked as duplicate by Radu Rădeanu, karel, guntbert, Eric Carvalho, Warren Hill Nov 6 '13 at 7:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers 3

I think that a possible way to do that is by checking the .desktop files located in /usr/share/applications (a solution is linked here How do I find out which program is associated with a Unity launcher icon?).

I post a slightly modified solution. To find for example the "disk usage" application:

grep -l "Name=Disk Usage" /usr/share/applications/* | xargs grep ^Exec | awk -F'=' '{ print $2 }'

It first grep for the files containing the name "Disk Usage". Then it passes the file names to xargs, which launches for every item a grep command to look for the binary name (the line starts with Exec, so grep ^Exec). Finally, I filter out the name with awk (because the line would be Exec=baobab, I use as a separator = and then I take the second column).

To have it like a command, insert these lines in .bashrc (remember to type source ~/.bashrc if you want the command to work right after you insert it — without reloading the shell):

getRealName() {
    grep -l "Name=$1" /usr/share/applications/* | xargs grep ^Exec | awk -F'=' '{ print $2 }'

And then from the commandline, you can type:

$ getRealName 'Disk Usage'

On my Ubuntu it outputs:

share|improve this answer

You can just use zsh instead of bash.

Just install zsh:

sudo apt-get install zsh

It has autocomplete preinstalled. For example if you want to find any command that start from "disk" type disk and press Tab and it will show everything:

  c0rp@c0rp ~ % disk
  Completing external command
  cfdisk                    gnome-disks               udisks                  
  cryptdisks_start          memdiskfind               udisksctl               
  cryptdisks_stop           mkdiskimage               udisks-tcp-bridge       
  fdisk                     sfdisk                    umount.udisks           
  gnome-disk-image-mounter  testdisk                  umount.udisks2          

Also you can read about zsh here. Also you can write your own autocomplete scripts.

share|improve this answer

So what the easiest way to know all programs equivalent names in terminal without suffering of try to find the name every time?

At some point you have to know the command name or at least how the command starts. There is no way around that.

What you can do in the shell is using the TABULATOR key, ill give you an example:

Open a shell and type some command, ill use gnome. The press the TABULATOR key twice. You will see a list with all the commands that start with gnome, type some more and press the TAB twice again and so on. Just try it out.

That is called type completion, if there exists only one possible command, that command will be used, if there are more, a list of possible commands will be shown.

Another nice thing in the shell is the use of reverse-i-search. Its quite simple, press CTRL+r and start typing. It will search your .bash_history (stores a history of the commands you used). Press CTRL+r again for the next match in the history.

share|improve this answer
You have no right in the second paragraph. See this answer or this answer. –  Radu Rădeanu Nov 5 '13 at 11:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.