Linux—Scp command details (file transfer)

Command format

[root @ localhost ~] # scp [parameters] [original path] [target path]

Command function

scp is the abbreviation of secure copy. scp is a secure remote file copy command based on ssh login under linux system. The Linux scp command can copy files and directories between Linux servers.

Command parameters

Examples of use

1. Copy from local server to remote server: 

(1) Copy the file:

[root@localhost ~]# scp local_file remote_username@remote_ip:remote_folder
[root@localhost ~]# scp local_file remote_username@remote_ip:remote_file

[root@localhost ~]# scp local_file remote_ip:remote_folder
[root@localhost ~]# scp local_file remote_ip:remote_file

The first one and two have been assigned a user name. After the command is executed, the user password needs to be entered. The first one only specifies the remote directory, the file name remains unchanged, and the second one specifies the file name.

The third and fourth ones do not specify a user name. After the command is executed, you need to enter the user name and user password. The third one only specifies the remote directory, the file name remains unchanged, and the fourth one specifies the file name.

Guess you like

Origin www.cnblogs.com/liuhaidon/p/12735967.html