Link to home
Start Free TrialLog in
Avatar of Umavmishra
Umavmishra

asked on

Please explain this scp command

Can anybody please decode this for me
scp -r -i /user/home/xceldt/.ssh/id_fdt-test kstsrv5:/user/home/data/arc*$archivedate*/*.tar.gz temp
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Hi,
-r tells scp to recursively copy entire directories.
-i tells scp which identity file (the file from which the identity (private key) for RSA authentication is read) to use.
kstsrv is the remote host
:  is the deimiter between hostname and the following -  
/user/home/data/arc*$archivedate*/*.tar.gz  ist the directory to copy from the remote host. There is a variable $archivedate contained in a directory name. This variable is set outside of scp, probably ba the script which contains the scp command.
temp is the local destination directory
wmp
 
... let's assume $archivedate contains "2009-05-05"
scp will copy from kstsrv all files which match "*.tar.gz" from the directory or directories  matching "/usr/home/data/arc*2009-05-05*/"
The asterisks surrounding $archivedate and the asterisks contained in the filename make scp copy e.g.
/usr/home/arcABC2009-05-05DEF/UVW.tar.gz   or
 /usr/home/arcGHI2009-05-05JKL/XYZ.tar.gz  
 Replace the bold strings above with any actually existing directory/file on that host.
Avatar of Umavmishra
Umavmishra

ASKER

Thanks woolmilkporc
can you please tell me how do i give the acess details in the identity file?
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks a lot!