Linux Top/free command usage and parameter details

Source: Internet
Author: User
1. the top command is used to display the processes in execution. The permission is granted to all users. 2. Format: top [-] [ddelay] [q] [c] [S] [s] [I] [n] 3. main parameter d:

1. Role

The top command is used to display the processes in execution. The permission is granted to all users.

2. Format

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

3. main parameters

D: specify the update interval, in seconds.

Q: There are no delayed updates. If a super user exists, the top command is executed in the highest priority order.

C: displays the complete process path and name.

S: the accumulation mode, which accumulates the CPU time of the completed or disappearing sub-itinerary.

S: security mode.

I: No Idle (Idle) or useless (Zombie) itinerary is displayed.

N: displays the number of updates. after the update is completed, the system will exit the top.

4. description

The top command is a major command for Linux system management. it can obtain a lot of information. Here we will describe the information it provides.

Display of top commands (figure omitted)

The items in the first line are the current time, system running time, number of logged-on users of the current system, and average system load of 1/5/10 minutes (generally, this load value should not exceed 1 unless your system is busy. If the program continues to be higher than 5, take a closer look at the program that affects the overall system !).

The second line shows all started processes, currently running, suspended and useless processes. (Note the value of zombie at the end. if it is not 0, Hey! Let's take a good look at the process that turned into a zombie in Xinjiang, right ?!) (Stop mode: it should be different from the sleep process. sleep will take the initiative to discard the cpu, while stop is a passive discard of the cpu, for example, one-step tracking, stop (pause) the process cannot return to the running state on its own)

The third line shows the current CPU usage, the CPU usage includes the CPU usage percentage of the us user space, the CPU usage percentage of the sy kernel space, and the CPU usage percentage of the processes that have changed the priority in the ni user process space (occupied by interrupt processing) the contents of id idle CPU percentage, wa CPU time percentage waiting for input and output, hi, si, and st are unclear yet :)

The fourth line shows the usage of physical memory, including the total available memory, used memory, idle memory, and memory occupied by the buffer.

The fifth line shows the swap partition usage, including the total swap partition, used, idle, and cache size.

The sixth line displays the largest number of items. the detailed explanations are listed below.

PID (Process ID): process ID (ID of each Process)

USER: USER name of the process owner (USER of the process)

PR: Process Priority (abbreviated as Priority, the execution order of the program is smaller and earlier)

NI: the Priority value of a process (abbreviated as Nice, which is related to Priority. the smaller the value, the earlier it is executed)

VIRT: virtual memory occupied by the process.

RES: the physical memory occupied by the process.

SHR: the shared memory value used by the process.

S: Process Status. S indicates sleep, R indicates running, Z indicates frozen, and N indicates that the priority of the process is negative.

% CPU: CPU usage occupied by the process.

% MEM: Percentage of physical memory and total memory occupied by the process.

TIME +: total cpu time occupied by the process after it is started (the sum of CPU usage TIME)

Command: The name of the startup Command that the process starts. if this line does not appear, the process has a complete Command line.

Some interactive commands can be used to complete other parameter functions during the use of the top command. These commands are started by using the shortcut key.

<Space>: Refresh immediately.

P: Sort by CPU usage.

T: Sort by time and accumulated time.

Q: exit the top command.

M: Switch to display memory information.

T: Process and CPU status information is displayed during switchover.

C: switch the display command name and the complete command line.

M: Sort by memory size.

W: write the current settings ~ /. Toprc file. This is a recommended method for writing top configuration files.

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

5. application instance

You can use the top command to monitor the processes of a specified user. by default, you can monitor the processes of all users. to view the status of a specified user, press the "U" key on the terminal and enter the user name, the system switches to the process running interface of the specified user, as shown in.

A. role

The free command is used to display memory usage. The permission is applied to all users.

B. Format

Free [-B |-k |-m] [-o] [-s delay] [-t] [-V]

C. main parameters

-B-k-m: memory usage is displayed in bytes (KB, MB.

-S delay: the number of seconds to display the memory usage.

-T: displays the total memory column.

-O: The buffer adjustment column is not displayed.

D. application instance

The free command is the main command used to view memory usage. compared with the top command, it is easy to use and only occupies a small amount of system resources, the-S parameter allows you to use the free command to continuously monitor the number of inactive instances. This allows you to use it as a convenient real-time monitor.

# Free-B-s5

After using this command, the memory continuously reports memory usage (in bytes) and updates every 5 seconds.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.