10

Every time I try to use a program from the terminal, I can't find it because it doesn't match the real name. For example, I type disks in terminal, but the real name is gnome-disks.

I tried to use:

sudo dpkg -l | grep disks 

to find it, but what about programs that do not match at all? What's the easiest way to find all names of installed programs in the terminal?

4 Answers 4

4

This will list all man pagenames and short descriptions containing the text "disks". Note that this will not return anything for scripts or programs that do not have a manpage but every program supplied with the Ubuntu distro should have one...

man -k disks

OR...

apropos disks

For example...

 root@LX02:~  apropos disks
cryptdisks_start (8) - wrapper around cryptsetup which parses /etc/crypttab.
cryptdisks_stop (8)  - wrapper around cryptsetup which parses /etc/crypttab.
mtools (1)           - utilities to access DOS disks in Unix.
smartctl (8)         - Control and Monitor Utility for SMART Disks
udisks (1)           - udisks command line tool
udisks (7)           - Storage Management
udisks-daemon (8)    - udisks Daemon
3

The easiest way is to inspect the "program starter" using the menu editor:

  • right-click on the menu button in the taskbar;
  • select Edit Menu - this will open the menu editor.

Now, you can choose the category at the left and the application at the right (Entries). Just select the application with a single left click, open the context menu with a right-click and select Properties. A small window will appear, showing (among other information) the command line.

Those program starter files usually reside in /usr/share/applications, so another approach would be to check the *.desktop files in that directory. If you're not sure about the name of the *.desktop to look for, do a grep from inside the /usr/share/applications directory:

grep gThumb * | grep 'Name='

will give you something like

gthumb.desktop:Name=gThumb
gthumb.desktop:X-GNOME-FullName=gThumb Image Viewer
gthumb-import.desktop:Name=Import with gThumb
gthumb-import.desktop:X-GNOME-FullName=gThumb Photo Import Tool

Now, you can just use less gthumb.desktop to inspect the details of that program starter.

Another way would be to use the apropos command to search a certain keyword in the man pages.

1

for bin in $(for path in $(tr ':' '\n' <<<"$PATH"); do echo $path; done); do ls $bin; done |grep 'disk'

The above loop enumerates every file in each directory of your $PATH and shows any file matching the regex ('disk' in this case) passed to grep at the end of the pipeline.

If you have non-executable files in your $PATH this will also show those.

0

Maybe not what you want to hear, but zsh (zshell) does a great job in command completion. It is (backward) compatible to bash so you don't have to learn something completely new.
With oh-my-zsh there is a good starting point of settings, that can easily be tweaked to your liking.

If I type 'disk' in my terminal it automagically suggests the following list, which can be traversed with .
cfdisk fdisk lvmdiskscan mkdiskimage sgdisk udisks udisks-tcp-bridge umount.udisks2
cgdisk gdisk memdiskfind sfdisk testdisk udisksctl umount.udisks

As you might have noticed I don't run gnome, so therefore no gnome-disks, but it would have definitely also found that one if it was present.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .