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 会保存会话并后台运行
相关推荐
qq_3344668644 分钟前
excel VBA应用
java·服务器·excel
春风霓裳1 小时前
ubuntu磁盘管理、磁盘扩容
linux·运维·ubuntu
广州服务器托管1 小时前
WIN11.26H1.27982.1中简优化版 45进程(2025.11.8)
运维·人工智能·计算机网络·云计算·可信计算技术
Kingsaj1 小时前
uni-app打包app -- 在用户首次启动 App 时,强制弹出一个“用户协议与隐私政策”的确认对话框。
服务器·ubuntu·uni-app
黑云压城After2 小时前
纯css实现加载动画
服务器·前端·css
拾心212 小时前
【云运维】LNMP 架构部署与应用
运维·架构
亮子AI2 小时前
【Nginx】怎样清除 Nginx 的缓存?
运维·nginx·缓存
海蓝可知天湛2 小时前
Ubuntu24.10禁用该源...+vmware无法复制黏贴“天坑闭环”——从 DNS 诡异解析到 Ubuntu EOL 引发的 apt 404排除折腾记
linux·服务器·安全·ubuntu·aigc·bug
vvw&2 小时前
如何在 Ubuntu 24.04 上安装和使用 AdGuard
linux·运维·服务器·ubuntu·adguard
weixin_453253653 小时前
python+playwright自动化如何解决文件上传问题
运维·自动化