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 view background tasks in linux system

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

How to view background tasks in linux system? for this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

Linux View background tasks and close

1. &

Add it to the end of a command and put the command in the background to execute

2. Ctrl + z

Put a command being executed in the foreground in the background and put it in a paused state

3. Jobs

See how many commands are currently running in the background

The jobs-l option shows that the PID,jobs status of all tasks can be running, stopped, Terminated. But if the task is terminated (kill), shell removes the process identity of the task from the list known to the current shell environment

4. Fg

Transfer the commands in the background to the foreground to continue to run. If you have more than one command in the background, you can use fg% jobnumber (command number, not process number) to call up the selected command

5. Bg

Change a command that is paused in the background to continue execution in the background. If you have more than one command in the background, you can use bg% jobnumber to call up the selected command

6. Kill

Method 1: check the job number (assuming num) through the jobs command, and then execute kill% num

Method 2: check the process number of job (PID, assuming pid) through the ps command, and then execute kill pid

Termination of the foreground process: Ctrl+c

7. Nohup

If the program is always executed in the background, even if the current terminal is closed (the previous & cannot be done), nohup is required. This command can continue to run the corresponding process after you exit your account / close the terminal. After turning off the interrupt, jobs can no longer see the running program in the background on another terminal, so use ps (process View Command)

Ps-aux | grep "test.sh" # a: display all programs u: display all programs in a user-based format x: display all programs, not by terminal

This is the answer to the question about how to view the background tasks in the linux system. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

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

Internet Technology

Wechat

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

12
Report