Install screen in CentOS

Source: Internet
Author: User

Install screen in CentOS

When you use SSH to log on to VPS to download large files, such as 10 Gb files, you cannot sit on your computer or start the system to download them. When you compile the source file, the network is suddenly disconnected, which is a bad thing, because it may fail when you re-compile, so you only have to choose to reinstall the system. However, the Linux screen command can avoid these disasters. The following uses Centos 6.5 64-bit system as an example.

Man screen: How does Linux screen work?

Screen is a multi-window hypervisor. The so-called window refers to a full-screen text screen. The screen program is usually used only when you use telnet to log on to the host or when you use an older terminal. Screen can execute multiple tasks in a terminal program, and execute tasks offline.

Install screen command

Some systems may already have screen installed. But we are not sure whether to install it or not. Execute the following command to confirm.

Which screen

If you have not installed screen, you can search for the RPM package suitable for your system on the following websites.
Http://www.rpmfind.net/linux/rpm2html/search.php? Query = screen
For example, for centos 64-bit, you can run the following command to install it.

Online Installation

Directly type the command: yum install screen

Offline installation (download the RPM installation package corresponding to the system through the URL above)

Step 1 Delete the original built-in screen (unavailable)

[Plain] view plaincopyprint?
  1. <Spanstyle = "font-size: 14px;"> [root @ datacenter6 ~] # Rpm-qa | grep-iscreen
  2. Gnome-screensaver-2.28.3-28.el6.x86_64
  3. [Root @ datacenter6 ~] # Rpm-egnome-screensaver-2.28.3-28.el6.x86_64 -- nodeps </span>

Step 2 start Installation

[Plain] view plaincopyprint?
  1. <Spanstyle = "font-size: 14px;"> [root @ datacenter6src] # rpm-ivhscreen-4.0.3-16.el6.x86_64.rpm </span>

Use screen

Run the following command to Start screen. A session window is generated.

  1. Screen

Now that you are in the new session window, you can execute any command.
The syntax for session management is: ctrl-a. For example, ctrl-a c Indicates creating a new session window. For more commands, enter ctrl-? View ,.

Multi-Window multi-task function

Open a new window and execute "ctrl-a" and "c" to create a new one. Then, you can execute any command, such as "top", to monitor cpu and memory usage.
To switch to the next window, you can use "Ctrl-A" n ". to switch to the previous window, you can use" Ctrl-A "p ".

Exit screen

To terminate A session, run the "Ctrl-A" K "or" exit "command.
You can use the "Ctrl-A" and "d" command to keep the session but close the window so that you can connect to the session next time.

Connect to screen

Run the following command to view the session List.

  1. Screen-ls

There are screens on:
31619. ttyp2.gigan (Detached)
4731. ttyp2.gigan (Detached)
2 Sockets in/tmp/screens/S-root.
Here we can see two different sessions. To reconnect the session, run the following command.

  1. Screen-r 31619. ttyp2.gigan
Screen Parameters

-A adjusted all windows to the current terminal size.
-D <job Name>: offline the specified screen job.
-H <number of rows> specifies the number of buffer rows in the window.
-M creates a new screen job even if the screen job is already in the job.
-R <job Name> restores an offline screen job.
-R first tries to restore the offline job. If an offline job cannot be found, a new screen job is created.
-S specifies the shell to be executed when a new window is created.
-S <job Name> specifies the name of the screen job.
-V displays the version information.
-X restores the offline screen job.
-Ls or -- list displays all current screen jobs.
-Wipe checks all current screen jobs and deletes unusable screen jobs.

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.