screen+tmux常用命令

tmux

tmux new -s cs                               创建会话
tmux a -t cs                                 进入会话
ctrl+b d                                     会话保存退出
tmux kill-session -t session_name            删除会话

# 安装tmux
yum install -y tmux.x86_64
echo "开始通过tmux启动"
# cd到工作目录
cd /home/exporter/exporter/
# 新建会话,并执行命令
tmux new-session -d -s exporter "./node_exporter --web.listen-address=:9101"
sleep 3
# 保留会话,保存退出
tmux detach -s exporter
tmux new-session -d -s order-video-inference-service1
tmux send-keys -t cs "conda activate pytorch" Enter
tmux send-keys -t cs "python3 detect.py" Enter
sleep 3
tmux capture-pane -t "order-video-inference-service1" -S - -E - > "/root/py/order-video-inference-service1.txt"

screen

screen -S cs          				创建会话
screen -r id          				进入会话
screen -ls            				查看会话id
screen -X -S id quit  				删除会话
screen -dmS session_name command    创建会话并执行命令
screen -dmS cs python3 1.py
screen -D -r <screen_id>            踢掉前用户,进入 <screen_id> 界面
一般是Dttached ,表示没有用户登录;
Attached代表有用户登录;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

weixin_51711897

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值