This post is a part of series of Ubuntu Command Line Tricks posts in which I try to share really useful CLI commands — as it comes from terms “terminal command”, “console command”, they are to be executed in Terminal: Ubuntu Main Menu –> Accessories –> Terminal.
Need to print part of text file, e.g. the lines starting from 20th to 30th? It’s no need to use bash scripts or other things like python for that anymore! Here you go:
sed -n '20,30p' /etc/passwd
This command just outputs the line range from 20 to 30. Damn it, I was using the long bash equivalent for the same task for years