This lesson covers commands for viewing and manipulating text output, and techniques for redirecting input, output, and errors between commands and files - essential skills for efficient Linux system administration.
Purpose: File perusal filter for viewing text one screen at a time
Usage: more [filename]
more [filename]
Navigation:
Enter: Move line-by-line
Spacebar: Move page-by-page
q: Quit
Limitation: Older command, cannot scroll backwards
Example: more /var/log/messages
more /var/log/messages
Purpose: Improved version of more with more features
more
Usage: less [filename]
less [filename]
Arrow keys: Up/down line-by-line
Page Up/Down: Move by pages
Enter/Spacebar: Forward movement
/pattern: Search forward
/pattern
n: Next search result
Shift+N: Previous search result
Key advantage: Can scroll backwards, better searching
Remember: "Less is more" (less provides MORE features than more!)
Example: less /var/log/messages
less /var/log/messages
Purpose: Display the first lines of a file
Default: Shows first 10 lines
Usage: head [filename]
head [filename]
Options:
-n [number]: Specify number of lines
-n [number]
Examples:
head /var/log/messages (shows first 10 lines)
head /var/log/messages
head -n 20 /var/log/messages (shows first 20 lines)
head -n 20 /var/log/messages
Purpose: Display the last lines of a file
Default: Shows last 10 lines
Usage: tail [filename]
tail [filename]
-f: Follow mode - continuously display new lines as they're added (perfect for log files!)
-f
tail /var/log/messages (shows last 10 lines)
tail /var/log/messages
tail -n 2 /var/log/messages (shows last 2 lines)
tail -n 2 /var/log/messages
tail -f /var/log/messages (follows log in real-time)
tail -f /var/log/messages
Exit follow mode: Ctrl+C
Use case: Monitoring live logs during troubleshooting
Purpose: Search for and print lines matching a pattern/string
Usage: grep [options] [pattern] [file]
grep [options] [pattern] [file]
Important Options:
-i: Case-insensitive search
-i
-R or -r: Recursive search through directories
-R
-r
grep "cloud_user" /var/log/messages (find exact string)
grep "cloud_user" /var/log/messages
grep -i "joe" names.txt (case-insensitive search for "joe", "JOE", "Joe", etc.)
grep -i "joe" names.txt
grep -R "cloud_user" /var/log/ (search all files in directory recursively)
grep -R "cloud_user" /var/log/
Key feature: Invaluable for finding configurations, troubleshooting, searching logs
Purpose: Sort lines of text files
Default: Ascending alphabetical/character order
Usage: sort [options] [file]
sort [options] [file]
-n: Sort numerically (not just by character)
-n
-r: Reverse order (descending)
-o [filename]: Output to file
-o [filename]
sort names.txt (alphabetical sort)
sort names.txt
sort -n numbers.txt (numerical sort: 14, 22, 100)
sort -n numbers.txt
sort -nr numbers.txt (reverse numerical: 9000, 100, 22, 14)
sort -nr numbers.txt
sort names.txt numbers.txt (sorts multiple files together)
sort names.txt numbers.txt
Note: Character sort vs numerical sort
Character: 100, 14, 22, 9000 (compares character by character)
Numerical: 14, 22, 100, 9000 (compares actual values)
Linux uses three standard streams for input/output:
0 = stdin (Standard Input)
Default: Keyboard input
What you type into commands
1 = stdout (Standard Output)
Default: Screen/terminal display
Normal command output
2 = stderr (Standard Error)
Error messages
Separate from stdout so you can handle errors differently
Redirection allows you to change where input comes from and where output goes (instead of keyboard/screen defaults).
Single > (Redirect and Overwrite)
>
Symbol: >
Purpose: Send stdout to a file (overwrites existing content)
Syntax: command > file
command > file
sort names.txt > sorted.txt (saves sorted output to file)
sort names.txt > sorted.txt
ls > filelist.txt (saves directory listing to file)
ls > filelist.txt
Warning: Overwrites file if it exists!
Double >> (Redirect and Append)
>>
Symbol: >>
Purpose: Send stdout to a file (appends to existing content)
Syntax: command >> file
command >> file
sort numbers.txt >> sorted.txt (adds to existing file)
sort numbers.txt >> sorted.txt
echo "new line" >> log.txt (appends text to file)
echo "new line" >> log.txt
Safe: Doesn't overwrite, adds to end of file
Single < (Input from File)
<
Symbol: <
Purpose: Feed file contents as input to command
Syntax: command < file
command < file
Example:
sort < numbers.txt (uses file as input)
sort < numbers.txt
sort < numbers.txt > sorted.txt (input from file, output to file)
sort < numbers.txt > sorted.txt
Double << (Here Document)
<<
Symbol: <<
Purpose: Feed multi-line input directly to command
Syntax: command << DELIMITER
command << DELIMITER
sort << EOF
50
22
3
17
40
EOF
Type input until you type the delimiter (EOF)
Delimiter can be any word (EOF is common)
Redirect stderr Only
Symbol: 2>
2>
Purpose: Redirect only error messages (not regular output)
Syntax: command 2> errorfile
command 2> errorfile
Sort numbers.txt 2> error.log (captures "command not found" error)
Sort numbers.txt 2> error.log
ls /baddir 2> errors.txt (captures "no such directory" error)
ls /baddir 2> errors.txt
Redirect stderr and Append
Symbol: 2>>
2>>
Purpose: Append error messages to file
Syntax: command 2>> errorfile
command 2>> errorfile
Method 1: 2>&1
2>&1
Symbol: 2>&1
Purpose: Makes stderr go to same place as stdout
Syntax: command > file 2>&1
command > file 2>&1
Explanation:
> file redirects stdout to file
> file
2>&1 makes stderr (2) go to same target as stdout (1)
Example: ls /home /root /baddir > merge.log 2>&1
ls /home /root /baddir > merge.log 2>&1
Method 2: &>
&>
Symbol: &>
Purpose: Redirect both stdout and stderr to file (shorthand)
Syntax: command &> file
command &> file
Example: ls /home /root /baddir &> merge.log
ls /home /root /baddir &> merge.log
Note: Simpler syntax, same result as method 1
|
Symbol: | (vertical bar)
Purpose: Send output of one command as input to another command
Syntax: command1 | command2
command1 | command2
Chaining: Can chain multiple commands: command1 | command2 | command3
command1 | command2 | command3
Simple pipe:
ps -ef | grep ssh
Lists all processes, then filters for only SSH-related ones
Multiple pipes:
ps -ef | grep ssh | wc -l
Lists processes → filters for SSH → counts the lines (9 results)
Common combinations:
cat file.txt | grep "pattern" (search in file)
cat file.txt | grep "pattern"
ls -l | less (view long directory listing with paging)
ls -l | less
history | grep "command" (search command history)
history | grep "command"
cat log.txt | grep ERROR | wc -l (count error lines)
cat log.txt | grep ERROR | wc -l
sort names.txt > sorted.txt # Sort and save (overwrite)
# Sort and save (overwrite)
sort numbers.txt >> sorted.txt # Sort and append
# Sort and append
sort < numbers.txt > sorted.txt # Input from file, output to file
# Input from file, output to file
Sort numbers.txt 2> error.log # Wrong command, error saved to log
Sort numbers.txt
2
> error.log
# Wrong command, error saved to log
ls /home /root /baddir > merge.log 2>&1 # Method 1
ls /home /root /baddir > merge.log
&1
# Method 1
ls /home /root /baddir &> merge.log # Method 2 (same result)
# Method 2 (same result)
ps -ef | grep ssh # Show only SSH processes
# Show only SSH processes
ps -ef | grep ssh | wc -l # Count SSH processes
# Count SSH processes
tail -f /var/log/messages # Monitor log in real-time # Press Ctrl+C to exit
# Monitor log in real-time
# Press Ctrl+C to exit
less > more: Less command has MORE features than more
head = top, tail = bottom of files
tail -f: Essential for monitoring live logs
grep -i: Case-insensitive search (very useful!)
grep -R: Recursive search through directories
sort -n: Numerical sort (not character sort)
stdin=0, stdout=1, stderr=2: File descriptors
> overwrites, >> appends
2> redirects errors, &> redirects everything
| pipes output to next command
Ctrl+C exits tail -f and other running commands
What is the difference between more and less commands?
less
more: Older, basic text viewer
Can only scroll forward (line-by-line or page-by-page)
Less features
Navigation: Enter (line), Spacebar (page), q (quit)
less: Modern, feature-rich text viewer
Can scroll backward AND forward
Arrow keys work
Better search functionality (/pattern, n for next, Shift+N for previous)
More versatile
Remember: "Less is more" - less provides MORE features!
What does head command do and what is its default behavior?
head
Purpose: Displays the first/beginning lines of a file
Syntax: head [filename]
head file.txt (first 10 lines)
head file.txt
head -n 20 file.txt (first 20 lines)
head -n 20 file.txt
head -n 5 /var/log/messages (first 5 lines of log)
head -n 5 /var/log/messages
What does tail command do and what is the -f option used for?
tail
Purpose: Displays the last/ending lines of a file
Key Options:
-f: Follow mode - continuously displays new lines as they're added to file
tail file.txt (last 10 lines)
tail file.txt
tail -n 2 file.txt (last 2 lines)
tail -n 2 file.txt
tail -f /var/log/messages (monitor log in real-time)
Use case: Perfect for troubleshooting live issues by watching logs Exit: Ctrl+C
What does the grep command do and what are its most important options?
grep
Syntax: grep [options] [pattern] [file]
-i: Case-insensitive search (joe = JOE = Joe)
grep "error" log.txt (find "error" in file)
grep "error" log.txt
grep -i "joe" names.txt (case-insensitive)
grep -R "config" /etc/ (search all files in /etc/)
grep -R "config" /etc/
Why invaluable: Finding configurations, troubleshooting, searching logs
What does sort command do and what are the key options?
sort
-n: Numerical sort (not character sort)
-o file: Output to file
-o file
sort names.txt (alphabetical A-Z)
sort -n numbers.txt (14, 22, 100 not 100, 14, 22)
sort -nr numbers.txt (reverse: 9000, 100, 22, 14)
Important: Without -n, "100" comes before "22" (character comparison)
What are the three standard file descriptors in Linux?
Default: Keyboard
Default: Screen/terminal
Error messages only
Why separate stderr?: So you can handle errors differently from normal output
What is the difference between > and >> in output redirection?
(Single angle bracket):
Overwrites file content
Creates new file or replaces existing content
Example: sort names.txt > sorted.txt
Warning: Destroys existing file content!
>> (Double angle bracket):
Appends to file content
Adds to end of existing file
Example: sort numbers.txt >> sorted.txt
Safe: Preserves existing content
Remember: Single > = overwrite, Double >> = append
How do you redirect standard input from a file?
Use < (left-pointing angle bracket)
Syntax: command < inputfile
command < inputfile
sort < numbers.txt (feed file as input to sort)
What it does: Makes the command read from file instead of keyboard
Can combine: Input redirection (<) + Output redirection (>) in same command
What does << (double left angle bracket) do?
Creates a "here document" - allows multi-line input directly in command
Syntax:
[input lines]
DELIMITER
How it works:
Type command with << EOF (or any word)
<< EOF
Enter multiple lines of input
Type delimiter word (EOF) to signal end
Command processes all input at once
Delimiter: Can be any word (EOF, END, STOP common)
How do you redirect only error messages (stderr) to a file?
Use 2> (file descriptor 2 with angle bracket)
Sort file.txt 2> error.log (wrong command, error captured)
Sort file.txt 2> error.log
ls /baddir 2> errors.txt (directory doesn't exist, error saved)
Why 2>?:
2 is the file descriptor for stderr
Regular > only redirects stdout (1)
Errors still appear on screen unless you use 2>
Append errors: command 2>> errorfile
How do you redirect both stdout and stderr to the same file?
Two methods:
Method 1: command > file 2>&1
2>&1 makes stderr go to same place as stdout
Example: ls /home /baddir > output.log 2>&1
ls /home /baddir > output.log 2>&1
Method 2: command &> file
Shorthand for redirecting both
Simpler syntax, same result
Example: ls /home /baddir &> output.log
ls /home /baddir &> output.log
Both methods: Capture normal output AND errors in one file
What does the pipe symbol | do and how is it used?
Purpose: Sends output of one command as input to another command
Can chain multiple: command1 | command2 | command3
ps -ef | grep ssh (list processes, filter for SSH)
ls -l | less (directory listing with paging)
cat file.txt | grep error (search for errors in file)
cat file.txt | grep error
history | grep sudo (find sudo commands in history)
history | grep sudo
Power: Combine simple commands for complex tasks without temporary files
What does ps -ef | grep ssh | wc -l do?
Counts the number of SSH-related processes
Breaking it down:
ps -ef: Lists all processes on system
ps -ef
| grep ssh: Filters output to show only lines containing "ssh"
| grep ssh
| wc -l: Counts the number of lines (where wc = word count, -l = lines)
| wc -l
wc
-l
Result: A single number showing how many SSH processes are running
Concept: Chaining pipes to progressively filter and process data
How do you monitor a log file in real-time as new entries are added?
Use tail -f command
tail -f
Syntax: tail -f /path/to/logfile
tail -f /path/to/logfile
Example: tail -f /var/log/messages
What happens:
Shows last 10 lines of file
Continues to display new lines as they're added
Updates in real-time
Perfect for monitoring active logs
Exit: Press Ctrl+C to stop following
Use case: Troubleshooting live issues, watching application logs, monitoring system events
How do you perform a case-insensitive search with grep?
Use the -i option
Syntax: grep -i "pattern" file
grep -i "pattern" file
Example: grep -i "joe" names.txt
What it does:
Finds "joe", "JOE", "Joe", "jOe", etc.
Ignores uppercase/lowercase differences
Without -i:
grep "joe" would ONLY find exact lowercase "joe"
grep "joe"
Would miss "JOE" or "Joe"
Very useful when: You're unsure of the exact case in configuration files or logs
How do you recursively search for a pattern in all files within a directory?
Use grep -R or grep -r
grep -R
grep -r
Syntax: grep -R "pattern" /directory/
grep -R "pattern" /directory/
Example: grep -R "cloud_user" /var/log/
Searches the specified directory
Searches all files in subdirectories
Searches files in sub-subdirectories, etc.
Shows filename and matching line
Use case:
Finding configuration settings when you don't know which file
Searching logs across multiple files
Finding text anywhere in a directory tree
Combine options: grep -Ri "pattern" /dir/ (recursive AND case-insensitive)
grep -Ri "pattern" /dir/
What's the difference between character sort and numerical sort?
Character Sort (default):
Compares character by character, left to right
Example result: 100, 14, 22, 9000
"1" comes before "2", so 100 comes before 14
Numerical Sort (with -n):
Compares actual numeric values
Example result: 14, 22, 100, 9000
Understands 14 < 22 < 100 < 9000
Commands:
sort numbers.txt (character: 100, 14, 22, 9000)
sort numbers.txt
sort -n numbers.txt (numerical: 14, 22, 100, 9000)
Remember: Always use -n when sorting numbers!
How do you sort in reverse/descending order?
Use the -r option
Syntax: sort -r file
sort -r file
sort -r names.txt (Z to A)
sort -r names.txt
sort -nr numbers.txt (largest to smallest)
sort -r file.txt > reversed.txt (save reversed sort)
sort -r file.txt > reversed.txt
Combining options:
-n: Numerical sort
-r: Reverse order
-nr: Numerical reverse (9000, 100, 22, 14)
-nr
Default: Ascending (A-Z, smallest to largest) With -r: Descending (Z-A, largest to smallest)
How do you search for lines in less and navigate through search results?
In less viewer:
Start search:
Type / followed by pattern
/
Example: /Network searches for "Network"
/Network
Navigate results:
n: Jump to next match (forward)
n
Shift+N: Jump to previous match (backward)
Shift+N
Example workflow:
/error # Search for "error"
/error
# Search for "error"
n # Next occurrence
# Next occurrence
Shift+N # Previous occurrence
# Previous occurrence
q # Quit less
q
# Quit less
Remember: Forward slash / to search, n for next, Shift+N for previous
What command would you use to view the first 5 lines and last 5 lines of a file?
First 5 lines: head -n 5 filename
head -n 5 filename
Last 5 lines: tail -n 5 filename
tail -n 5 filename
head -n 5 /var/log/messages # First 5 lines
# First 5 lines
tail -n 5 /var/log/messages # Last 5 lines
tail -n 5 /var/log/messages
# Last 5 lines
Can combine with pipe:
head -n 100 bigfile.txt | tail -n 5 # Lines 96-100
head -n 100 bigfile.txt | tail -n 5
# Lines 96-100
(First gets first 100, then tail gets last 5 of those)
Remember: -n specifies number of lines for both head and tail
How do you save sorted output to a file using redirection?
Use > for output redirection
Syntax: sort inputfile > outputfile
sort inputfile > outputfile
sort names.txt > sorted.txt (creates/overwrites sorted.txt)
sort -n numbers.txt > sorted_nums.txt (numerical sort to file)
sort -n numbers.txt > sorted_nums.txt
sort file1.txt file2.txt > combined_sorted.txt (sort multiple files)
sort file1.txt file2.txt > combined_sorted.txt
Alternative: sort -o outputfile inputfile
sort -o outputfile inputfile
-o option built into sort command
-o
Example: sort -o sorted.txt names.txt
sort -o sorted.txt names.txt
Both methods work, but > is more universal (works with any command)
What happens when you run a command with wrong syntax and how do you capture the error?
What happens: Error message goes to stderr (file descriptor 2)
Sort numbers.txt # Wrong: uppercase S
# Wrong: uppercase S
# Output: -bash: Sort: command not found
Capture error to file: Use 2>
Result:
No error appears on screen
Error message saved in error.log
Can review errors later: cat error.log
cat error.log
Why useful: Log errors for troubleshooting, keep screen clean, save error history
What's the difference between these commands: ls /baddir > log.txt vs ls /baddir &> log.txt?
ls /baddir > log.txt
ls /baddir &> log.txt
s /baddir > log.txt:
s /baddir > log.txt
Redirects ONLY stdout (normal output)
Errors still appear on screen
log.txt may be empty if command only produces errors
ls /baddir &> log.txt:
Redirects BOTH stdout AND stderr
Nothing appears on screen
log.txt contains both output and errors
Example results:
ls /home /baddir > log.txt # Error shows on screen
ls /home /baddir > log.txt
# Error shows on screen
ls /home /baddir &> log.txt # Error goes to file
ls /home /baddir &> log.txt
# Error goes to file
Remember: &> captures everything, > only captures normal output
How would you count the number of times "error" appears in a log file?
A: Method 1 (using pipe):
grep "error" /var/log/messages | wc -l
Method 2 (using grep's count option):
grep -c "error" /var/log/messages
Breaking down Method 1:
grep "error" /var/log/messages: Find all lines with "error"
grep "error" /var/log/messages
|: Pipe output to next command
wc -l: Count lines (where -l = line count)
wc -l
Case-insensitive count:
grep -i "error" logfile | wc -l # Counts ERROR, error, Error, etc.
grep -i "error" logfile | wc -l
# Counts ERROR, error, Error, etc.
What does sort < input.txt > output.txt do?
sort < input.txt > output.txt
Uses both input and output redirection in one command
< input.txt: Input redirection - feeds input.txt as input to sort
< input.txt
sort: Sorts the input
> output.txt: Output redirection - saves result to output.txt
> output.txt
Flow: input.txt → sort command → output.txt
Equivalent to:
sort input.txt > output.txt (simpler, more common)
sort input.txt > output.txt
cat input.txt | sort > output.txt (using pipe)
cat input.txt | sort > output.txt
Why show this?: Demonstrates you can use < and > together
How do you append the output of multiple commands to the same file?
Use >> (append redirection)
echo "First line" > output.txt # Create/overwrite
echo "First line" > output.txt
# Create/overwrite
echo "Second line" >> output.txt # Append
echo "Second line" >> output.txt
# Append
echo "Third line" >> output.txt # Append
echo "Third line" >> output.txt
Result in output.txt:
First line
Second line
Third line
With different commands:
ls -l > combined.txt # Directory listing (overwrite)
ls -l > combined.txt
# Directory listing (overwrite)
ps -ef >> combined.txt # Process list (append)
ps -ef >> combined.txt
# Process list (append)
date >> combined.txt # Current date (append)
date >> combined.txt
# Current date (append)
Key: First command uses >, subsequent commands use >>
What is the purpose of separating stdout and stderr, and how is it useful?
Why separate:
Different handling: Process normal output and errors differently
Error logging: Save errors separately for troubleshooting
Clean output: Send normal output to file, errors to screen
Automation: Scripts can detect errors vs success
Practical examples:
Separate files:
command > output.txt 2> errors.txt
command > output.txt
> errors.txt
Normal output → output.txt
Errors → errors.txt
Discard errors:
command 2> /dev/null
command
> /dev/null
Errors disappear (sent to "black hole")
View errors only:
command > /dev/null
Normal output discarded, errors on screen
What keyboard shortcut exits tail -f and other running commands?
Ctrl+C
Sends interrupt signal to running command
Stops command execution immediately
Returns you to command prompt
Common uses:
Exit tail -f /var/log/messages (following log)
Stop long-running command
Cancel command you started by mistake
Exit from unresponsive program
Other useful shortcuts:
Ctrl+D: End of input/logout
Ctrl+Z: Suspend process (background it)
Ctrl+L: Clear screen (same as clear)
clear
Remember: Ctrl+C = Cancel/interrupt
How would you find all files containing "password" in the /etc/ directory?
Use grep -R for recursive search
Command:
grep -R "password" /etc/
Searches /etc/ directory
Searches all subdirectories recursively
Finds all files containing "password"
Better versions:
grep -Ri "password" /etc/ # Case-insensitive
grep -Ri "password" /etc/
# Case-insensitive
grep -Rl "password" /etc/ # Show only filenames (-l)
grep -Rl "password" /etc/
# Show only filenames (-l)
sudo grep -R "password" /etc/ # May need sudo for permissions
sudo grep -R "password" /etc/
# May need sudo for permissions
Output format: filename:matching line text
filename:matching line text
What's the difference between cat file.txt | grep "error" and grep "error" file.txt?
cat file.txt | grep "error"
grep "error" file.txt
Result: Both produce the SAME output
Method 1: cat file.txt | grep "error"
cat reads file and outputs content
cat
Pipe sends output to grep
grep searches through piped input
Less efficient (two processes)
Method 2: grep "error" file.txt
grep directly reads and searches file
More efficient (one process)
Preferred method
When to use pipe:
When output comes from command (not file)
Example: ps -ef | grep ssh (ps output isn't a file)
Chaining multiple commands
Best practice: Use grep pattern file when possible
grep pattern file
How do you view a large directory listing with the ability to scroll through it?
Use pipe to less
Command: ls -l | less
ls -l: Long directory listing (lots of output)
ls -l
less: View with scrolling capability
Navigation in less:
Arrow keys: up/down
Space/Page Down: next page
Page Up: previous page
/pattern: search
q: quit
Other examples:
ps -ef | less # View processes
ps -ef | less
# View processes
history | less # View command history
history | less
# View command history
cat largefile.txt | less # Better: just use `less largefile.txt`
cat largefile.txt | less
# Better: just use `less largefile.txt`
What does /dev/null represent and how is it used in redirection?
/dev/null
What it is: The "black hole" of Linux - discards everything sent to it
Purpose: Throw away unwanted output
Discard normal output, keep errors:
Discard errors, keep normal output:
Discard everything:
command &> /dev/null # Or: command > /dev/null 2>&1
command &> /dev/null
# Or: command > /dev/null 2>&1
Why useful:
Suppress noisy output
Hide expected errors
Clean scripts (don't clutter screen)
Example: find / -name file.txt 2> /dev/null (hide permission denied errors)
find / -name file.txt 2> /dev/null
Create a command that shows the 10 most recent entries in a log file that contain the word "failed".
grep "failed" /var/log/messages | tail -n 10
grep "failed" /var/log/messages: Find all lines with "failed"
grep "failed" /var/log/messages
|: Pipe results to next command
tail -n 10: Show last 10 lines of the filtered results
tail -n 10
Alternative (case-insensitive):
grep -i "failed" /var/log/messages | tail -n 10
To save results:
grep "failed" /var/log/messages | tail -n 10 > recent_failures.txt
Concept: Chaining commands with pipes to progressively filter data
How do you sort a file numerically in reverse order and save it?
sort -nr numbers.txt > sorted_reverse.txt
sort: Sort command
numbers.txt: Input file
numbers.txt
>: Output redirection
sorted_reverse.txt: Output file
sorted_reverse.txt
Result: Numbers sorted from largest to smallest
Input: 14, 9000, 22, 100
Output: 9000, 100, 22, 14
Without -n: Would get character sort (9000, 22, 14, 100)
What command shows you the syntax/options for the grep command?
Use man pages or help
Methods:
man grep: Full manual page
man grep
Detailed documentation
All options explained
Examples
Press q to quit
grep --help: Quick help
grep --help
Brief option summary
Faster than man page
Good for quick reference
info grep: Info documentation
info grep
Alternative to man
Sometimes more detailed
For any command: man [command] or [command] --help
man [command]
[command] --help
man less # Learn about less
man less
# Learn about less
man sort # Learn about sort
man sort
# Learn about sort
grep --help # Quick grep options
# Quick grep options
Last changeda month ago