Linux screen Command
The Linux screen command is used as a multi-window manager.
screen is a multi-window manager. A "window" here refers to a full-screen text-mode display. Usually, the screen program is only used when logging into a host via telnet or when using an old-fashioned terminal.
Syntax
screen [-AmRvx -ls -wipe][-d <作业名称>][-h <行数>][-r <作业名称>][-s ][-S <作业名称>]
Parameter Description:
- -A Adjust all windows to the size of the current terminal.
- -d
Detach the specified screen job. - -h
Specify the number of buffer lines for the window. - -m Force the creation of a new screen job even if one is currently running.
- -r
Resume a detached screen job. - -R First try to resume a detached job. If no detached job is found, create a new screen job.
- -s
Specify the shell to execute when creating a new window. - -S
Specify the name of the screen job. - -v Display version information.
- -x Resume a previously detached screen job.
- -ls or --list Display all current screen jobs.
- -wipe Check all current screen jobs and delete those that are no longer usable.
Example
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 left 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 //re-attach the screen terminal with screen_id 2276
Linux Command Reference