English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux screen command

Linux Command大全

The Linux screen command is used for multi-window management.

screen is a multi-window management program. Here, the term 'window' refers to a full-screen text mode display. It is usually only used when logging into a host using telnet or using old-style terminals.

Syntax

screen [-AmRvx -ls -wipe][-d<task name>][-h<line number>][-r<task name>][-s<shell>][-S<task name>]

Parameter Description:

  • -A Adjust all windows to the size of the current terminal.

  • -d<task name> Take the specified screen task offline.

  • -h<line number> Specify the number of lines in the window buffer.

  • -m Force the creation of a new screen task even if a screen task is already running in the current job.

  • -r<task name> Restore the offline screen task.

  • -R Attempt to restore offline tasks. If offline tasks cannot be found, a new screen task will be created.

  • -s<shell> Specify the shell to be executed when creating a new window.

  • -S<job name> Specify the name of the screen job.

  • -v Display version information.

  • -x Restore the previously offline screen jobs.

  • -ls or--list Display all current screen jobs.

  • -wipe Check all current screen jobs and delete the screen jobs that are no longer usable.

Online Examples

Create a screen terminal

# screen //Create a screen terminal

Create a screen terminal and execute tasks

# screen vi ~/main.c //Create a screen terminal and execute the vi command

Leave the screen terminal

# screen vi ~/main.c //Create a screen terminal and execute the vi command
#include 
main()
{
}
"~/mail.c" 0,0-1    
Press Ctrl in the screen terminal+Press a d key

Reconnect to the left screen terminal

# screen -ls  //Display the created screen terminals 
There are screens on:
2433.pts-3.linux (2019years10months20 days 16hours48minutes59seconds) (Detached)
2428.pts-3.linux (2019years10months20 days 16hours48minutes 05seconds) (Detached)
2284.pts-3.linux (2019years10months20 days 16hours14minutes55seconds) (Detached)
2276.pts-3.linux (2019years10months20 days 16hours13minutes18seconds) (Detached)
4 Sockets in /var/run/screen/S-root.
# screen -r 2276 //Connected to screen_id 2276 of the screen terminal

Linux Command大全