tar removing leading '/' from member names

Hebing picture Hebing · Sep 19, 2014 · Viewed 57.6k times · Source

I got an error when I append > /dev/null to tar command, anyone know what's going on in second example?

good:

 tar -cvf $kname /var/www

bad:

 tar -cvf $kname /var/www > /dev/null

 error:tar: Removing leading `/' from member names

Answer

Karoly Horvath picture Karoly Horvath · Sep 19, 2014

The "good" version is also displaying the same message you've just missed it.

If you don't like the behaviour, search for "leading", in manual. First hit:

-P, --absolute-names
       don't strip leading '/'s from file names