Linux Process and system information viewing command

Source: Internet
Author: User


Command for viewing linux processes and system information [root @ www ~] # Ps aux <= all program information of the system [root @ www ~] # Ps-lA <= is also the information that can be used to inspect all systems [root @ www ~] # Ps axjf <= indicates the number of Program Selection candidates and numbers in the same part of the program:-A: all processes are displayed, which has the same effect as-e; -a: All processes not related to terminal;-u: processes related to valid users; x: usually used together with, lists the complete information about a region. Output format specification: -www.2cto.com-l: the information of the PID is listed by the Chief and Chief Operator; j: Job format-f: make a more complete export. Write/bin/ps is the state of instantaneous travel, not dynamically continuous; if you want to monitor the running time of the process, you should use the top tool. Kill is used to kill a process. ================== Ps parameter description ================================== ======= l long format output; u displays processes in the username and start time order; j displays processes in the task format; f displays processes in the tree format; a: displays all processes of all users (including other users); x displays processes without control terminals; r displays processes in progress; ww avoids detailed parameter truncation; -A: list all the itineraries.-w: Show widening: show more information.-au: show more detailed information.-aux: show all the itineraries containing other users.-e: show all processes, environment Variable-f full format-h does not show title-l long format-w width output a shows all processes on the terminal, including other user processes, r only displays processes in the running state x shows processes in the non-controlling state. Our common options are combination of aux or lax, and application of parameter f. O [+ |-] k1 [, [+ |-] k2 [,…] The process list is displayed in the multi-level sorting order specified by the shortcut KEYS in short keys, k1, and k2. the default sequence is specified for different ps formats. these default sequence can be overwritten by user-specified. here, the "+" character is optional, and the "-" character is used to reverse the specified key direction. pids lists only process identifiers separated by commas. the process list must be followed by the last option of the command line parameter. spaces cannot be inserted in the middle. for example, ps-f1, 4, 5. the following describes the long command line options. These options start with "--": -- sort X [+ |-] key [, [+ |-] key [,…] Select a multiple KEYS from the sort keys segment. the "+" character is optional, because the default direction is in ascending order of numbers or dictionary order. for example, ps-jax-sort = uid,-ppid, + pid. -www.2cto.com --- help displays help information. -- version: displays the local version of the command. the sort key is mentioned in the preceding option description. Next, we will further describe the sort key. note that the land use value in the sorting operation is the internal value of the ps application, not only the pseudo value in some output formats. the following table lists the sort keys. =============== sort Key List ================================== = c cmd executable simple name C cmdline complete command line f flags Long MODE Mark g pgrp Process Group id g tpgid control tty Process Group ID j cutime cumulative user time J cstime cumulative System time k utime user time K stime system time m min_f Lt secondary page error count M maj_flt Key page error count n cmin_flt cumulative secondary page error N cmaj_flt cumulative Key page error o session conversation ID p pid process id p ppid parent process ID r rss resident size R resident page s size memory size (kilobytes) S share page count t tty secondary device No. T start_time process start time U uid UIDu user Username v vsize total number of local virtual memory (bytes) y priority kernel scheduling priority ====================================== ============================== ps aux or lax output =================================== 2. Explanation of ps aux or lax output au (x) output Grid Formula: user pid % CPU % mem vsz rss tty stat start time command user: process owner PID: process ID % CPU: occupied CPU usage % MEM: occupied memory usage VSZ: occupied virtual memory size RSS: occupied memory size TTY: terminal secondary device number (minor device number of tty) STAT: Process status: START: Process startup TIME; TIME: CPU consumption time of processes; COMMAND: COMMAND name and parameter; ======================= process STAT status ============================== d. The sleep state that cannot be interrupted (usually the IO process ); R is running, In the interrupted queue; S is in sleep and static state; T is stopped or tracked, paused; W is in memory switching (starting from kernel 2.6 is invalid ); X dead process;-www. 2ct O.com-Z: the zombie process does not exist but cannot be eliminated. W: There is not enough memory paging to allocate the resources of the processes that WCHAN is waiting for. <: high-priority process N: low-priority process L: there is memory allocated by PAGE and locked in the memory (real-time system or memory a I/O), that is, some pages are locked into the memory s process leader (under it there are sub-processes ); l multi-process (using CLONE_THREAD, similar to NPTL pthreads); + process group in the background; ===================== kill terminate a process ============================== === killing a process involves more than a dozen methods to control the process, below are some common methods: kill-STOP [pid] sends SIGSTOP (17,19, 23) to STOP a process without killing it. Kill-CONT [pid] sends SIGCONT (, 25) to restart a stopped process. Kill-KILL [pid] sends SIGKILL (9) to force the process to stop immediately without cleaning. Kill-9-1 to terminate all processes you own. The SIGKILL and SIGSTOP signals cannot be captured, blocked, or ignored. However, other signals are acceptable. So this is your weapon. ======================== Example ================================ = $ psPID tty time COMMAND5800 ttyp0 00:00:00 bash5835 ttyp0 00:00:00 ps, project display area is divided into four items: PID (process ID), TTY (terminal name), TIME (process execution TIME), and COMMAND (COMMAND line input of the process ). you can use the u option to view the process owner and other details, as shown below: $ ps u -www.2cto.com-user pid % CPU % mem usz rss tty stat start time COMMANDtest 5800 0.0 0.4 1892 1040 5836 ttyp0 S Nov27-bashtest 0.0 0.3 2528 856 ttyp0 R Nov27 ps u in bash There is a horizontal line before the process, which means that the process is a user login shell, so for a login user, there is only one process with a transient line. the options % CPU and % MEM are also displayed. The former indicates the percentage of CPU time and total time occupied by the process, and the latter indicates the percentage of memory occupied by the process and total memory. in this case, we can see all the processes that control terminals. Of course, we still haven't observed other processes that do not control terminals. Therefore, we need to use the x option. you can use the x option to view all processes in the process. 1) ps a shows all programs under the current terminal, including those of other users. 2) ps-A shows all programs. 3) when listing programs in ps c, the real command name of each program is displayed without the path, parameter or resident service identifier. 4) the effect of this parameter is the same as that of the specified "A" parameter. 5) when listing programs, ps e displays the environment variables used by each program. 6) ps f uses ASCII characters to display the tree structure and express the relationship between programs. 7) the ps-H tree structure is displayed, indicating the relationship between programs. 8) ps-N shows all programs, except the programs under the ps command terminal. 9) ps displays the program status in the program signal format. 10) when listing programs in ps, it includes interrupted subroutines. 11) ps-t <terminal number> specifies the terminal number and lists the status of programs belonging to the terminal. 12) ps u displays the program status in user-based format. 13) ps x shows all programs, which are not distinguished by terminals. The most common method is ps-aux, which is then directed to grep with the pipeline symbol to find a specific process and then operate on the specific process. Author zdcshh

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.