Building Bash Muscle (5)

Let’s talk about scp this time. What is scp? It’s “secure copy (remote file copy program)” It lets you “copy files between hosts on a network.” I’m going to write an example to upload a file to a server.

$ scp file_to_upload user@remotehost:/path/on/remotedir/file_to_upload

You can upload multiple files like the following example.

$ scp file1 file2 user@remotehost:/path/on/remotedir

Alternatively, you could specify -r option to copy the entire directory recursively. Here is what the man page says. “Recursively copy entire directories. Note that scp follows symbolic links encountered in the tree traversal.”

scp works well when you are just dealing with Mac or Linux but you may find it not so easy from Windows. I personally used WinSCP to transfer files from Windows to Linux machines.

I just checked Git Bash on Windows and yes scp is available. Git Bash is actually giving us pretty good tools for Windows users. (I’m no longer full time Windows user anymore… as I use Linux Mint as my main desktop.)

That’s it for today. Happy scp’ing!

Leave a Reply

Your email address will not be published.