2

I'm trying to extract a tarball using tar -xvf that's in the format (where * is any word character) *@*@*@*.tar.gz but I think tar is trying to find the file at a remote location. The error I get is for the command tar -xzvf tasf423@2012-02-22\@00:03:04\@ja41nf.tar.gz:

tar (child): Cannot connect to 2012-02-22@00: resolve failed

I tried using back slashes to escape it and even tried replacing the @ symbols with %40 but none of this seemed to work. Is there any way to extract a tarball using the tar command with an @ in its name?

Another example:

Maybe this example shows the problem a bit better:

# tar czvf 2022-02-10-00\:04.tar.gz 2022-02-10-00\:04
2022-02-10-00:04/
2022-02-10-00:04/dmesg.txt
tar (child): Cannot connect to 2022-02-10-00: resolve failed
2022-02-10-00:04/vmcore
tar: 2022-02-10-00:04.tar.gz: Wrote only 2048 of 10240 bytes
tar: Child returned status 128
tar: Error is not recoverable: exiting now

Note: The colon (:) does not have to be escaped; Bash's filename completion code did that. In UNIX : is not considered to be an "evil" character (as it is in Windows).

2
  • Did you try double quotes around the file name? tar -xvf "@*@.tar.gz"
    – Diego
    Feb 25, 2012 at 3:09
  • Yeah, still didn't work. I'm running the command with a perl script using a system command so I don't think that's the problem, but when I try quotes in command line it still fails. tar: Cannot connect to 2012-02-22@00: resolve failed
    – Redian
    Feb 25, 2012 at 3:12

1 Answer 1

10

The problem is the colons, not the at signs. Use --force-local.

2
  • I think that's it too. Linux is trying to connect to a remote server because of it. +1 Feb 25, 2012 at 3:22
  • Yup! That was it! I was thinking of the ssh user@host:path syntax and figured it saw the @ first. force-local worked though. Thank you!
    – Redian
    Feb 25, 2012 at 3:33

You must log in to answer this question.