In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how to look at the background tasks of the Linux operating system". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
As a multitasking environment, Linux allows users to perform multiple tasks at the same time, such as viewing system conditions, backing up data, editing files, printing files and so on.
Tasks that take a long time should not be performed in the foreground, but should be left to the background. In this way, the front desk task can continue to operate normally and other operations do not have to wait. Examples are as follows:
# find /-name testing &
# fg
If you want the tasks in the above example to be executed in the background, use "&". However, because it is executed in the background, the output of the program does not appear on the screen. When users put several tasks into the background to execute, how to manage these background tasks? How do I know the execution of background tasks? How to terminate or temporarily stop the execution of background tasks? Let's explain them one by one.
Control and management
Examples are as follows: # du-a / user > user.data &
[1] 237
# find /-name core-type f-ls > core.data &
[2] 238
As above, use the "&" command to put the three tasks in the background. Use the command "jobs-l" to display the execution of background tasks, as an example:
# jobs-l
[1] + 237 Running du-a / user > user.data
[2]-238 Running find /-name core-type f-ls > core.data
First of all, this paper introduces a unique term of task control: current task. The current task above is "du-a / user > user.data" because the background task number is "[1]". If the * * background task is successfully executed and the second background task is still being executed, the current task will automatically become the background task of the background task number "[2]". So it can be concluded that the current task will change. When the user enters commands such as "fg", "bg" and "stop", without any quotation marks, what is changed is the current task.
Terminate a background task
There are always times when orders go wrong. When this happens, the user can use Shell's built-in command "kill" to end the task. If you want to end the background task "du-a / user > user.data", you can use the following command: # kill 237
# kill 1
Where 237 is the PID number of * background tasks. If you want to terminate the second background task, you can do either of the following:
Point 1: # kill% 2
To take the second place: # kill%-
This is the end of the content of "what do you think of the background tasks of the Linux operating system"? thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
[oracle@tdsogg tmp] $crontab-lump 5 * sh / tmp/delete.sh*/5 * / tmp/delete.sh5 * sh /
© 2024 shulou.com SLNews company. All rights reserved.