The MAC itself provides the SSH function, which is very helpful for programming with the VIM editor.
Connect to a remote host using ssh
ssh [email protected]
其中,username是登录用户名,@后接ip地址,点击确定之后输入密码即连接到远程主机。要查看当前有多少个处于登录状态的用户,可以使用who命令查看。
- 1
- 2
- 3
- 4
Upload and download using scp command
1. Download the file scp username@servername:/path/filename /Users/mac/Desktop (local directory) from the server
For example: scp [email protected]:/root/test.txt /Users/mac/Desktop
download /root/test.txt on the server to the local /Users/mac/Desktop directory. Note the space between the two addresses!
2. Upload local files to the server scp /path/filename username@servername:/path ;
E.gscp /Users/mac/Desktop/test.txt [email protected]:/root/
3. Download the entire directory from the server scp -r username@servername:/root/ (remote directory) /Users/mac/Desktop (local directory)
E.g:scp -r [email protected]:/root/ /Users/mac/Desktop/
4. Upload the directory to the server scp -r local_dir username@servername:remote_dir
For example: scp -r test [email protected]:/root/
upload the test directory in the current directory to the /root/ directory of the server
Note: The target server needs to enable write permission.