Run the command in the background in CentOS and switch between the front and back ends.

Source: Internet
Author: User

Run the command in the background in CentOS and switch between the front and back ends.

Add the "&" symbol at the end of the command to run the command in the background,

At this time, we can see a command number and command, followed by Running, indicating that it is Running,

Enter fg to bring the background command back to the foreground,

However, if multiple commands are run in the background, the jobs command is required,

The jobs command can list all commands and running statuses running in the background,

Then, you can use the fg space and the command number to call the corresponding command back to the front-end,

If a command is already running on the foreground and you do not want to end it,

Press Ctrl + Z to move the command to the background,

However, the status of the command is Stopped,

At this time, you can use the bg space and then run the command number to place the command in the Runing state.

Although the above method allows the command to run in the background,

However, if you log out of the terminal or close the terminal, the background commands will also end,

If you do not want to end the command, nohup is required,

Add a nohop space before the command to continue running after exiting.

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.