Perhaps you only need to upload or download a file from a host, and want the added security features of SSH. We can do so with the
To upload a file, type the command, followed by the file to transfer, then the location.
$ scp sample.txt email@example.com:
Remember to tack on the colon at the end - otherwise you'll find that you simply made a copy of sample.txt in your current directory called firstname.lastname@example.org!
To copy it back to your current directory, simply swap the targets around.
$ scp email@example.com:sample.txt sample.txt
You'll notice that the path following the colon is relative to the home directory (since that's where you are logged in when you
ssh into a host).
$ scp sample.txt firstname.lastname@example.org:Documents/sample.txt
If you want to copy somewhere other than within your home directory, pass an absolute path after the colon.
$ scp init.d email@example.com:/etc/init.d
To copy entire directories, pass the
-r option. Additionally, you can pass in the
-p option to preserve the timestamps and permission settings.
$ scp -rp mail firstname.lastname@example.org
The Linux Command Line takes you from your very first terminal keystrokes to writing full programs in Bash, the most popular Linux shell. Along the way you'll learn the timeless skills handed down by generations of gray-bearded, mouse-shunning gurus: file navigation, environment configuration, command chaining, pattern matching with regular expressions, and more.$ Check price
Relieve your stress, back, neck and sciatic pain through 1,782 acupuncture points for immediate neck pain relief. Made for lower, upper and mid chronic back pain treatment, and improves circulation, sleep, digestion and quality of life.$$ Check price