1. cat
(concatenate and display file contents)
- Used to view contents of a file or combine multiple files.
- Syntax:
cat filename
2. less
(view file one page at a time)
- Used for viewing large files page by page (scrollable).
- Syntax:
less filename
- Controls while inside:
Space
→ move down one pageb
→ move back one page/word
→ search for a wordq
→ quit
3. head
(show beginning of file)
- Shows the first 10 lines by default.
- Syntax:
head filename
4. tail
(show end of file)
- Shows the last 10 lines by default.
- Syntax:
tail filename
✅ Quick Comparison Table
Command | Purpose | Default Behavior |
---|---|---|
cat | Display entire file | Prints whole file content |
less | Scroll through file | Page-by-page viewing |
head | Show start of file | First 10 lines |
tail | Show end of file | Last 10 lines |
Categories: