Suppose you have a file that needs to be removed from the server, or you want to put it on the server. It would be a bit redundant to set up some form of FTP client, or configure a share to handle this small task
Fortunately, this is where its scp comes in. SCP allows you to securely transfer files between devices via the command line. It is pre-installed on almost every Linux system
Usage
Remote to local
This will transfer file.md from host.com to /local/directory on your device. Before proceeding with username, you will be prompted to enter your password
scp username@host.com:/remote/file.md /local/directory/
Remote to remote
This will transfer file.md from host A to host B. You will be prompted to enter the passwords of the two hosts to run this command
scp username@hostA.com:/source/file.md username@hostB.com:/destination/file.md
Local to remote
scp /local/file.md username@host.com:/remote/
Limitations
Although scp is a very powerful command, it does have some limitations
- Not compatible with non-Linux machines: can only be used for scp to transfer files between devices running Linux distributions
Post comment 取消回复