YouTip LogoYouTip

Linux Comm Top

# Linux top Command [![Image 4: Linux Command Manual](#) Linux Command Manual](#) Linux **top** is a commonly used real-time system monitoring tool on Linux and other Unix-like systems. It provides a dynamic, interactive real-time view of the system's overall performance information and information about running processes. Permissions: All users. ### Syntax top **Parameter Description**: * `-d `: Specifies the refresh interval for the top command, in seconds. * `-n `: Specifies the number of times top runs before exiting automatically. * `-p `: Displays information only for the specified process ID. * `-u `: Displays process information only for the specified username. * `-H`: Displays detailed thread information in the process list. * `-i`: Hides idle or useless processes. * `-b`: Runs in batch mode, outputting results directly to a file. * `-c`: Displays the full command line without truncation. * `-S`: Displays cumulative CPU usage time for processes. ### Display Information Some common functions and display information of the top command: !(#) Overall System Information: * uptime: System uptime and average load. * tasks: Number of currently running processes and threads. * CPU: Overall CPU usage and usage per core. * Memory: Overall memory usage, available memory, and cache. Process Information: * PID: Process identifier. * USER: Username of the process owner. * PR (Priority): Process priority. * NI (Nice value): Process priority adjustment value. * VIRT (Virtual Memory): Size of virtual memory used by the process. * RES (Resident Memory): Size of physical memory actually used by the process. * SHR (Shared Memory): Size of shared memory used by the process. * %CPU: Percentage of CPU usage by the process. * %MEM: Percentage of memory usage by the process. * TIME+: Cumulative CPU time for the process. Functions and Interactive Operations: * Key Commands: While top is running, you can use certain key commands for operations. For example, pressing "k" can terminate a process, pressing "h" can display help information, etc. * Sorting: Processes can be sorted by CPU usage, memory usage, process ID, etc. * Refresh Rate: You can set the refresh rate of top to dynamically view system information. ### Examples Display process information # top Display full command # top -c Display program information in batch mode # top -b Display program information in cumulative mode # top -S Set the number of information updates top -n 2//Indicates to terminate the update display after two updates Set the information update interval # top -d 3//Indicates the update interval is 3 seconds Display information for a specific process # top -p 139//Displays information for process number 139, including CPU and memory usage, etc. Exit after ten updates top -n 10 Users will not be able to use interactive commands to issue commands to processes top -s [![Image 6: Linux Command Manual](#) Linux Command Manual](#)
← Linux Comm PstreeLinux Comm Procinfo β†’