![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tar utility (untar a .tar file) on VxWorks | uday_01 | UNIX for Advanced & Expert Users | 1 | 05-26-2008 06:13 AM |
| unable to UNTAR a file | NIMISH AGARWAL | UNIX and Linux Applications | 6 | 05-08-2008 08:35 PM |
| untar to a specified file | melanie_pfefer | UNIX for Dummies Questions & Answers | 3 | 11-27-2006 10:32 AM |
| Untar a TAR file at different location | malaymaru | UNIX for Dummies Questions & Answers | 5 | 09-18-2006 05:59 PM |
| unTar a specific file from remote | gelbvonn | Shell Programming and Scripting | 2 | 05-25-2006 12:59 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
How do I untar file through an ssh session?
Hi All,
How do I untar (tar xvf) a file through an ssh session? I have a tar file with "relative path names". I scp the file to a remote host:/tmp - no prob. But when I untar the file through ssh from a remote host it puts it in my "home directory" under the relative path - not in /tmp where I really want it to go. Here it is: $ set -o vi $ tar tvf test.tar drwxr-xr-x 992 205 0 May 23 15:14:44 2008 holdingArea/ drwxr-xr-x 992 205 0 May 23 15:14:42 2008 holdingArea/ccmig_1_00/ drwxrwxrwx 992 205 0 May 23 15:14:44 2008 holdingArea/stage/ drwxrwxrwx 992 205 0 May 23 15:14:54 2008 holdingArea/stage/ccmig_1_00/ drwxr-xr-x 992 205 0 May 23 15:14:53 2008 holdingArea/stage/ccmig_1_00/system/ -rwxrwxr-x 992 205 7 May 23 15:14:55 2008 holdingArea/stage/ccmig_1_00/system/system1.txt -rwxrwxr-x 992 205 7 May 23 15:14:55 2008 holdingArea/stage/ccmig_1_00/system/system2.txt -rwxrwxr-x 992 205 7 May 23 15:14:55 2008 holdingArea/stage/ccmig_1_00/system/system3.txt -rwxrwxr-x 992 205 7 May 23 15:14:55 2008 holdingArea/stage/ccmig_1_00/system/system4.txt drwxr-xr-x 992 205 0 May 23 15:14:53 2008 holdingArea/stage/ccmig_1_00/utils/ -rwxrwxr-x 992 205 7 May 23 15:14:55 2008 holdingArea/stage/ccmig_1_00/utils/utils1.txt -rwxrwxr-x 992 205 7 May 23 15:14:55 2008 holdingArea/stage/ccmig_1_00/utils/utils2.txt -rwxrwxr-x 992 205 7 May 23 15:14:55 2008 holdingArea/stage/ccmig_1_00/utils/utils3.txt -rwxrwxr-x 992 205 7 May 23 15:14:55 2008 holdingArea/stage/ccmig_1_00/utils/utils4.txt drwxr-xr-x 992 205 0 May 23 15:14:54 2008 holdingArea/stage/ccmig_1_00/config/ drwxr-xr-x 992 205 0 May 23 15:14:54 2008 holdingArea/stage/ccmig_1_00/config/config1/ -rwxrwxr-x 992 205 7 May 23 15:14:56 2008 holdingArea/stage/ccmig_1_00/config/config1/config11.txt -rwxrwxr-x 992 205 7 May 23 15:14:56 2008 holdingArea/stage/ccmig_1_00/config/config1/config12.txt -rwxrwxr-x 992 205 7 May 23 15:14:56 2008 holdingArea/stage/ccmig_1_00/config/config1/config13.txt -rwxrwxr-x 992 205 7 May 23 15:14:56 2008 holdingArea/stage/ccmig_1_00/config/config1/config14.txt drwxr-xr-x 992 205 0 May 23 15:14:54 2008 holdingArea/stage/ccmig_1_00/config/config1/config2/ -rwxrwxr-x 992 205 7 May 23 15:14:56 2008 holdingArea/stage/ccmig_1_00/config/config1/config2/config21.txt -rwxrwxr-x 992 205 7 May 23 15:14:57 2008 holdingArea/stage/ccmig_1_00/config/config1/config2/config31/config314.txt . . . . $ whoami framrodjones $ scp test.tar remotehost:/tmp test.tar 100% 40KB 40.0KB/s 00:00 $ $ ssh remotehost tar xvf /tmp/test.tar x holdingArea x holdingArea/ccmig_1_00 x holdingArea/stage x holdingArea/stage/ccmig_1_00 x holdingArea/stage/ccmig_1_00/system x holdingArea/stage/ccmig_1_00/system/system1.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/system/system2.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/system/system3.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/system/system4.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/utils x holdingArea/stage/ccmig_1_00/utils/utils1.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/utils/utils2.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/utils/utils3.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/utils/utils4.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/config x holdingArea/stage/ccmig_1_00/config/config1 x holdingArea/stage/ccmig_1_00/config/config1/config11.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/config/config1/config12.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/config/config1/config13.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/config/config1/config14.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/config/config1/config2 x holdingArea/stage/ccmig_1_00/config/config1/config2/config21.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/config/config1/config2/config22.txt, 7 bytes, 1 tape blocks x holdingArea/stage/ccmig_1_00/config/config1/config2/config23.txt, 7 bytes, 1 tape blocks . . . . $ OK - looks good. But when I login to remotehost and cd /tmp there is no holdingArea there. If I cd ~framrodjones - bingo - the holdingArea is there. But that's not where I want it. How to I untar the test.tar so that it installs in the directory where I scp'd it? Thanks, FramRodJones |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
Totally cool. I chose this: cat test.tar | ssh remotehost "cd tmp ; tar xvf -" Works great! Thank you! |
|
|||
|
hope you know when you ssh / telnet / rlogin as a specific user to a box, you are taken to that particular users home directory. In your case, you were taken to your home directory in the remore box and tar was extracting at the location you were at, while issuing the tar command
|
|||
| Google UNIX.COM |