새소식

Operation System/Unix & Linux

linux 프로세스별 CPU 사용량 확인

  • -
728x90
반응형

linux에서 ps 명령을 통해 프로세스별 CPU 사용량 확인해보기


ps -aux --sort -pcpu
$ ps -aux --sort -pcpu|more
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root        1014  0.1  0.1 2085844 49692 ?       Ssl  Oct02   3:37 /usr/bin/containerd
root        5678  0.1  1.8 15310052 738596 pts/0 Ssl+ Oct02   5:30 java -Dspring.profiles.active=prod -jar app.jar
root           1  0.0  0.0 167908 11636 ?        Ss   Oct02   0:11 /sbin/init splash
root           2  0.0  0.0      0     0 ?        S    Oct02   0:00 [kthreadd]
root           3  0.0  0.0      0     0 ?        I<   Oct02   0:00 [rcu_gp]
root           4  0.0  0.0      0     0 ?        I<   Oct02   0:00 [rcu_par_gp]
root           5  0.0  0.0      0     0 ?        I<   Oct02   0:00 [netns]
root           7  0.0  0.0      0     0 ?        I<   Oct02   0:00 [kworker/0:0H-events_highpri]
root           9  0.0  0.0      0     0 ?        I<   Oct02   0:00 [kworker/0:1H-kblockd]

 

head 명령을 통해 결과 개수 조정
$ ps -aux --sort -pcpu|head -n 11
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root        1014  0.1  0.1 2085844 49692 ?       Ssl  Oct02   3:37 /usr/bin/containerd
root        5678  0.1  1.8 15310052 738596 pts/0 Ssl+ Oct02   5:30 java -Dspring.profiles.active=prod -jar app.jar
root           1  0.0  0.0 167908 11636 ?        Ss   Oct02   0:11 /sbin/init splash
root           2  0.0  0.0      0     0 ?        S    Oct02   0:00 [kthreadd]
root           3  0.0  0.0      0     0 ?        I<   Oct02   0:00 [rcu_gp]
root           4  0.0  0.0      0     0 ?        I<   Oct02   0:00 [rcu_par_gp]
root           5  0.0  0.0      0     0 ?        I<   Oct02   0:00 [netns]
root           7  0.0  0.0      0     0 ?        I<   Oct02   0:00 [kworker/0:0H-events_highpri]
root           9  0.0  0.0      0     0 ?        I<   Oct02   0:00 [kworker/0:1H-kblockd]
root          10  0.0  0.0      0     0 ?        I<   Oct02   0:00 [mm_percpu_wq]
  • head -n 명령으로 개수 조정
    • 헤드를 포함해서 n개 출력 +1 해서 계산


 

728x90
반응형

'Operation System > Unix & Linux' 카테고리의 다른 글

ps: command not found  (0) 2022.10.11
linux 프로세스별 CPU 사용량 결과 원하는 대로 출력  (0) 2022.10.04
zip: command not found  (0) 2022.10.03
unzip: command not found  (0) 2022.10.03
file: command not found  (0) 2022.09.27

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.