1834862 Members
2079 Online
110070 Solutions
New Discussion

Re: Tar Command Error

 
SOLVED
Go to solution
Joven Bulawit
Occasional Contributor

Tar Command Error

Dear Everyone,

Can somebody help me with my problem. I trying to extract a tar file with ":" in its file name but Im getting this error:

tar -tvf 050627-21:46_before.tar
rcmd: 050627-21: Unknown host
tar: 050627-21\:46_before.tar: Cannot open: /O error
tar: Error is not recoverable: exiting now

But when I used root a root account Im not geeting those error:

tar -tvf 050627-21:46_before.tar
rw-rw-rw- 1101/1101 0 Jun 27 21:46 2005 empty.file
rw-rw-r-- 1101/1101 76885 Jun 27 21:46 2005 ./sapdpch.551.20050627213426.gz

Is there something wrong with my profile? I have no problem using the same command in our other server...

Please help. Thanks!
6 REPLIES 6
Ermin Borovac
Honored Contributor

Re: Tar Command Error

My guess would be that as normal user you are executing GNU tar and as root HP-UX tar.

GNU tar's -f option can take an argument in the following format

-f [:]

Since your tar file name contains colon (:) it considers part of the file name before colon as and it tries to execute remsh.

This can be prevented using --force-local option

--force-local
archive file is local even if has a colon
Joven Bulawit
Occasional Contributor

Re: Tar Command Error

Hi Ermin! Thanks for your reply. Is there a way that only the HP-UX tar will be executed whatever profile I use?
Sudeesh
Respected Contributor
Solution

Re: Tar Command Error


Give absolute path to the executable you want to run.

/usr/bin/tar -tvf 050627-21:46_before.tar

or

/sbin/tar -tvf 050627-21:46_before.tar


Sudeesh
The most predictable thing in life is its unpredictability
V. Nyga
Honored Contributor

Re: Tar Command Error

Hi,

with 'which tar' you can see the path of the tar command. Then you should check /etc/PATH. I think the path of the hp-ux tar should come before the other tar path.

HTH
Volkmar
*** Say 'Thanks' with Kudos ***
Vibhor Kumar Agarwal
Esteemed Contributor

Re: Tar Command Error

You can use 2 more options:

type tar : same as which
whereis tar : locations where tar command is located.
Vibhor Kumar Agarwal
Joven Bulawit
Occasional Contributor

Re: Tar Command Error

Thank you all very much! I just check the PATH and included the directory containing the HP-UX Tar.