리눅스 프로세스 이름으로 PID 알아내기

리눅스 프로세스명으로 PID 알아내기
프로세스 이름으로 프로세스 ID 알아내기

1 방법 1: ps[ | ]

명령어
ps -ef | grep 프로세스명 | grep -v grep
ps aux | grep 프로세스명 | grep -v grep
실행 예시
[root@zetawiki ~]# ps -ef | grep httpd | grep -v grep
apache   13014 17937  0 08:20 ?        00:02:10 /usr/sbin/httpd
apache   14925 17937  0 09:33 ?        00:02:05 /usr/sbin/httpd
apache   15558 17937  0 09:53 ?        00:01:55 /usr/sbin/httpd
apache   15809 17937  0 09:59 ?        00:01:56 /usr/sbin/httpd
root     17937     1  0 Jan05 ?        00:00:12 /usr/sbin/httpd
apache   18314 17937  0 11:12 ?        00:01:34 /usr/sbin/httpd
apache   19261 17937  0 11:34 ?        00:01:39 /usr/sbin/httpd
apache   28911 17937  0 16:44 ?        00:00:33 /usr/sbin/httpd
apache   29627 17937  0 17:00 ?        00:00:27 /usr/sbin/httpd
[root@zetawiki ~]# ps aux | grep httpd
root      2342  0.0  0.0  61216   764 pts/0    S+   19:30   0:00 grep httpd
apache   13014  0.3  2.6 307136 54636 ?        S    08:20   2:10 /usr/sbin/httpd
apache   14925  0.3  2.7 308860 56324 ?        S    09:33   2:05 /usr/sbin/httpd
apache   15558  0.3  3.2 320088 67548 ?        S    09:53   1:55 /usr/sbin/httpd
apache   15809  0.3  2.6 307240 54728 ?        S    09:59   1:56 /usr/sbin/httpd
root     17937  0.0  0.5 293004 10432 ?        Ss   Jan05   0:12 /usr/sbin/httpd
apache   18314  0.3  2.8 311916 59396 ?        S    11:12   1:34 /usr/sbin/httpd
apache   19261  0.3  3.0 315660 62500 ?        S    11:34   1:39 /usr/sbin/httpd
apache   28911  0.3  3.2 320320 67752 ?        S    16:44   0:33 /usr/sbin/httpd
apache   29627  0.3  3.4 323364 70652 ?        S    17:00   0:27 /usr/sbin/httpd

2 방법 2: pgrep[ | ]

명령어
pgrep 프로세스명
실행 예시
[root@zetawiki ~]# pgrep httpd
13014
14925
15558
15809
17937
18314
19261
28911
29627

3 방법 3: pidof[ | ]

[root@zetawiki ~]# pidof httpd
29627 28911 19261 18314 17937 15809 15558 14925 13014

4 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}