June 28, 2007
How do I copy files from a linux server to my local machine w command line?
I have logged in using ssh and now want to copy several directories off the server to my local machine.
- I attempted with "cp <destination file> <local machine>:<source file>" am I on the right track?
- scp is one way, or (if you are root on the linux server) you can set up a samba server and share files like you would share them on Windows machines.
- Yes, you're on the right track. "scp" is a combination of "ssh" and "cp". On your local machine, you can say
scp <remote machine>:<source file> <destination file>
to grab the file from the Linux server (or any other machine with an ssh server running).
Oops - here is more info:
You said you want to copy several directories. To copy an entire directory with scp, you can use the "-r" flag like this:
scp -r <remote machine>:<source directory> <destination directory>
That will copy the directory and all files and subdirectories under it to your local system.
Tags: linux web hosting, linux tutorial























