70.6k views
2 votes
How to overcome tar: Removing leading `/' from member names [duplicate]

User Ronnell
by
7.0k points

1 Answer

3 votes

Final answer:

To overcome the error message 'Removing leading /' from member names' when untarring a file, you can use the '--strip-components' option with the 'tar' command.

Step-by-step explanation:

When encountering the 'Removing leading /' from member names' error during file untarring, it signals that the tar archive's filenames begin with a '/' character. To resolve this, employ the '--strip-components' option alongside the 'tar' command, enabling the removal of leading directory components from the file names. A practical illustration involves a tar file named 'archive.tar' housing files with names such as '/directory/file.txt.' Execute the following command to untar without the leading '/directory' component:

tar -xf archive.tar --strip-components=1

This command effectively strips the initial directory component, preventing the error and correctly extracting the files. Understanding and using the '--strip-components' option ensures a seamless untarring process, eliminating the leading '/' issue and facilitating the extraction of files from the tar archive.

User Joseadrian
by
7.5k points