[ale] scp, rcp, tar questions
Joseph A Knapka
jknapka at earthlink.net
Thu Feb 14 11:05:50 EST 2002
Charles Marcus wrote:
>
> OK,
>
> I've gotta copy some stuff (home directory for one of our users) from a
> remote server down in Fla to my local server here in Atl.
>
> I have never used the tar beyond untarring tarballs when installing
> software, and never used the rcp command. I am having trouble figuring out
> the syntax, and the man pages aren't much help. I'd spend the time trying
> to figure it out myself, but this guys will be here in the morning, and I
> was just told about it, so hope someone can hold my hand...
>
> So, what would the syntax be for tar/gzipping up a directory? I *think it
> would be:
>
> tar -z /home/username/* tarfile.name
tar czvf tar-file-name.tgz /dir/to/tar
Explanation:
czvf == "c"reate the tarfile, compress using g"z"ip, be
"v"erbose (list all files added to the archive on stdout),
and I will explicitly provide the "f"ilename of the
tarfile as the /next/ argument. (The order of the
czvf flags is immaterial, could be "zvcf" or whatever.)
tar-file-name.tgz must be the next argument after the "f"
flag is seen.
/dir/to/tar and all its contents (recursively) will be
tarred (and compressed on the fly). Absolute pathnames
will be converted to releative, that is, the leading
"/" will be discarded from the names in the archive. So
you must untar from root if that's where you want
things to land.
Untar that file using
tar xzvf tar-file-name.tgz
dir/to/tar and its contents will appear in the current
directory.
> One problem is, I'm on a private IP, NAT'd through to the internet, logging
> into another computer with a private IP using NAT.
>
> So, when doing the remote copy (rcp), how do I specify the host names? Just
> use the IPs of the routers doing the port-forwarding?
Yes. If you can log in to the box using rsh or ssh,
then rcp/scp should work as well.
>
> Would it be:
>
> rcp -pr user at xxx.xxx.xxx.xxx:/home/tarfile.name user at xxx.xxx.xxx.xxx:/home
rcp user at xxx.xxx.xxx.xxx:/path/to/tarfile .
should work. You don't really need -r (since you're copying
a single file), nor -p (since the tarfile will contain
the file characteristics of the files in it). You only
need the second user+hostname if you're copying to another
remote machine.
> Should I use scp?
Yes. The scp command would be the same. Well, except
s/rcp/scp/, natch.
Cheers,
-- Joe
"I should like to close this book by sticking out any part of my neck
which is not yet exposed, and making a few predictions about how the
problem of quantum gravity will in the end be solved."
--- Physicist Lee Smolin, "Three Roads to Quantum Gravity"
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list