Distro-provided mechanism to clean up old kernels

Kees Cook kees at ubuntu.com
Thu Feb 16 22:43:04 UTC 2012


On Thu, Feb 16, 2012 at 03:36:31PM -0600, Dustin Kirkland wrote:
> On Thu, Feb 16, 2012 at 3:08 PM, Craig White <craig.white at ttiltd.com> wrote:
> > this was interesting but I found that I had to NOT use 'head -n -2' but rather 'head -n 2'
> 
> You can do 'head -2' or 'head -n2', but not 'head -n -2'.  I assumed
> it was a typo ;-)

Hurm? -n -2 is perfectly valid. It shows "all but the N first lines":

       -n, --lines=[-]N
              print the first N lines instead of the first 10; with the
              leading `-',  print all but the last N lines of each file


$ seq 1 5 | xargs -n1 | head -2
1
2
$ seq 1 5 | xargs -n1 | head -n 2
1
2
$ seq 1 5 | xargs -n1 | head -n -2
1
2
3

-Kees

-- 
Kees Cook




More information about the ubuntu-server mailing list