Comprehensive Reference Documentation (man)
The man command accesses the system's manual pages, offering deep technical details regarding commands, kernel interfaces, configuration formats, and system calls. It is the primary resource for authoritative information within a Linux environment.
Manual Sections Overview
Manual pages are organized into numbered categories:
- 1: User-level applications and utilities.
- 2: Kernel system calls accessible by programs.
- 3: C standard library functions and shared libraries.
- 4: Special files typically located in
/dev/. - 5: File formats and configuration syntax.
- 6: Games and amusement.
- 7: Miscellaneous sections includign protocols, macros, and conventions.
- 8: Administrative commnads available to root users.
Usage Example
$ man grep
GREP(1) User Commands GREP(1)
NAME
grep - print lines matching a pattern
SYNOPSIS
grep [-bcFGilnrvWXxz] [OPTIONS] PATTERN [FILE]...
DESCRIPTION
Searches input streams for lines containing a match to the provided PATTERN.
The search utilizes extended regular expressions unless otherwise specified.
OPTIoNS
-E, --extended-regexp interpret PATTERN as an extended regular expression
-o, --only-matching show only matching parts of a line
-v, --invert-match select non-matching lines
Quick Syntax Assistance (--help)
Most GNU and POSIX-compliant utilities include a built-in help option that displays a concise summary of usage syntax and key flags. This method is preferred for rapid lookups when full documentation is unnecessary.
Basic Implementation
$ grep --help
Usage: grep [OPTION]... PATTERN [FILE]...
--version output version information and exit
--help display this help and exit
Basic options:
-c, --count count matching lines
-i, --ignore-case ignore case distinctions
-E, --extended-regexp use ERE syntax
Executable and Resource Discovery
Beyond documentation, several tools assist in locating binaries, identifying installed packages, and verifying execution paths.
Binary Location Search (whereis)
The whereis utility finds the binary file, source code, and manual page associated with a specific command name. It is faster than searching the entire filesystem but relies on pre-defined databases.
$ whereis python
python: /usr/bin/python /usr/lib/python /usr/include/python
Function Summaries (whatis)
This tool retrieves a single-line description from the NAME section of the corresponding man page. It is ideal for quickly recalling a command's purpose without opening the full text.
$ whatis git
git (1) - fast version control system
$ whatis tar
tar (1) - manipulate archive files
Path Resolution (which)
To determine which executable will be invoked based on the $PATH variable, use which. This also helps identify if shell aliases are overriding standard system binaries.
$ which ssh
/usr/bin/ssh
# Check for active aliases
$ alias ll
alias ll='ls -la'
$ which pip
/pip3
Note: which only resolves executables found in directories listed in the PATH variable. If multiple versions exist, the first one encountered is selected.