What I want to do

I just want to extract a backup version of a file for analysis, /etc/net.cfg, which is in a tar.

What happens when I try

It fails, like so...

# tar -tf mytar.tar | grep net.cfg
# tar -xf mytar.tar /etc/net.cfg
tar: Removing leading `/' from absolute path names in the archive
# tar -xf mytar.tar etc/net.cfg
tar: etc/net.cfg: Not found in archive
tar: Error exit delayed from previous errors

Troubleshooting I've tried

I made a separate test.tar which contains only a "test1.txt" and "test2.txt", and if I do tar xf test.tar test1.txt it correctly extracts just the 1 file I want. So extracting the single file is working in this other case.


Am I doing something wrong? How do I extract from an absolute path like /etc/net.cfg out of the given tar file into the working directory?


Operating system: QNX

Shell: /bin/ksh

  • It looks like tar -xf mytar.tar /etc/net.cfg already extracted the file to etc/net.cfg. Can you verify this?
    – Freddy
    Sep 5, 2019 at 18:23
  • @Freddy DOH! I read that as if it were telling me that I need to remove the leading '/', not that it was doing so itself. So I thought it was an error. Because of that, I didn't even bother to look! Yes, it is there!
    – Aaron
    Sep 5, 2019 at 18:36
  • Nice! Yes, absolute pathnames can be a bit confusing with tar. You may write your own answer :)
    – Freddy
    Sep 5, 2019 at 18:37
  • I was just about to hit submit on a meta question asking whether this Q&A is just a waste of space that should be deleted, then I realized that would just be compounding the problem. >.< I'll just leave it for now.
    – Aaron
    Sep 5, 2019 at 18:50

1 Answer 1


DOH! This is embarrassing. I read tar: Removing leading '/' from absolute path names in the archive thinking it was an error telling me that I need to remove the leading '/', which is why I then did it as just etc/net.cfg.

Apparently it was not an error. It was merely informational, telling me that it was taking that action itself, and it was proceeding appropriately. And the file is there.

I did not bother to check for the file because I was under the incorrect impression it was an error and that it wasn't even worth it to type ls to check.

So there's not really a problem after all! I am not sure if I should delete this Q&A or if someone else could make the same silly mistake and benefit from this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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