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 会保存会话并后台运行
相关推荐
心心喵3 分钟前
[linux] nohup和pm2的区别 进程保活
linux·运维·服务器
NGINX开源社区1 小时前
F5 NGINX Ingress Controller 5.3.0 新增功能
运维
SelectDB2 小时前
Apache Doris 在 AgentLogsBench 中领先,支撑 Agent 可观测性生产负载
运维·数据库·agent
荣-3 小时前
从两天到十几分钟:一套 YT Crash 自动化分析工具完整工程复盘
大数据·运维·自动化
酷炫的水壶3 小时前
使用memc-nginx和srcache-nginx模块构建高效透明的缓存机制
运维·nginx·缓存
范什么特西5 小时前
网络代理问题
java·linux·服务器
姚不倒5 小时前
F5 SSL Profile 证书卸载深入篇
运维·网络协议·负载均衡·ssl·f5
utf8mb4安全女神5 小时前
【Redis数据库】哨兵集群/redis集群/安装配置/主从复制/数据持久化操作/数据结构/安全限制/PHP redis/
linux·服务器·数据结构·数据库·redis·缓存
智商偏低5 小时前
Windows Nginx 完整安装 + 启动教程
运维·nginx
Zk.Sun6 小时前
Linux设置触屏双击距离容差
linux·运维·数据库