SCP or Secure copy is a securely transferring computer files in the following ways
- from your local machine to a remote machine,
- from a remote machine to your local machine,
- between two remote machines.
It uses the same authentication and security as the Secure Shell (SSH) protocol from which it is based. SCP is loved for its simplicity, security and pre-installed availability.
If you want to view the filename
scp filename host:
If your username on the remote system is different from your username on the system you are currently using, the command.
scp filename username@host
Other than home directory, If you want to copy a file to a directory on the remote system, you need to add a path after the ‘:‘ colon that follows the hostname:
scp filename username@host:/path/to/other/destination/directory
The command to renaming a file on the server:
scp filename email@example.com.:filenewname
To copy files from one host to another, use the following syntax:
scp [[user@]host1:]file1 ... [[user@]host2:]file2