Where are all the terminal commands stored and how to view them? [duplicate]
You could try using the apropos
command to find a command knowing a basic idea of the command. For e.g, if you need to find a command for handling disk
functions try: apropos disk
. Advantage of using apropos
is that it gives a short description of the command.
e.g:
$ apropos disk
arm_sync_file_range (2) - sync a file segment with disk
baobab (1) - A graphical tool to analyze disk usage
cfdisk (8) - display or manipulate disk partition table
cgdisk (8) - Curses-based GUID partition table (GPT) manipulator
df (1) - report file system disk space usage
dvd+rw-booktype (1) - format DVD+-RW/-RAM disk with a logical format
dvd+rw-format (1) - format DVD+-RW/-RAM disk
dvd+rw-mediainfo (1) - display information about dvd drive and disk
fdformat (8) - low-level format a floppy disk
fdisk (8) - manipulate disk partition table
gdisk (8) - Interactive GUID partition table (GPT) manipulator
git-count-objects (1) - Count unpacked number of objects and their disk consumption
git-credential-store (1) - Helper to store credentials on disk
gnome-disk-image-mounter (1) - Attach and mount disk images
gnome-disks (1) - the GNOME Disks application
grub-mkstandalone (1) - make a memdisk-based GRUB image
grub-render-label (1) - generate a .disk_label for Apple Macs.
hd (4) - MFM/IDE hard disk devices
initrd (4) - boot loader initialized RAM disk
mbadblocks (1) - tests a floppy disk, and marks the bad blocks in the FAT
mcat (1) - dump raw disk image
mcheck (1) - verify all files on an MS-DOS formatted disk
memdiskfind (1) - utility to search for a MEMDISK instance
mformat (1) - add an MSDOS filesystem to a low-level formatted floppy disk
mkdiskimage (1) - Create a blank MS-DOS formatted hard disk image
mmount (1) - mount an MSDOS disk
mpartition (1) - partition an MSDOS hard disk
mtools (1) - utilities to access DOS disks in Unix.
mxtar (1) - Wrapper for using GNU tar directly from a floppy disk
mzip (1) - change protection mode and eject disk on Zip/Jaz drive
netscsid (1) - write data to optical disk media
partx (8) - tell the Linux kernel about the presence and numbering of on-disk partitions
quotactl (2) - manipulate disk quotas
ram (4) - ram disk device
sd (4) - driver for SCSI disk drives
sfdisk (8) - partition table manipulator for Linux
sgdisk (8) - Command-line GUID partition table (GPT) manipulator for Linux and Unix
sync (2) - commit buffer cache to disk
sync (8) - synchronize data on disk with memory
sync_file_range (2) - sync a file segment with disk
sync_file_range2 (2) - sync a file segment with disk
syncfs (2) - commit buffer cache to disk
udisks (8) - Disk Manager
udisksctl (1) - The udisks command line tool
udisksd (8) - The udisks system daemon
usb-creator-gtk (8) - Ubuntu startup disk creation tool for Gtk+
wodim (1) - write data to optical disk media
As for the location of the system commands, most command are stored in the following directories:
/bin/
/usr/bin
/usr/sbin
/sbin
You can use the ls
command to list the specific commands stored in each of these directories.
For further information:
-
Manpage for
apropos
Update:
You can use echo $PATH
, to find all the paths presently specified for executable:
e.g:
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Then you can use ls
on each of the individual folders(each folder is separated by a :
) to find the executable commands present in that path.
PATH is an environment variable on Unix-like operating systems, DOS, OS/2, and Microsoft Windows, specifying a set of directories where executable programs are located. In general, each executing process or user session has its own PATH setting.
Courtesy: http://en.wikipedia.org/wiki/PATH_%28variable%29
The number in the brackets of the apropos
output refers to the man
section number. The man
pages have been categorized into various sections, namely:
-
Commands (Programs)
Those commands that can be executed by the user from within a shell.
-
System calls
Those functions which must be performed by the kernel.
-
Library calls
Most of the libc functions.
-
Special files (devices)
Files found in /dev.
-
File formats and conventions
The format for /etc/passwd and other human-readable files.
Games
-
Overview, conventions, and miscellaneous
Overviews of various topics, conventions and protocols, character set standards, and miscellaneous other things.
-
System management commands
Commands like mount(8), many of which only root can execute. System administration commands (usually only for root)
Kernel routines [Non standard]
Courtesy: http://manpages.ubuntu.com/manpages/trusty/man7/man-pages.7.html
You can also use man -k <keyword>
to search for any command based on the particular keyword. apropos
mentioned in other answer actually uses the database generated by mandb
. So, both of the following will produce same output:
man -k disk
apropos disk
Both of the above provides regular expressions based pattern search by default.
See the manpages of man
and apropos
for details.