Don't want "tar: Removing leading `/' from " message

From Andreida
Revision as of 16:34, 10 June 2023 by Andreas (talk | contribs)
  1. This is neither an error nor a warning, this is an information.
  2. You do not want to change the behavior, because this is good, you do not want absolute paths in your archive.

What you normally want it to just not see this information - after you understood it - because it can, no it WILL hinder the reading of log files or trigger the sending of mails.

What you do is pretty simple. Imagine you have the following command:

tar zchf /var/db-dump/your-name-1-images.tgz /var/www/wiki.your-wiki-1/images/

This will give you the information

tar: Removing leading `/' from member names
tar: Removing leading `/' from hard link targets

or something like that. It is good to know that this is happening but you now really don't want to see these lines. You just use the "-C <directory> option to first switch directories and then use tar with a relative path:

 tar zchf /var/db-dump/your-name-1-images.tgz -C / var/www/wiki.your-wiki-1/images/

And nope, I am not fucking with you. Two characters and a space and you are good to go. :-)