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

View common commands consumed by system resources under Linux

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "View the common commands occupied by system resources under Linux". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "View the common commands used by the system resources under Linux".

One, top command

1. Action

The top command is used to display the progress of the program in execution, and the permission is for all users.

two。 Format

Top [-] [d delay] [Q] [c] [S] [s] [I] [n]

3. Main parameters

D: specifies the interval between updates, measured in seconds.

Q: there are no delayed updates. If the user has a superuser, the top command will be executed in the highest priority.

C: displays the full path and name of the process.

S: cumulative mode, which accumulates the CPU time of subtrips that have been completed or disappeared.

S: safe mode.

I: do not show any idle (Idle) or useless (Zombie) itinerary.

N: displays the number of updates, and will exit top after completion.

Figure 1 display of the top command

In figure 1, the items represented in the first line are the current time, the system startup time, the number of current system login users, and the average load. The second line shows all started, currently running, Sleeping, and Zombie processes. The third line shows the current usage of CPU, including the percentage occupied by the system, the percentage of users using it, and the percentage of idle (Idle). The fourth line shows the physical memory usage, including the total available memory, used memory, free memory, and memory occupied by buffers. The fifth line shows the swap partition usage, including the total swap partition, used, idle, and the size used for caching. The sixth line shows the most items, and a detailed explanation is listed below.

PID (Process ID): the process identification number.

USER: the user name of the process owner.

PR: the priority of the process.

NI: the priority value of the process.

VIRT: the virtual memory value occupied by the process.

RES: the physical memory value occupied by the process.

SHR: the shared memory value used by the process.

S: the state of the process, where S indicates hibernation, R indicates running, Z indicates dead state, and N indicates that the process priority value is negative.

% CPU: the CPU usage occupied by this process.

% MEM: the percentage of physical memory and total memory consumed by the process.

TIME+: the total CPU time spent by the process since it was started.

Command: the name of the startup command that the process starts. If this line is not displayed, the process will have a complete command line.

During the use of the top command, you can also use some interactive commands to complete the functions of other parameters. These commands are started by shortcut keys.

Refresh immediately.

P: sort by CPU usage size.

T: sort according to time and cumulative time.

Q: exit the top command.

M: toggles the display of memory information.

T: toggles the display of process and CPU status information.

C: toggles the display command name and the full command line.

M: sort by the amount of memory used.

W: writes the current settings to the ~ / .toprc file. This is the recommended way to write top configuration files.

As you can see, the top command is a very powerful tool for monitoring the system, especially for system administrators. However, its disadvantage is that it consumes a lot of system resources.

II. Free command

1. Action

The free command is used to show memory usage, with permissions for all users.

two。 Format

Free [- b-k-m] [- o] [- s delay] [- t] [- V]

3. Main parameters

-b-k-m: displays memory usage in bytes (KB, MB), respectively.

-s delay: displays the number of seconds per second to show memory usage.

-t: displays the memory sum column.

-o: the buffer adjustment column is not displayed.

4. Application example

The free command is the main command used to view memory usage. Compared with the top command, it has the advantage of being easy to use and consuming only a small amount of system resources. With the-S parameter, you can use the free command to continuously monitor how much memory is used, so that it can be used as a convenient real-time monitor.

# free-b-S5

After using this command, the terminal will continuously report memory usage (in bytes), updated every 5 seconds.

3. Uptime command

In the linux system, there is a saying that when load avarage

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