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

What are the process commands in the Linux system?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly shows you what the Linux system view process commands are, the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor to take you to study and learn the "Linux system view process commands what are" this article.

1.psps is the most basic command in Linux to browse processes in the system. Can list the processes running in the system, including process number, command, CPU usage, memory usage and so on. The following options can get more useful information.

Ps-a-lists all running / active processes

Ps-ef | grep-lists the processes that need ps-aux-displays process information, including processes without terminals (x) and for users (u): in 2.pstreelinux such as USER, PID,% CPU,% MEM, etc., each process is created by its parent. This command displays the process visually and shows the relationship between processes by displaying a tree view of the process. If pid is specified, the root of the tree is the pid, otherwise it will be init (pid: 1).

3.toptop is a more useful command to monitor the resources used by different processes in the system. It provides real-time system status information. Data showing the process includes PID, process owner, priority,% CPU,% memory, and so on. You can use these displays to indicate resource usage.

4.htophtop is similar to top, but htop is a process viewer in interactive text mode. It graphically displays the CPU and memory usage and swap usage of each process through text. Use the up and down cursor keys to select the process, F7 and F8 change the priority, and F9 kill the process. Htop is not installed by default on the system, so additional installation is required.

5.nice with the help of the nice command, users can set and change the priority of the process. Raise the priority of a process, and the kernel allocates more CPU time slices to the process. By default, the process starts with a priority of 0. The process priority can be seen through the NI (nice value) column displayed by the top command.

Process priority values range from-20 to 19. The lower the value, the higher the priority.

Nice-starts a program with a given priority value

In the above command example, you can see that the 'top' command gets the priority value of-3.

The 6.renicerenice command is similar to the nice command. Use this command to change the priority value of the running process. Note that users can only change the priority values of their own processes.

Renice-n-p-change the priority value of the specified process

The priority value of process 3806 with an initial priority value of 0 has become 4.

Renice-u-g-change process priority values by specifying users and groups

In the above example, the priority value of all processes whose user is' mint' 'becomes'-3'.

The command 7.kill is used to send a signal to end the process. If a process does not respond to the kill command, this may need to be forced to kill, using the-9 parameter to perform. Note that you must be careful when using forced killing, because the process does not have the time to clean up the scene, and the write file may not be completed. Killall can come in handy if we don't know the process PID or plan to kill the process by name.

Kill kill-9 killall-9-Kill all processes with the same name if you use kill, you need to know the process ID number. Pkill is a similar command, but uses pattern matching, such as process name, process owner, and so on.

Pkill

8.ulimit this command is used to control the amount of system resources allocated on shell and processes. It is most useful for system administrators to manage systems that are heavily used and have performance problems. Limiting the size of resources ensures that important processes continue to run, and that other processes do not take up too much resources.

Ulimit-a-displays the resource limits associated with the current user

-f: maximum file size

-v: maximum virtual memory size (KB)

-n: increase the maximum number of file descriptors

-H: change and report hard limits

-S: change and report soft limits

Browse the ulimit man page for more options.

9.ww provides information about the users who are currently logged in and the processes they are executing. The display header contains information, such as the current time, the running time of the system, the total number of logged-in users, and the number of load balancers in the past 15 minutes.

Based on this user information, users should be careful when terminating processes that do not belong to them.

Who is a similar command that provides a list of currently logged-in users, system startup time, run level, and so on.

The whoami command outputs the current user ID

10.pgreppgrep means "process number global regular match output". This command scans the currently running process and then lists the matching results to standard output according to the command matching criteria. It is useful for retrieving process numbers by name.

The command pgrep-u mint sh will display the process ID with the user 'mint'' and the process name 'sh'.

11.fg, bg sometimes commands take a long time to execute. In this case, we can use the 'bg' command to execute the task in the background, while the' fg' 'can be called to the foreground to use.

We can start a program in the background through'&':

Find. -name * iso > / tmp/res.txt & A running program can also be run in the background with a combination of "CTRL+Z" and "bg" commands.

Find. -name * iso > / tmp/res.txt &-start a program ctrl+z-suspend the currently executing program bg-put the program in the background to run we can use the 'jobs' command to list all background processes.

Jobs uses the 'fg' command to call the background program to the foreground for execution.

Fg% process id

The 12.ipcsipcs command reports the status of the interprocess communication facility. (shared memory, semaphores and message queues)

Using the-p parameter in conjunction with-m,-s, or-Q, the process ID for related inter-process communication can be obtained.

The screenshot below ipcs-p-m lists the ID and process ID of the creator of the process that recently accessed the shared memory segment.

What are the versions of Linux? the versions of Linux are Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and so on. Among them, Deepin is one of the best-developed Linux distributions in China; UbuntuKylin is a derivative release based on Ubuntu; Manjaro is a Linux release based on Arch; LinuxMint's default Cinnamon desktop is similar to Windows XP's easy-to-use; Ubuntu is the Linux operating system based on desktop applications.

The above is about "what are the Linux system viewing process commands". If this article is helpful to you and you think it is well written, please share it with your friends to learn new knowledge. if you want to know more about it, please pay more attention to the industry information channel.

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

Development

Wechat

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

12
Report