When you want to “cut”/remove the first line of a text content.
Create text with 5 lines:
$ echo -e "1\n2\n3\n4\n5" 1 2 3 4 5
+ character inverse the meaning of
-n. It’s meaning: start on this line. This starts from
the second line and prints the rest of the content.
echo -e "1\n2\n3\n4\n5" | tail -n +2 2 3 4 5
In contrast to the normal behavior of
-n 1 which would print only the last line. Using
this is not the most obvious behavior as the name
tail imply that you are working with the end of
the file and not the beginning like the “sibling” command:
Works like this:
echo -e "1\n2\n3\n4\n5" | head -n 1 1