Avatar of Theodore Terry
Theodore Terry
 asked on

Copy file (cp) from one command line (BSD) to another.

logged in via ssh, need to copy a file from another machine back to my machine.
What is the command for the extraction of the file.
I know how to cp a file from directory to directory or mv, can't remember the command.
Unix.
Linux OS DevSSH / Telnet Software

Avatar of undefined
Last Comment
Theodore Terry

8/22/2022 - Mon
sagiamar

woolmilkporc

scp /source/file user@targethost:/target/directory/
or
scp user@sourcehost:/source/file /target/directory/
Theodore Terry

ASKER
woolmilkporc:

I'm in the machine via ssh I want to send file to another remote server.
A directory is what I want to cp over.

Since I'm inside the machine, shouldn't there be a -R included, I'm confused about the second line.
If I can rap my head around the path I can get it.  
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
anoym

To copy files and subdirectories I'm using:

# scp -r -p /source_directory/* username@ip_adresse:/target_directory

To copy a whole directory you can use:

# scp -r -p /source_directory username@ip_adresse:/target_directory

and pls check:

http://amath.colorado.edu/computing/software/man/scp.html

ASKER CERTIFIED SOLUTION
woolmilkporc

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Theodore Terry

ASKER
Thanks for the detail explanation.