Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I run some bash command it returns 2 .. n lines of text (n is different each time, may contain blank lines).

How to filter the output to display the result skipping lines 1 and 2?


$ my_command


$ my_command | some_filter

share|improve this question
up vote 8 down vote accepted
$ my_command | tail -n +3

In this case, the +3 means "start output at the third line of the file".

share|improve this answer
my_command | tail -n +3 – Iain Sep 28 '10 at 21:08
@Iain, The -n without a number following it doesn't do anything. The -n flag only matters when you want the last X lines of a file. – EEAA Sep 28 '10 at 21:14
@ErikA: seems to matter on the centos and ubuntu systems I have to hand. ls | tail +3 tail: cannot open +3 for reading: No such file or directory – Iain Sep 28 '10 at 21:20
Huh, interesting. It works fine on a RHEL4 server without the -n, but not RHEL5 or Debian. Must have been a fluke in an old version of tail. I've edited my answer accordingly, thanks!. – EEAA Sep 28 '10 at 21:22
If your particular 'tail' command isn't playing ball, use: awk 'NR>2 {print}' – MikeyB Sep 28 '10 at 22:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.