Linux Tips-use screen to manage your remote sessions

Source: Internet
Author: User
Linux Tips-use screen to manage your remote sessions when we remotely log on to the linux server using ssh or telent and run some long-time tasks, you must wait until the task is completed before leaving the interface. You cannot close the window or disconnect the connection during this period. Otherwise, the process of this task will not kill... linux Tips-use screen to manage your remote sessions when we remotely log on to the linux server using ssh or telent and run some long-time tasks, you must wait until the task is completed before leaving the interface. You cannot close the window or disconnect the connection during this period. Otherwise, the process of this task will not be killed. if everything is abandoned halfway, you need to re-execute the task. How can this problem be solved? First, let's understand several concepts: Process Group: a collection of one or more processes. each process Group has a unique process Group ID, that is, the ID of the process Leader process. session period: A set of one or more process groups. there is a unique first process in a session. the ID of the first process in a session can have a separate control terminal, the first process connecting to the control terminal is the control process. The process currently interacting with the terminal is the foreground process. The default action of the stop signal is to terminate the program. when the terminal detects that the network connection is disconnected, the stop signal is sent to the control process, this signal is sent to the frontend process Group during the session period when a process exits, resulting in an orphan process group being generated. if any orphan process Group is in the stop state, send SIGHUP and SIGCONT signals to all processes in the process Group. Therefore, when the network is disconnected or the terminal window is closed, the control process receives the SIGHUP signal to exit, causing other processes to exit during the session period. Method 1: nohup # nohup command & Method 2: screen creen is a window manager that allows you to multiplexing a physical terminal among multiple processes. Usage: (1) [xuefeng @ ku6] # screen creates a full screen window for executing shell. you can execute any shell, just like in the ssh window. (2) [xuefeng @ ku6] # screen vi abc screen creates a separate window session for executing vi abc. exiting vi will exit this window (3 ), you can also create a new window in the existing screen session window, type C-a c in the current sceen window, that is, Ctrl + a, and then press the c key. Re-control the programs running in each window. For example, if you need to edit vi/tmp/abc in a screen window, you can type C-a d in the screen window, and the screen will prompt you to temporarily interrupt the session. Continue the previous session, # screen-ls to view the session number. Reconnect the screen-r number.
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.