Skip to content

Use SCP to copy files (Linux)


On Linux, Open Terminal:

  • You can use any terminal application on your Linux system.
    scp [options] source_file user@hostname:destination_path
    

For Example:

  • Copy a File from Local to Remote host:
scp /path/to/local/file.txt username@student.computing.dcu.ie:~/

Copy a File from Remote to Local:

scp username@remote_host:/path/to/remote/file.txt /path/to/local/directory

Copy an Entire Directory:

scp -r /path/to/local/directory username@remote_host:/path/to/remote/directory

Options:

  • -r: Recursively copy entire directories.
  • -P port: Specify the port number if it's not the default 22.
  • -i identity_file: Selects the file from which the identity (private key) for public key authentication is read.

Additional Notes:

Make sure your scp command is recognized by the command line by checking the environment variable or installing the necessary tools (OpenSSH or PuTTY).

General Notes: