상단에서 전체 프로세스 목록을 보는 방법

상단에서 전체 프로세스 목록을 보는 방법

'top'을 수행하면 많은 프로세스가 실행 중이고 그 중 많은 프로세스가 절전 모드에 있음을 알게 됩니다. 해당 시점에서 모든 프로세스의 전체 스냅샷을 확인해야 합니다. 'top'은 한 화면에 맞는 프로세스 목록을 표시할 수 있습니다. 전체 목록을 얻으려면 어떻게 해야 합니까?

무엇보다도 "잠자기" 상태에 있는 모든 프로세스의 목록을 보는 데 관심이 있습니다. "ps" 명령의 출력에서 ​​프로세스 상태를 얻을 수는 없을 것 같습니다.

답변1

top -b트릭을 수행하는 것 같습니다.

답변2

coreutils를 사용하여 프로세스 상태를 얻을 수 있습니다ps

$ ps aux

그 모든 것, 그리고 그 이상을 나열할 것입니다. 매뉴얼 페이지에서 이를 디코딩하는 방법은 다음과 같습니다.

프로세스 상태 코드

다음은 s, stat 및 state 출력 지정자(헤더 "STAT" 또는 "S")가 프로세스 상태를 설명하기 위해 표시하는 다양한 값입니다.

   D    uninterruptible sleep (usually IO)
   R    running or runnable (on run queue)
   S    interruptible sleep (waiting for an event to complete)
   T    stopped, either by a job control signal or because it is being traced.
   W    paging (not valid since the 2.6.xx kernel)
   X    dead (should never be seen)
   Z    defunct ("zombie") process, terminated but not reaped by its parent.

BSD 형식의 경우 stat 키워드를 사용하면 추가 문자가 표시될 수 있습니다.

   <    high-priority (not nice to other users)
   N    low-priority (nice to other users)
   L    has pages locked into memory (for real-time and custom IO)
   s    is a session leader
   l    is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
   +    is in the foreground process group.

관련 정보