↑ ↓ select, Enter open, Esc close

Print a specific range of lines from a file

Adjust the values, the command updates live
user@server
sed -n '100,120p;120q' /var/www/vhosts/example.com/httpdocs/wp-config.php

Prints only the lines within the given range, -n suppresses all others. The ;BISq suffix makes sed quit after the last requested line, so even huge log files are not read to the end. Useful when PHP reports an error with a line number.

Note: With line numbers for orientation: nl -ba datei | sed -n '100,120p'.

Also searched as

  • print lines 100 to 120 of a file
  • show specific lines of a file linux
  • sed print line range

Related one-liners

All in Text processing

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.