Linux screen Command
Complete Linux Command Reference
The Linux screen command is used for multi-window management programs.
screen is a multi-window management program. The "windows" referred to here are full-screen text-mode displays. In general, the screen program is only used when logging into a host via telnet or using an older-style terminal.
Syntax
screen [-AmRvx -ls -wipe][-d <作业名称>][-h <行数>][-r <作业名称>][-s <shell>][-S <作业名称>]
Parameter Description:
- -A Resize all windows to the current terminal size.
- -d<job name> Take the specified screen session offline.
- -h<lines> Specify the number of buffer lines for the window.
- -m Force the creation of a new screen session even if a screen session is already active.
- -r<job name> Resume an offline screen session.
- -R First attempt to resume an offline session. If no offline session is found, create a new screen session.
- -s<shell> Specify the shell to execute when creating a new window.
- -S<job name> Specify the name of the screen session.
- -v Display version information.
- -x Resume a previously offline screen session.
- -ls or --list Display all current screen sessions.
- -wipe Check all current screen sessions and delete any screen sessions that are no longer usable.
Examples
Create a screen terminal
# screen //创建 screen 终端
Create a screen terminal and execute a task
# screen vi ~/main.c //创建 screen 终端 ,并执行 vi命令
Leave the screen terminal
# screen vi ~/main.c //创建 screen 终端 ,并执行 vi命令
#include
main ()
{
}
"~/mail.c" 0,0-1
在 screen 终端 下 按下 Ctrl+a d键
Reconnect to a detached screen terminal
# screen -ls //显示已创建的screen终端 There are screens on: 2433.pts-3.linux (2013年10月20日 16时48分59秒) (Detached) 2428.pts-3.linux (2013年10月20日 16时48分05秒) (Detached) 2284.pts-3.linux (2013年10月20日 16时14分55秒) (Detached) 2276.pts-3.linux (2013年10月20日 16时13分18秒) (Detached) 4 Sockets in /var/run/screen/S-root. # screen -r 2276 //连接 screen_id 为 2276 的 screen终端Other Extensions