Linux ps command shows the command of the system process

 

The most commonly used commands for displaying system processes are ps -ef and ps aux.

What is the difference between these two? There is not much difference between the two. The discussion of this issue can be traced back to the two styles in Unix systems, System V style and BSD style. ps aux was originally used in Unix Style, while ps -ef was used in System V Style. The output of the two is slightly different. Most current Linux systems can use these two methods at the same time.

 

(1) General usage:

    ps -ef | grep ***

    ps aux | grep ***

The ps command displays a certain process. Select the process running status at a certain point in time.

The grep command is a search, it can use regular expressions to search for text and print out the matching lines;

The middle | is the pipeline command means that the ps command and grep are executed at the same time

 

(2) Introduction to ps -ef:

The following command is to check whether the mediation-cron process exists: ps -ef |grep mediation-cron

ps -ef displays the process in a standard format. The meanings of the fields are as follows:

 

(3) Introduction of ps aux:

The following command is to check whether the mediation-cron process exists: ps aux |grep mediation-cron

ps aux is displayed in BSD format, and its format is as follows:

Among them, the common status characters of the STAT status bit are

  • D //Cannot be interrupted sleep state (usually IO process); 
  • R // is running and can be passed in the queue; 
  • S //In an interruptible sleep state; under normal circumstances, most processes in the process list are in this state. Because single-digit CPUs have to deal with dozens or hundreds of processes, only the vast majority The process sleeps, otherwise the CPU will not respond.
  • T //Stop or be tracked; 
  • W //Enter memory exchange (invalid starting from kernel 2.6); 
  • X //Dead process (basically rare); 
  • Z //Zombie process; 
  • <//High priority process 
  • N //Lower priority process 
  • L //Some pages are locked into memory; 
  • s //The leader of the process (there are child processes under it); 
  • l //Multi-thread, clone thread (use CLONE_THREAD, similar to NPTL pthreads); 
  • + //The process group in the background;

 

 

 

Guess you like

Origin blog.csdn.net/kqZhu/article/details/109656887