You have a large log file and want to view only the last 20 lines. Which command is best?
Trap 1: view -n 20 logfile
view is a read-only mode for vi.
Trap 2: cat -n 20 logfile
cat does not support line-limiting arguments like this.
Trap 3: head -n 20 logfile
head shows the first 20 lines.
- A
tail -n 20 logfile
tail -n 20 shows the last 20 lines.
- B
view -n 20 logfile
Why wrong: view is a read-only mode for vi.
- C
cat -n 20 logfile
Why wrong: cat does not support line-limiting arguments like this.
- D
tail -20 logfile
The shorthand tail -20 is often supported, but -n is the standard way.
- E
head -n 20 logfile
Why wrong: head shows the first 20 lines.