Ubuntu server login and use

1. Log

Log remote server from a local

1.1 The default port

# format: ssh user_name@ip_address
cv@cv: ~$ ssh cv@192.168.1.1

1.2 Log on to the designated port

# format: ssh -p xx user_name@ip_address
cv@cv: ~$ ssh -p 100 cv@192.168.1.1
  • xx is the port number
  • user_name is the user name
  • ip_address is ip address to login

2. each file transfer

2.1 upload local files to the server specified port

# format: scp -P xx /path/to/local/file user_name@ip_address:/path/to/server/folder/
cv@cv: ~$ scp -P 100 ./myfile.txt cv@192.168.1.1:/home/cv/tmp/

2.2 The local folder uploaded to the server specified port

# format: scp -P xx -r /path/to/local/folder  user_name@ip_address:/path/to/server/destiny/
cv@cv: ~$ scp -P 100 -r ./myfiles cv@192.168.1.1:/home/cv/tmp/
  • xx is the port number
  • / Path / to / local / file is a local file path
  • / Path / to / server / folder / server save path
  • user_name user name for the server
  • ip_address is the server ip address
  • -r parameter represents the recursive folder transfer

Note: This added -P xx represents transmission to the designated port, if it is omitted, the default port 22 may be directly changed as parameters.

2.3 downloaded from the server specified files / folders

# transfer regular file
# format: scp -P xx user_name@ip_address:/path/to/server/file /path/to/local/folder/
cv@cv: ~$ scp -P 100 cv@192.168.1.1:/home/cv/tmp/temp.txt ./

# transfer folder
# format: scp -P xx -r user_name@ip_address:/path/to/server/srcfolder /path/to/local/folder/
cv@cv: ~$ scp -P 100 -r cv@192.168.1.1:/home/cv/tmp ./

The format which represents the meaning and the same, not repeat them.

Guess you like

Origin www.cnblogs.com/phillee/p/12029625.html