How to tail all lines except first row

LinuxBash

Linux Problem Overview


For example, I have a file

1
2
3

then I want to output from 2nd row to tail

How can I do it in linux

Linux Solutions


Solution 1 - Linux

tail -n+2 my_file

will output all the lines in myfile starting with line 2. (-n2 would show you the last two lines.)

tail has lots more options. Type man tail for complete documentation.

Solution 2 - Linux

shorter with

$ sed 1d filename

or with awk

$ awk 'NR>1' filename

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSatoView Question on Stackoverflow
Solution 1 - LinuxriciView Answer on Stackoverflow
Solution 2 - LinuxkarakfaView Answer on Stackoverflow