tar command to extract archive with colon in the name

7

I try tar -zxvf plugin\:xyz.tgz and received the error:

rsh: Could not resolve hostname plugin: Name or service not known
tar: plugin\:thold-latest.tgz: Cannot open: Input/output error
tar: Error is not recoverable: exiting now

Can someone help me?

Dzung

Posted 2011-05-23T02:15:10.950

Reputation: 81

Answers

0

You could do the following:

mv plugin\:xyz.tgz plugin-xyz.tgz
tar xvfp plugin-xyz.tgz

The name of the archive itself is not really that critical, and the files will extract to the same locations regardless of the archive name.

Xenoactive

Posted 2011-05-23T02:15:10.950

Reputation: 992

27

Try --force-local option:

tar -zxvf plugin:xyz.tgz --force-local

From info pages

If you need to use a file whose name includes a colon, then the remote tape drive behavior can be inhibited by using the `--force-local' option.

csg

Posted 2011-05-23T02:15:10.950

Reputation: 371

4

the answer by @csg is spot on.

Another alternative, however, is specifying a path to the archive instead of its filename. This can either be an absolute path, or more simply a path relative to the current directory:

tar -zxvf ./plugin:xyz.tgz

this will force tar to interpret the name as a local file.

Andreas Grapentin

Posted 2011-05-23T02:15:10.950

Reputation: 141

1

Use the absolute path of tar.

Like this:

/usr/bin/tar -xf plugin:thold-latest.tgz

The part before the ":" is interpreted as a host name, the part after would be a file. Tt tries to execute remsh. But with the absolute path of tar, it won't. Also, if you don't know where tar is on your system, run:

whereis tar

evan.bovie

Posted 2011-05-23T02:15:10.950

Reputation: 2 758

Hi emb1995, I've already tried your command. It was unsuccessful. Tar keep interpreting ":" as the remote hostname. I had to rename to file and extract it. – Dzung – 2011-05-23T03:06:27.937

@Dzung Try it without the slash after "plugin". Is the slash part of the actual file name? – evan.bovie – 2011-05-23T19:25:41.117

0

Try Bandit's suggestion of quotes around the filename tar zxvf "blah:23.tar.gz"

Last resort, rename the file at the command line or through an SFTP/SCP application like WinSCP or FileZilla.. You could do this on your local machine and re-upload the renamed file or just login with WinSCP/FileZilla and right-click the file on the remote side and select rename.

Brendan

Posted 2011-05-23T02:15:10.950

Reputation: 214