Configure ssh-config简化ssh , scp命令;Screen 后台运行命令

1. Configure .ssh/config简化ssh, scp命令

bash 复制代码
# Configure myServer
Host myServer
 HostName <ServerIP>
 User ubuntu
 IdentityFile /home/ubuntu/.ssh/<myServerKey>.pem

ssh 命令简化为. ssh myServer

bash 复制代码
ssh myServer

scp 命令简化为

bash 复制代码
scp -rp test.txt myServer:~/Downloads
  1. Linux 终端会话 screen 命令 让程序在后台运行

screen命令让ssh终端中命令在后台执行,即使当前ssh 会话断开,继续执行命令

bash 复制代码
1)查看当前screen列表 `screen -ls`

2)查看是否在screen中:`echo $STY` 查看当前是在 screen中还是终端里面 , 如果回显为空就在真·终端,否则会有 screen id 显示

3) 新建screen终端: 可以直接输入 screen; 推荐使用 `screen -R newName` 这样可以创建一个名为 newName 的screen终端, 并且 -R 会检查是否有同名的终端, 而 -S 则不会

4) 恢复detached screen: `screen -r [pid/name]`
    标准的用法: `screen -rd [pid/name]` , 这样先detach, 再attach,因为有时这个session是attached状态

5)当前终端界面下, `ctrl+a` 将进入等待命令的状态, 此时输入 d 会保存会话并后台运行
相关推荐
YuMiao3 小时前
gstatic连接问题导致Google Gemini / Studio页面乱码或图标缺失问题
服务器·网络协议
碳基沙盒1 天前
OpenClaw 多 Agent 配置实战指南
运维
Sinclair3 天前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
Rockbean4 天前
用40行代码搭建自己的无服务器OCR
服务器·python·deepseek
蝎子莱莱爱打怪4 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
茶杯梦轩4 天前
CompletableFuture 在 项目实战 中 创建异步任务 的核心优势及使用场景
服务器·后端·面试
海天鹰5 天前
【免费】PHP主机=域名+解析+主机
服务器
DianSan_ERP5 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
呉師傅5 天前
火狐浏览器报错配置文件缺失如何解决#操作技巧#
运维·网络·windows·电脑
不是二师兄的八戒5 天前
Linux服务器挂载OSS存储的完整实践指南
linux·运维·服务器