Section: Line Selection and Context

Show first 20 lines

bash
bash
head -n 20 server.log
Explanation

Useful for verifying file structure before applying heavier text processing.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Line Selection and Context
Show last 50 lines
Read the end of a file.
OpenIn sheetbashsame section
Follow a log in real time
Watch new lines as they are appended.
OpenIn sheetbashsame section
Print a specific line range
Extract lines 100 through 120.
OpenIn sheetbashsame section
Print line range with awk
Alternative line-range extraction using NR.
OpenIn sheetbashsame section
Pipe file content into grep
Basic pipeline for filtering text from a file.
Squeeze repeated spaces
Collapse multiple spaces into one.