March 15, 2014

12 scp command examples to transfer files on Linux

Secure copy
Scp (Secure Copy) is a command line tool to copy or transfer files across hosts. It uses the same kind of security mechanism like the ssh program. Infact it uses an ssh connection in the background to perform the file transfer. scp refers both to the "protocol" that defines how secure copy should work and the "program" (command) which is installed as a part of OpenSSH suite of tools.
In this quick tutorial we shall look at a few examples the scp command and how it can be used to transfer files securely.
Installing scp
Scp is generally installed by default on most linux distros as a part of openssh packages. On ubuntu/debian for example, the openssh-client package provides the scp program.
$ dpkg -L openssh-client | grep scp
/usr/bin/scp
/usr/share/man/man1/scp.1.gz
Its the OpenSSH package that provides the ssh, scp, sftp programs along with many other tools. So we do not have to do anything extra in here, except to use and learn the program.
Using scp
The basic syntax of scp is very simple to memorize. It looks like this
$ scp source_file_path destination_file_path
Depending on the host, the file path should include the full host address, port number, username and password along with the directory path.
So...

Read full post here
12 scp command examples to transfer files on Linux

Read more at Binary Tides