Archive for the ‘SCP – Linux command’ Category

scp – Linux command line tool to copy files over ssh

December 24, 2009 Leave a comment

scp stands for secure cp (copy), which means that you can copy files across an ssh connection that will be encrypted, and therefore secured.

You can this way copy files from or to a remote server, you can even copy files from one remote server to another remote server, without passing through your PC.

scp [[user@]from-host:]source-file [[user@]to-host:][destination-file]

Description of options

from-host: Is the name or IP of the host where the source file is, this can be omitted if the from-host is the host where you are actually issuing the command

user: Is the user which have the right to access the file and directory that is supposed to be copied in the cas of the from-host and the user who has the rights to write in the to-host

source-file:Is the file or files that are going to be copied to the destination host, it can be a directory but in that case you need to specify the -r option to copy the contents of the directory

destination-file:Is the name that the copied file is going to take in the to-host, if none is given all copied files are going to maintain its names


-p  Preserves the modification and access times,
    as well as the permissions of the source-file in the destination-file
-q  Do not display the progress bar
-r  Recursive, so it copies the contents of the
    source-file (directory in this case) recursively
-v  Displays debugging messages


[oracle@testdb]$ scp java.tar.gz tamim@
The authenticity of host ' (' can't be established.
RSA key fingerprint is 23:b9:a4:b9:93:99:28:1f:4c:08:fa:8a:5f:d7:10:d0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
tamim@'s password:
java.tar.gz                                   100%   35MB  11.7MB/s   00:03

File is successfully transfer to the host in home/tamim directory

To copy a directory user scp –r


To use this command you need to have open-ssh installed in the hosts.

Categories: SCP - Linux command Tags: