Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make commands run in the background and switch between foreground and background under CentOS

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to make commands run in the background and switch in the foreground and background under CentOS, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article.

Adding a "&" symbol to the end of the command allows the command to run in the background

At this point, you can see a command number and a command, followed by Running, indicating that it is running

Enter fg to call the background command back to the foreground.

But if there are multiple commands running in the background, you need the jobs command

The jobs command lists all commands running in the background and their running status

Then use the fg space followed by the command number to call the corresponding command back to the foreground.

If a command is already running at the front desk and you don't want to end it

Press Ctrl+Z to move the command to the background

But you can see that the status of the command is Stopped

You can use the bg space followed by the command number to place the command in the Runing state.

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

But if you log out or close the terminal, the command in the background will end.

If you don't want the command to end, you need nohup.

Add a nohop space to the command that you want to continue to run after exiting.

Thank you for reading this article carefully. I hope the article "how to make commands run in the background and switch in the foreground and background" shared by the editor is helpful to everyone. At the same time, I also hope that you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report