Linux Commands – apropos, which, file and type

apropos

There is a really usful tool in most Unix and Linux distributions called apropos.  If you would like to know what a commmand is and does, you can use apropos.

for example, if you want to see all of the disk related commands, run the following and apropos will search though the man and whatis databases:

apropos disk

You will get something like the following returned:

arm_sync_file_range (2) - sync a file segment with disk
cfdisk (8)           - display or manipulate disk partition table
df (1)               - report file system disk space usage
fdformat (8)         - low-level format a floppy disk
fdisk (8)            - manipulate disk partition table
hd (4)               - MFM/IDE hard disk devices
htcacheclean (8)     - Clean up the disk cache
initrd (4)           - boot loader initialized RAM disk
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
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

which
The which command will tell you exactly where a file is located in your search path:

 which mount
/bin/mount

 file
the file command will tell you what type of file it is:

file /bin/mount
/bin/mount: setuid ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xc6cd8a568dc3f6a548df16e49d0b11cb2f1fc628, stripped

type
The type command is similar to the which command, but it will show if the command you are running is a file or an alias.

type mount
mount is /bin/mount
type ll
ll is aliased to `ls -alF'