Introduction to Linux screen commands

Source: Internet
Author: User

After using SSH or telnet to log on to the remote host, some time-consuming commands are executed, and if SSH or Telnet is interrupted at this time, the program or command being executed on the remote host will be forced to terminate. For example, you need to execute a remote login after a time-consuming instructions such as SVN checkout, then immediately after work, you have to shut down your computer to leave, how to do? Screen is a good solution to this problem. Screen, also known as virtual Terminal, can realize the effect of multiple virtual terminals on a physical terminal. Very practical.
Here's a general usage:

1. Create a new screen

Direct screen or screen-s xxx (XXX is the name you specified for this screen)

2. Create a new virtual terminal in screen (you will have two virtual terminals in screen now)

Ctrl+a+c (Press CTRL + A, then press C, and the following commands are the same)

3. Switch between virtual terminals

Previous Ctrl+a+p
After a ctrl+a+n
List select ctrl+a+shift+ "

4. Close a virtual terminal

Ctrl+a+k or exit

5. Hang screen (you're back to the shell that created screen after you've hung up)

Ctrl+a+d

6. Reconnect screen

SCREEN-LS lists the currently suspended screen
For example, there is a "8888.XXX (Detached)"

Then you can use screen-r 8888 or screen-r xxx to reconnect.

For the article at the beginning of the question, you should be able to solve, you connect to the remote host, do not rush to run your instructions, but first create a screen, and then run your instructions in the virtual terminal, screen, to disconnect before you hang up screen, The next time you're in, you just need to reconnect your screen, and you'll see that your instructions have been executed or are executing rather than being interrupted.

More than normal usage is sufficient, if needed more, please direct screen--help. By the way, the general distribution is not with this software, you need to install yourself, Ubuntu under the direct sudo apt-get install screen.

Introduction to Linux screen commands

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.