scp copies files between hosts on a network. It uses ssh for data transfer, and uses the same authentication and provides the same security as a login session. The scp protocol requires execution of the remote user's shell to perform glob pattern matching. scp will ask for passwords or passphrases if they are needed for authentication.

scp <options> source destination

# copy/upload a file from local file system to remote host
scp some_file user@host:/path/to/some_file                 

# download a file from remote host to localhost
scp user@host:/path/to/some_file /local/path/to_some_file  

# copy/upload entire directory from local to remote host
scp -r /path/to/dir user@host:/path/to/dir

# download entire directory from remote host to local host
scp -r user@host:/path/to/dir /path/to/dir

# upload multiple files to remote
scp some_file.jpg hello.txt user@host:/path/to/directory

Last Updated: April 24, 2022