This is quite useful for viewing files without opening them.. Saves quite a lot of time in viewing the logs 🙂
Want to see the first 5 lines of the /etc/passwd file? Pretty easy, just use the \"head\" command:
head -5 /etc/passwd
Want to see the last 20 lines of the /etc/passwd file? Again, pretty easy, just use the \"tail\" command:
tail -20 /etc/passwd
But what if you only want to see lines 10-15 of a given file? Neither the \"head\" nor the \"tail\" commands alone will do. Instead, use the \"sed\" command to print the range of lines you want to see:
sed -n \'10,15p\' /etc/passwd
This command works great, even if you want to see a few lines somewhere in the middle of a 100,000 line file.