Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#119332 - 04/10/2002 01:15 unix command help
johnmcd3
enthusiast

Registered: 19/04/2001
Posts: 369
Loc: Seattle, WA (formerly Houston,...
wondering if there is a way to do the following:

I have a directory on a university machine with a specific quota (couple hundred megs). Of this, there is a directory i want to preserve the exact structure of that is the majority of that device. thing is i can't tar the beast because i don't have enough room for the tar on the device. i need the tar onto another computer which i can either ftp or ssh to (maybe some otherstuff i don't know).

seems like the're should be a way via some command line manipulation to send (pipe?) the tar directly to some program which forwards it to the remote computer or something. this is kinda for my own education because i see i can copy the things as they are and then tar later, but still... any ideas?

John
_________________________
1998 BMW ///M3 30 GB Mk2a, Tuner, and 10 GB backup

Top
#119333 - 04/10/2002 02:01 Re: unix command help [Re: johnmcd3]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5683
Loc: London, UK
If you've got ssh, you should have scp. You can use that.
_________________________
-- roger

Top
#119334 - 04/10/2002 03:32 Re: unix command help [Re: johnmcd3]
tms13
old hand

Registered: 30/07/2001
Posts: 1115
Loc: Lochcarron and Edinburgh
As Roger says, use scp.

It might still be useful to know how to tar into a pipe, though. To do that, specify "-" as the destination file, thus:

tar cf - my/directory/

and at the other end:

tar xf -

For example, the following is the equivalent of cp -rp dir1/* dir2:

tar -C dir1 cf - . | tar -C dir2 xf -
_________________________
Toby Speight
030103016 (80GB Mk2a, blue)
030102806 (0GB Mk2a, blue)

Top
#119335 - 04/10/2002 06:00 Re: unix command help [Re: tms13]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Some tar implementations only support the -C option on extract, so ``tar -C dir1 cf - .'' wouldn't work.
_________________________
Bitt Faulk

Top
#119336 - 04/10/2002 06:02 Re: unix command help [Re: johnmcd3]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
In general, I'd use:

cd /sourcedir
tar pcf - . | ssh remotehost '(cd /destdir; tar pxf -)'

But scp works as well.
_________________________
Bitt Faulk

Top
#119337 - 04/10/2002 18:12 Re: unix command help [Re: wfaulk]
TheAmigo
enthusiast

Registered: 14/09/2000
Posts: 363
That's how I'd do it too, or keep a compressed copy on the other server:
cd /sourcedir

tar pcf - . | ssh remotehost 'cd /home/dir; bzip2 -c9 - >archive.tbz'

_________________________
--The Amigo

Top
#119338 - 05/10/2002 01:41 Re: unix command help [Re: wfaulk]
johnmcd3
enthusiast

Registered: 19/04/2001
Posts: 369
Loc: Seattle, WA (formerly Houston,...
scp worked well, but this is very good to know. thanks.
_________________________
1998 BMW ///M3 30 GB Mk2a, Tuner, and 10 GB backup

Top
#119339 - 05/10/2002 05:22 Re: unix command help [Re: johnmcd3]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5683
Loc: London, UK
The other thing you can do, if you've got rsync and ssh is this:

rsync -e ssh -auv /source/dir/ user@other.host:/dest/dir/

Careful with those trailing slashes -- rsync uses them to decide whether you meant to copy the directory, or the contents of the directory.
_________________________
-- roger

Top