Linux命令(59)之screen

简介: Linux命令(59)之screen

linux命令之screen

1.screen介绍
linux命令screen是用来进行多窗口管理。

默认screen命令没有安装,安装命令(基于yum源):yum install -y screen

2.screen用法
screen [参数]

screen参数
参数 说明
-r 恢复离线的screen作业
-ls 显示所有的screen作业
3.实例
3.1.创建一个新的screen窗口作业
-->执行命令screen,然后回车

命令:

screen

-->输入vi ztj.txt

命令:

vi ztj.txt

-->输入ctrl+a+d退出,就会有一个在后台实时执行的命令

-->查看

[root@cent79-2 S-root]# pwd
/var/run/screen/S-root
[root@cent79-2 S-root]# ls
1790.pts-1.cent79-2
[root@cent79-2 S-root]# ll
total 0
srw------- 1 root root 0 Jul 14 09:38 1790.pts-1.cent79-2
[root@cent79-2 S-root]#
其中1790为后台命令PID

[root@cent79-2 S-root]# ps -ef|grep 1790
root 1790 1 0 09:36 ? 00:00:00 SCREEN
root 1791 1790 0 09:36 pts/2 00:00:00 /bin/bash
root 1809 1721 0 09:41 pts/1 00:00:00 grep --color=auto 1790
[root@cent79-2 S-root]#
3.2.重新找回screen作业
-->查找作业PID

命令:

screen -ls

[root@cent79-2 S-root]# screen -ls
There are screens on:
1812.pts-1.cent79-2 (Detached)
1790.pts-1.cent79-2 (Detached)
2 Sockets in /var/run/screen/S-root.

[root@cent79-2 S-root]#
-->进入screen作业

命令:

screen -r PID

[root@cent79-2 ~]# screen -r 1790

-->输入Esc-->Ctrl+c-->:--->wq!退出命令

另外:创建的screen作业,当退出xshell再次进入,screen后台执行的命令,仍旧在运行,不会随着xshell的退出而终止。
————————————————
版权声明:本文为CSDN博主「小黑要上天」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/z19861216/article/details/131716412

目录
相关文章
|
8月前
|
Linux
Linux命令(33)之bg
Linux命令(33)之bg
150 44
|
3月前
|
Linux
Linux命令(59)之screen
Linux命令(59)之screen
59 0
|
9月前
|
Linux
linux 后台运行命令 screen
linux 后台运行命令 screen
65 0
Linux screen 常用命令(超好用)
Linux screen 常用命令(超好用)
|
缓存 Linux Shell
Linux Command screen 后台运行
Linux Command screen 后台运行
|
缓存 Linux
Linux命令行终端切换工具-Screen
打开远程终端,因网络中断,而失去对已打开命令行会话的控制;你还在为此而烦恼吗?今天将介绍一款实用的工具。
163 0
Linux命令行终端切换工具-Screen
screen 配置与使用笔记
screen 多人使用的时候经常遇到 屏幕大小不一致导致无法正常显示,只需要 ctrl+a shift+; fill 即可解决. 可以通过下面#把ctrl +a 替换成ctrl+z(ctrl+a 经常会用此组合键实现光标移动) The resultsing command give you a s.
622 0