How to use the screen in CentOS

Source: Internet
Author: User


System administrators often need to telnet to a Linux server and sometimes need to run a long time to complete tasks that must wait until the task is complete to disconnect, but there are times when unexpected disconnects occur. So when you run some big tasks, you need to use screen to prevent surprises.


GNU Screen is a free software developed by the GNU Program for command-line terminal switching. The software allows the user to connect multiple local or remote command lines simultaneously and freely switch between them. Screen can be viewed as a command-line interface version of the window manager. It provides a unified interface for managing multiple sessions and corresponding functions


As long as the screen itself is not terminated, tasks running inside it can be restored. This is particularly useful for users who log on remotely, even if the network connection is interrupted, and the user will not lose control of the command line session that has already been opened. Once you log on to the host again, execute SCREEN-R to resume the session's operation. Also at the time of the temporary departure, you can perform separate command detach, in order to ensure that the program inside the case of the normal operation of the screen hangs (switch to the background). Screen also allows one or more users to log in to a session multiple times from different terminals and share all the features of the session (such as seeing the exact same output for Remote Assistance, etc.). It also provides a mechanism for window access to password-protect windows.


GNU ' s screen official site: http://www.gnu.org/software/screen/



Screen installation steps:

Installing screen yum-y install screen with the Yum command

Use the RPM command to see if the local installation is successful RPM-QA | grep screen

[Email protected] ~]# Rpm-qa | grep screen

Screen-4.1.0-0.23.20120314git3c2946.el7_2.x86_64


Screen command:

screen [-amrvx-ls-wipe][-d < job name >][-h < number of rows >][-r < job name >][-s][-s < job name;]

Options:

-A adjusts all windows to the current size of the terminal.

-M forces a new screen job to be established even if the screen job is currently in operation.

-R first attempt to recover the offline job. If you cannot find an offline job, create a new screen job.

-V Displays version information.

-X the screen job is offline before recovery.

-ls or--list displays all of the current screen jobs.

-wipe checks all current screen jobs and removes screen jobs that are not already available.

-D < Job name > take the specified screen job offline.

-H < number of rows > specifies the number of buffer rows in the window.

-R < Job name > Restore offline screen jobs.

-s Specifies the shell to execute when a new window is created.

-S < job name > Specifies the name of the screen job.



Simple and practical Method:

Before using screen, you can use the Screen-ls command to find out if there is currently screens to prevent conflicts.

Use the Screen-s name to create a new window,

Use screen-x name to join an existing window.

Use screen-d name to exit screen

Use Screen-ls to view existing screen

Use screen-r name to restore name screen

How to use the screen in CentOS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.