Linux system commands in the screen command detailed _linux

Source: Internet
Author: User

Objective

For execution of long time commands, such as large file transports, to keep it from terminating, a remote login session window will be opened to run such commands alone. During this time, you cannot close the Telnet session window or disconnect, or you will be undone. Now the screen command comes in handy.

Screen is a free software developed by the GNU Program for command-line terminal switching. This software allows users to simultaneously connect multiple local or remote command sessions and switch between them freely. GNU 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 functionality.

Here's my most popular screen command (for me only):

Start by creating a new screen session window where you can execute any command, as you would under a Telnet session window.

[Root@wing ~]# Screen

Next I want to log in to my MySQL for human-computer interaction, of course, in the Screen session window.

[Root@wing ~]# mysql-uroot-p--socket=/data/mysqldata3306/sock/mysql.sock

Then in my MySQL to execute the following command, the Customer table has 1.5 million data, it takes a little time to execute (for my bad virtual machine), so I do not want to clone a remote login session window (too lazy), So I'm going to throw the current screen session in the background and run it.

ROOT@LOCALHOST:TCPH 12:37:39> SELECT * from customer;

The following command is to put the screen session behind the scenes, of course, MySQL inside the task is still running.

CTRL + A D (press CTRL + A, loosen and press D)

But now I want to go and see if my statement runs out (I'm a troublesome person), execute the following command:

Screen-ls

At this point you can see the task just dropped to the background, see the following figure:

Since found the task, also saw the task in screen inside the Code (red box in front of the number), then run it quickly.

[Root@wing ~]# screen-r 6158

At this point we can see the previous interaction in MySQL, when I found the task ran out. If I still press CTRL + A, it will still exist in the SCREEN-LS task list, as obsessive-compulsive disorder, how can I endure =_=, then how to do?

CTRL + A K

This will kill the task, and it will not exist in the SCREEN-LS task list.

Summarize

OK, the above is the entire content of this article, want to know more in-depth orders please continue to pay attention to the cloud habitat community, the small series will be updated more detailed on the Linux command 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.