Home Operation and Maintenance Linux Operation and Maintenance What commands are used to view and schedule processes?

What commands are used to view and schedule processes?

Aug 13, 2020 am 11:04 AM
process

The commands to view the process are ps and top, and the commands for process scheduling are at, crontab, batch and kill; a process is an address space in which one or more threads are running and the system required by these threads. Resources, generally speaking, Linux systems share program code and system function libraries between processes.

What commands are used to view and schedule processes?

Recommended: "linux tutorial"

Viewing and scheduling of processes The commands used respectively:

The commands to view the process are ps and top.

The commands for process scheduling include at, crontab, batch, and kill.

Related introduction:

The commands to view the process are ps and top.

ps command is used to view the currently running processes.

The commands for process scheduling include at, crontab, batch, and kill.

kill command

When you need to interrupt a foreground process, you usually use the < Ctrl c > key combination; but for a background process, it may not be solved by a key combination. , then you must resort to the kill command. This command can terminate background processes. There are many reasons for terminating a background process. Perhaps the process takes up too much CPU time; perhaps the process has died. Anyway, this happens often.

The kill command ends the process by sending a specified signal to the process. If no signal is specified, the default value is the TERM signal. The TERM signal will terminate any process that cannot catch the signal. As for those processes that can capture the signal, they may need to use the kill(9) signal, which cannot be captured.

The syntax format of the kill command is very simple. There are roughly two methods:

kill [-s signal | -p ] [ -a ] process number...

kill -l [Signal]

 -s specifies the signal to be sent. It can be either a signal name or a corresponding number.

-p specifies that the kill command only displays the pid of the process and does not actually send an end signal.

-l displays a list of signal names, which can also be found in the /usr/include/linux/signal.h file.

Use of kill command

Sometimes you may encounter a situation where a process has died or is idle, but cannot be killed by using the kill command. At this time, signal 9 must be sent to forcefully close the process. Of course, this "barbaric" method is likely to cause errors in opened files or data loss. Therefore, do not use forced termination unless absolutely necessary. If it doesn't even respond to signal 9, then I'm afraid the only option is to restart the computer.

nohup command

Theoretically, when we exit the Linux system, we will usually end all programs, including those background programs. But sometimes, for example, you are editing a long program, but you need to exit the system first when you get off work or have something to do. At this time, you do not want the system to end the program you have been editing for so long. You hope that the program can still be used when you exit the system. Continue execution. At this time, we can use the nohup command to make the process continue to execute after the user exits.

Generally, we let these processes execute in the background, and the results will be written to the nohup.out file in the user's own directory (you can also use output redirection to let it output to a specific document).

 [Example 26] $ nohup sort sales.dat &

This command tells the sort command to ignore that the user has exited the system, and it should run until the process is completed. Using this method, you can start a process that runs for days or even weeks, and the user does not need to log in while it is running.

The nohup command sends all output and error information of a command to the nohup.out file. If the output is redirected, only the error information is placed in the nohup.out file.

The above is the detailed content of What commands are used to view and schedule processes?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain what the explorer.exe process is Explain what the explorer.exe process is Feb 18, 2024 pm 12:11 PM

What process is explorer.exe? When we use the Windows operating system, we often hear the term "explorer.exe". So, are you curious about what this process is? In this article, we will explain in detail what process explorer.exe is and its functions and effects. First of all, explorer.exe is a key process of the Windows operating system. It is responsible for managing and controlling Windows Explorer (Window

What is the process of com surrogate? What is the process of com surrogate? Sep 14, 2022 pm 02:56 PM

"com surrogate" is the process of "C:\Windows\System32\dllhost.exe"; when this process occurs, it usually means that the "COM+" component stops working. This process takes up a lot of space and even does not respond directly. This is because the computer is loading the file icon. Sometimes a problem occurs, causing the computer to become stuck. You can solve the stuck problem in the computer properties settings.

What kind of process is ccsvchst.exe? What kind of process is ccsvchst.exe? Feb 19, 2024 pm 11:33 PM

ccsvchst.exe is a common process file that is part of the Symantec Endpoint Protection (SEP) software, and SEP is an endpoint protection solution developed by the well-known network security company Symantec. As part of the software, ccsvchst.exe is responsible for managing and monitoring SEP-related processes. First, let’s take a look at SymantecEndpointProtection(

How to properly kill zombie processes in Linux How to properly kill zombie processes in Linux Feb 19, 2024 am 10:40 AM

In Linux systems, zombie processes are special processes that have been terminated but still remain in the system. Although zombie processes do not consume many resources, if there are too many, they may cause system resource exhaustion. This article will introduce how to correctly remove zombie processes to ensure the normal operation of the system. 1Linux zombie process After the child process completes its task, if the parent process does not check the status in time, the child process will become a zombie process. The child process is waiting for confirmation from the parent process, and the system will not recycle it until it is completed. Otherwise, the zombie process will continue to hang in the system. To check whether there are zombie processes in the system, you can run the command top to view all running processes and possible zombie processes. The result of the ‘top’ command can be seen from the figure above in Linux.

Detailed explanation of Linux process priority adjustment method Detailed explanation of Linux process priority adjustment method Mar 15, 2024 am 08:39 AM

Detailed explanation of the Linux process priority adjustment method. In the Linux system, the priority of a process determines its execution order and resource allocation in the system. Reasonably adjusting the priority of the process can improve the performance and efficiency of the system. This article will introduce in detail how to adjust the priority of the process in Linux and provide specific code examples. 1. Overview of process priority In the Linux system, each process has a priority associated with it. The priority range is generally -20 to 19, where -20 represents the highest priority and 19 represents

How to stop Task Manager process updates and kill tasks more easily in Windows 11 How to stop Task Manager process updates and kill tasks more easily in Windows 11 Aug 20, 2023 am 11:05 AM

How to Pause Task Manager Process Updates in Windows 11 and Windows 10 Press CTRL+Window Key+Delete to open Task Manager. By default, Task Manager will open the Processes window. As you can see here, all the apps are endlessly moving around and it can be hard to point them down when you want to select them. So, press CTRL and hold it, this will pause the task manager. You can still select apps and even scroll down, but you must hold down the CTRL button at all times.

Why do processes in Linux sleep? Why do processes in Linux sleep? Mar 20, 2024 pm 02:09 PM

Why do processes in Linux sleep? In the Linux operating system, a process can become dormant due to a number of different reasons and conditions. When a process is in a dormant state, it means that the process is temporarily suspended and cannot continue execution until certain conditions are met before it can be awakened to continue execution. Next, we will introduce in detail several common situations when a process enters hibernation in Linux, and illustrate them with specific code examples. Waiting for I/O to complete: When a process initiates an I/O operation (such as reading

How to detect if there is no PHP process in Linux system How to detect if there is no PHP process in Linux system Mar 16, 2024 am 11:42 AM

&quot;Detection method of no PHP process in Linux system, specific code examples are required&quot; When using Linux system for web development, we often rely on PHP process to handle dynamic pages and logic, and sometimes we may need to monitor whether there is a PHP process on the server. This article will introduce a method to detect whether there is a PHP process in a Linux system and give specific code examples. Why is it necessary to detect the PHP process? In web development, the PHP process plays a vital role. It is responsible for parsing and executing PHP processes.

See all articles