- Linux ps ¶õ?
ps ´Â ÇÁ·Î¼¼½ºÀÇ »óŸ¦ È®ÀÎÇÏ´Â ¸í·É¾îÀÔ´Ï´Ù.
ÇöÀç ƯÁ¤ ÇÁ·Î¼¼½º°¡ ½ÇÇàµÇ°í ÀÖ´ÂÁö ½ÇÇàµÇ°í ÀÖ´Â ÇÁ·Î¼¼½º°¡ ¾î¶² pid¸¦ °®°í ÀÖ´ÂÁö µîÀ»
È®ÀÎÇϴµ¥ ¸¹ÀÌ ¾²À̸ç, ¿É¼ÇÀ» ÅëÇØ CPU¿Í ¸Þ¸ð¸® Á¡À¯À²µîÀÇ Á¤º¸µµ È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.
- ps »ç¿ë¹æ¹ý
ps [¿É¼Ç]
- ¿¹Á¦ 1
ps ¸í·É¾î¸¦ ½ÇÇàÇÏ¿© ÇöÀç »ç¿ëÀÚ°¡ ½ÇÇà½ÃÅ°°í ÀÖ´Â ÇÁ·Î¼¼½º¸¦ È®ÀÎÇϽÿÀ.
- ¿¹Á¦ 1 ½ÇÇàȸé
[root@localhost ~]# ps
PID TTY TIME CMD
1380 tty1 00:00:01 bash
1525 tty1 00:00:00 ps
[Âü°í»çÇ×] ps ¿É¼Ç
¿É¼Ç
¼³¸í
PID
ÇÁ·Î¼¼½ºÀÇ ¾ÆÀ̵ð
TTY
ÇÁ·Î¼¼½º¸¦ Á¦¾îÇÏ´Â ¼ö´Ü
ÄܼÖÁ¢¼Ó½Ã "tty¼ýÀÚ" ÇàÅ·Πǥ½ÃµÇ¸ç, ¿ø°ÝÀ̳ª ¿¡¹Ä·¹ÀÌÅÍ Á¢¼Ó½Ã "pts/¼ýÀÚ" ÇüÅ·Πǥ½Ã
TIME
ÇÁ·Î¼¼½º¿¡ »ç¿ëµÈ CPU ½Ã°£
CMD
ÇÁ·Î¼¼½º ½ÇÇà ¸í·É¾î
- ps -ef ¶õ?
ps -ef ´Â µÎ°¡Áö ¿É¼ÇÀ» Ãß°¡ÇÑ °ÍÀ¸·Î e ¿É¼ÇÀº ¸ðµç ÇÁ·Î¼¼½º¸¦ Ç¥½ÃÇÏ´Â °ÍÀÌ°í
f ¿É¼ÇÀº ÇÁ·Î¼¼½ºÀÇ Á¤º¸¸¦ ´õ ¸¹ÀÌ º¸¿©ÁÖµµ·Ï ÇÏ´Â ¿É¼ÇÀÔ´Ï´Ù.
ÀϹÝÀûÀ¸·Î ÀÚÁÖ»ç¿ëÇÏ´Â ¿É¼Ç Á¶ÇÕÀÌÁö¸¸ ps -ef ¸¸À» »ç¿ëÇÏ¸é ¸¹Àº ÇÁ·Î¼¼½º°¡
Çѹø¿¡ Ç¥½ÃµÇ±â ¶§¹®¿¡ grep ¸í·É¾î·Î ¿øÇÏ´Â Å°¿öµå¸¦ °¡·Á¼ »ç¿ëÇÕ´Ï´Ù.
- ps -ef »ç¿ë¹æ¹ý
ps -ef
- ¿¹Á¦ 2
ps -ef ¸í·É¾î¸¦ ½ÇÇàÇÏ¿© ¸ðµç ÇÁ·Î¼¼½º Á¤º¸¸¦ ÀÚ¼¼ÇÏ°Ô È®ÀÎÇϽÿÀ.
- ¿¹Á¦ 2 ½ÇÇàȸé
[root@localhost ~]# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 21:20 ? 00:00:05 /sbin/init
root 2 0 0 21:20 ? 00:00:00 [kthreadd]
¤ý
¤ý
¤ý
root 1380 0 0 21:25 tty1 00:00:01 -bash
root 1594 1380 0 21:38 tty1 00:00:00 ps -ef
[Âü°í»çÇ×] ps -f ¿É¼Ç
¿É¼Ç
¼³¸í
UID
ÇÁ·Î¼¼½º ½ÇÇà À¯Àú
PID
ÇÁ·Î¼¼½ºÀÇ ¾ÆÀ̵ð
PPID
ÇÁ·Î¼¼½ºÀÇ ºÎ¸ð PID
C
CPU »ç¿ë·®
STIME
ÇÁ·Î¼¼½º ½ÃÀÛ ½Ã°£
TTY
ÇÁ·Î¼¼½º¸¦ Á¦¾îÇÏ´Â ¼ö´Ü
ÄܼÖÁ¢¼Ó½Ã "tty¼ýÀÚ" ÇàÅ·Πǥ½ÃµÇ¸ç, ¿ø°ÝÀ̳ª ¿¡¹Ä·¹ÀÌÅÍ Á¢¼Ó½Ã "pts/¼ýÀÚ" ÇüÅ·Πǥ½Ã
TIME
ÇÁ·Î¼¼½º¿¡ »ç¿ëµÈ CPU ½Ã°£
CMD
ÇÁ·Î¼¼½º ½ÇÇà ¸í·É¾î
- ¿¹Á¦ 3
ps -ef ¸í·É¾î¸¦ ÀÌ¿ëÇÏ¿© sshd (ssh ½ÇÇà µ¥¸ó) ÀÌ ½ÇÇàµÇ°í ÀÖ´ÂÁö È®ÀÎÇϽÿÀ.
- ¿¹Á¦ 3 ½ÇÇàȸé
[root@localhost ~]# ps -ef | grep sshd
UID PID PPID C STIME TTY TIME CMD
root 1149 1 0 21:22 ? 00:00:00 /usr/sbin/sshd
root 1879 1380 6 21:41 tty1 00:00:00 grep sshd
[Âü°í»çÇ×] grep ¸í·É¾î
grep ¸í·É¾î´Â ÀÔ·ÂµÈ ³»¿ëÁß¿¡ ƯÁ¤ ¹®ÀÚ¿ÀÌ Á¸ÀçÇÏ´Â ÁÙÀ» Ãâ·ÂÇØÁÖ´Â ¿ªÈ°À» ÇÕ´Ï´Ù.
ps - ef ÀÇ °á°ú¸¦ | (ÆÄÀÌÇÁ) ¸¦ ÅëÇØ grep ¸í·É¾î¿¡ Àü´ÞÇÏ¿© sshd ¶ó´Â ¹®ÀÚ¿ÀÌ Á¸ÀçÇÏ´Â ÁÙÀ»
Ç¥½ÃÇÑ °ÍÀÌ ¿¹Á¦ 3¹øÀÇ °á°ú·Î º¼ ¼ö ÀÖ½À´Ï´Ù.
- ps -o ¶õ?
ps -o ´Â ÇÁ·Î¼¼½º¿¡ ´ëÇØ ¾Ë°íÀÚ ÇÏ´Â Ç׸ñÀ» À¯Àú°¡ ¼±ÅÃÇÏ¿© È®ÀÎÇÏ´Â ¸í·É¾îÀÔ´Ï´Ù.
- ps -o »ç¿ë¹æ¹ý
ps -o [ÇÁ·Î¼¼½º¿¡ ´ëÇØ ¾Ë°íÀÚ ÇÏ´Â Ç׸ñ]
- ¿¹Á¦ 4
ps -o ¸í·É¾î¸¦ ÀÌ¿ëÇÏ¿© pid, cpu »ç¿ë·ü, ¸Þ¸ð¸® »ç¿ë·ü, ÇÁ·Î¼¼½º½ÃÀ۽ð£, ¸í·É¾î¸¦ Ãâ·ÂÇϽÿÀ.
- ¿¹Á¦ 4 ½ÇÇàȸé
[root@localhost ~]# ps -o pid,%cpu,%mem,stime,cmd
PID %CPU %MEM STIME CMD
1380 0.0 0.1 21:25 -bash
1910 8.0 0.0 21:46 ps -o pid,%cpu,%mem,stime,cmd
[Âü°í»çÇ×] ps -o ¿¡ »ç¿ëÇÏ´Â ¿É¼ÇÈ®ÀÎ ¹æ¹ý
ps L ¸í·É¾î¸¦ ½ÇÇà½ÃÅ°¸é ps -o ÀÌÇÏÀÇ ¿É¼ÇÇ׸ñÀ» È®ÀÎÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.
[Ãâó] Linux ps (ÇÁ·Î¼¼½º È®ÀÎÇϱâ)|ÀÛ¼ºÀÚ Ã¢°ø
Example)))
# ps -eo pid,%mem,%cpu,cmd
[root@iscsi/root]# ps -eo pid,%mem,%cpu,cmd
PID %MEM %CPU CMD
1 0.1 0.0 /sbin/init
2 0.0 0.0 [kthreadd]
3 0.0 0.0 [migration/0]
............
................
..........
1828 0.3 0.0 /usr/libexec/bonobo-activation-server --ac-activate --ior-output
1838 1.2 0.0 /usr/libexec/wnck-applet --oaf-activate-iid=OAFIID:GNOME_Wncklet
1839 1.0 0.0 /usr/libexec/trashapplet --oaf-activate-iid=OAFIID:GNOME_Panel_T
1841 0.3 0.0 /usr/libexec/gvfsd-trash --spawner :1.7 /org/gtk/gvfs/exec_spaw/
1847 1.3 0.0 nm-applet --sm-disable
1849 0.4 0.0 /usr/libexec/im-settings-daemon
1850 1.4 0.0 gnome-volume-control-applet
1851 0.8 0.0 gnome-power-manager
1854 0.8 0.0 rhsm-icon
1858 2.1 0.0 python /usr/share/system-config-printer/applet.py
1902 0.5 0.0 /usr/bin/pulseaudio --start
1913 0.6 0.0 /usr/libexec/polkit-gnome-authentication-agent-1
1975 0.2 0.0 /usr/libexec/pulse/gconf-helper
2041 0.2 0.0 /usr/bin/ibus-daemon -r --xim
2042 0.9 0.0 gpk-update-icon
2046 0.2 0.0 /usr/libexec/gconf-im-settings-daemon
2050 0.7 0.0 gnome-screensaver
2055 0.3 0.0 /usr/libexec/ibus-gconf
2057 0.3 0.0 /usr/libexec/gvfs-gdu-volume-monitor
2059 2.6 0.0 python /usr/share/ibus/ui/gtk/main.py
2061 0.3 0.0 /usr/libexec/udisks-daemon
2062 0.0 0.0 udisks-daemon: not polling any devices
2065 0.6 0.0 /usr/libexec/ibus-x11 --kill-daemon
2072 0.3 0.0 /usr/libexec/ibus-engine-hangul --ibus
2080 1.2 0.0 /usr/libexec/gdm-user-switch-applet --oaf-activate-iid=OAFIID:GN
2081 1.6 0.0 /usr/libexec/clock-applet --oaf-activate-iid=OAFIID:GNOME_ClockA
2082 0.8 0.0 /usr/libexec/notification-area-applet --oaf-activate-iid=OAFIID:
2104 0.2 0.0 /usr/libexec/gvfsd-metadata
2107 1.5 0.0 gnome-terminal
2108 0.0 0.0 gnome-pty-helper
2109 0.2 0.0 bash
2146 1.1 0.0 /usr/libexec/notification-daemon
2198 0.0 0.0 /usr/sbin/anacron -s
2223 0.4 0.0 /usr/sbin/packagekitd
2226 0.4 0.0 sshd: root@pts/1
2228 0.2 0.0 -bash
2251 0.1 0.0 ps -eo pid,%mem,%cpu,cmd