Linux virtual terminal command Screen usage

Source: Internet
Author: User
Document directory
  • 3. Switch between virtual terminals
  • 4. Close a virtual terminal
  • 3. Switch between virtual terminals
  • 4. Close a virtual terminal

Linux virtual terminal command Screen usage

From:

Bytes. For example, you need to execute a time-consuming command after remote logon, such as svn
Checkout. Now I'm about to get off work again. You have to shut down your computer and leave. What should I do? Screen can solve this problem well. Screen is also called a virtual terminal. It can achieve the effects of multiple virtual terminals on one physical terminal.
The general usage is as follows:
1. Create a screen

Directly screen or screen-s xxx (XXX is the name you specified for this screen)
2. Create a new virtual terminal in screen (now you have two virtual terminals in screen)

Ctrl + a + c (press ctrl + a first, and then press c. The following command is the same)
3. Switch between virtual terminals

Previous ctrl + a + p
Next ctrl + a + n
Select ctrl + a + shift +"
4. Close a virtual terminal

CTRL + A + K or exit
5. Suspend screen (after the screen is suspended, you return to the shell for screen creation)

CTRL + A + d
6. Reconnect to screen

Screen-ls: list the currently suspended screens
For example, there is a "8888.xxx (detached )"

You can use screen-r 8888 or screen-r XXX to reconnect.

The problem at the beginning of the article should be solved. After you connect to the remote host, do not rush to run your commands, but create a screen first, then, run your command in the screen virtual terminal. Before you disconnect the connection, pause the screen. The next time you connect, you only need to reconnect to your screen, you will find that your commands have been executed or are being executed, rather than being interrupted.

Generally, the above usage is sufficient. If you need more, directly use screen -- help. By the way, the general release version does not contain this software. You need to install it on your own. sudo is directly used under Ubuntu.
Apt-Get install screen.

After logging on to the remote host using ssh or telnet, execute some time-consuming commands. If ssh or telnet is interrupted at this time, the programs or commands being executed on the remote host will also be terminated. For example, you need to execute a time-consuming command after remote logon, such as svn
Checkout. Now I'm about to get off work again. You have to shut down your computer and leave. What should I do? Screen can solve this problem well. Screen is also called a virtual terminal. It can achieve the effects of multiple virtual terminals on one physical terminal.
The general usage is as follows:
1. Create a screen

Directly screen or screen-s XXX (XXX is the name you specified for this screen)
2. Create a new virtual terminal in screen (now you have two virtual terminals in screen)

CTRL + A + C (press Ctrl + a first, and then press C. The following command is the same)
3. Switch between virtual terminals

Previous Ctrl + A + P
Next Ctrl + A + n
Select Ctrl + A + Shift +"
4. Close a virtual terminal

CTRL + A + K or exit
5. Suspend screen (after the screen is suspended, you return to the shell for screen creation)

Ctrl + a + d
6. Reconnect to screen

Screen-ls: list the currently suspended screens
For example, there is a "8888.XXX (Detached )"

You can use screen-r 8888 or screen-r XXX to reconnect.

The problem at the beginning of the article should be solved. After you connect to the remote host, do not rush to run your commands, but create a screen first, then, run your command in the screen virtual terminal. Before you disconnect the connection, pause the screen. The next time you connect, you only need to reconnect to your screen, you will find that your commands have been executed or are being executed, rather than being interrupted.

Generally, the above usage is sufficient. If you need more, directly use screen -- help. By the way, the general release version does not contain this software. You need to install it on your own. sudo is directly used under ubuntu.
Apt-get install screen.

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.