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 [email protected]
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 [email protected]:/path/to/other/destination/directory
The command to renaming a file on the server:
scp filename [email protected]:filenewname
To copy files from one host to another, use the following syntax:
scp [[[email protected]]host1:]file1 ... [[[email protected]]host2:]file2