Linux系统ssh和scp命令

原创
2022/05/16 16:41
阅读数 28
  • ssh命令

Linux使用ssh命令登陆Linux服务器:

ssh -l root -p 188 192.168.1.2

ssh -l 用户名 -p 端口号 主机名或IP

输入密码即可
  • scp命令

scp命令复制文件或目录命令:

  1. 复制文件:

(1)将本地文件拷贝到远程

scp -P 22 文件名 用户名@计算机IP或者计算机名称:远程路径

scp -P 22 test.txt root@192.168.1.163:/opt/

(2)从远程将文件拷回本地

scp -P 22 用户名@计算机IP或者计算机名称:文件名 本地路径

scp -P 22 root@192.168.1.163:/opt/test.txt /opt

  1. 复制目录:

(1)将本地目录拷贝到远程

scp -r -P 22 目录名 用户名@计算机IP或者计算机名称:远程路径

scp -r -P 22 /opt/test/ root@192.168.1.163:/opt/

(2)从远程将目录拷回本地

scp -r -P 22 用户名@计算机IP或者计算机名称:目录名 本地路径

scp -r -P 22 root@192.168.1.163:/opt/test/ /opt/

整理于:https://zhuanlan.zhihu.com/p/22641175

展开阅读全文
加载中

作者的其它热门文章

打赏
0
0 收藏
分享
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部