1. lsof ¶õ? 2. lsof È°¿ë¹ý 3. ÇØÅ· ÃßÀû 4. °á·Ð
-----------------
1. lsof ¶õ?
]# whatis lsof lsof (8) - list open files ( ¿·ÁÁø ÆÄÀϵéÀ» º¸´Â ¸í·É¾î )
ÀϹÝÀûÀ¸·Î ½Ã½ºÅÛ¿¡¼ µ¿ÀÛÇÏ°í ÀÖ´Â ¸ðµç ÇÁ·Î¼¼½º¿¡ ÀÇÇؼ ¿¸®¾îÁø ÆÄÀϵ鿡 °üÇÑ Á¤º¸¸¦ º¸¿©ÁÖ´Â ½Ã½ºÅÛ °ü¸® ¸í·É¾î
2. lsof È°¿ë¹ý
2.1. lsof ÆÄÀϸí ÁöÁ¤ÇÑ ÆÄÀÏÀ» ¿¢¼¼½º ÇÏ°í ÀÖ´Â ÇÁ·Î¼¼½ºÀÇ Á¤º¸¸¦ º¸¿©ÁÝ´Ï´Ù.
]# lsof /usr/sbin/proftpd COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME proftpd 647 nobody txt REG 8,2 433516 209221 /usr/sbin/proftpd
2.2. lsof /tmp ÁöÁ¤ÇÑ µð·ºÅ丮¸¦ ¿¢¼¼½º ÇÏ°í ÀÖ´Â ÇÁ·Î¼¼½ºÀÇ Á¤º¸¸¦ º¸¿©ÁÝ´Ï´Ù.
]# lsof /tmp COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME libhttpd. 27187 root 3u REG 7,0 0 13 /tmp/ZCUD5mDv1l (deleted) libhttpd. 27318 nobody 3u REG 7,0 0 13 /tmp/ZCUD5mDv1l (deleted) libhttpd. 27319 nobody 3u REG 7,0 0 13 /tmp/ZCUD5mDv1l (deleted) libhttpd. 27320 nobody 3u REG 7,0 0 13 /tmp/ZCUD5mDv1l (deleted) libhttpd. 27321 nobody 3u REG 7,0 0 13 /tmp/ZCUD5mDv1l (deleted)
2.3. lsof -i ¸ðµç ³×Æ®¿öÅ© ¿¬°áµÇ¾î ÀÖ´Â ÇÁ·Î¼¼½º¿Í ÆÄÀÏÀ» Á¤º¸¸¦ º¸¿©ÁÝ´Ï´Ù.
]# lsof -i sshd 586 root 3u IPv4 1877 TCP *:ssh (LISTEN) xinetd 600 root 5u IPv4 1943 TCP *:pop3 (LISTEN) sendmail 619 root 4u IPv4 1962 TCP *:smtp (LISTEN) proftpd 647 nobody 0u IPv4 315947 TCP *:ftp (LISTEN) mysqld 708 mysql 3u IPv4 2652 TCP *:mysql (LISTEN)
ex)lsof -iTCP ; lsof -iUDP tcp ³ª ȤÀº UDP¸¦ °É·¯¼ º¼¶§ »ç¿ëÇÕ´Ï´Ù.
2.4. lsof -c µ¥¸ó¸í ÁöÁ¤ÇÑ µ¥¸ó°ú ¿¬°áµÇ¾î ÀÖ´Â ÇÁ·Î¼¼½º¿Í ÆÄÀÏÀ» Á¤º¸¸¦ º¸¿©ÁÝ´Ï´Ù.
]# lsof -c proftpd COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME proftpd 647 nobody cwd DIR 8,3 4096 2 / proftpd 647 nobody rtd DIR 8,3 4096 2 / proftpd 647 nobody txt REG 8,2 433516 209221 /usr/sbin/proftpd proftpd 647 nobody mem REG 8,3 106424 15973 /lib/ld-2.3.2.so proftpd 647 nobody mem REG 8,3 23404 15994 /lib/libcrypt-2.3.2.so proftpd 647 nobody mem REG 8,3 30488 17917 /lib/libpam.so.0.75 proftpd 647 nobody mem REG 8,3 1571340 95813 /lib/tls/libc-2.3.2.so proftpd 647 nobody mem REG 8,3 14888 15996 /lib/libdl-2.3.2.so proftpd 647 nobody mem REG 8,3 8612 17914 /lib/liblaus.so.1.0.0 proftpd 647 nobody mem REG 8,3 51908 16016 /lib/libnss_files-2.3.2.so proftpd 647 nobody 0u IPv4 315947 TCP *:ftp (LISTEN) proftpd 647 nobody 4r REG 8,3 3509 82811 /etc/passwd proftpd 647 nobody 5r REG 8,3 1241 83170 /etc/group
2.5. lsof -p ÇÁ·Î¼¼½ºID ÁöÁ¤ÇÑ ÇÁ·Î¼¼½º¿Í °ü·ÃµÈ ÇÁ·Î¼¼½º¿Í ÆÄÀÏÀÇ Á¤º¸¸¦ º¸¿©ÁÝ´Ï´Ù.
]# lsof -p 1 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME init 1 root cwd DIR 8,3 4096 2 / init 1 root rtd DIR 8,3 4096 2 / init 1 root txt REG 8,3 27036 16204 /sbin/init init 1 root mem REG 8,3 1571340 95813 /lib/tls/libc-2.3.2.so init 1 root mem REG 8,3 106424 15973 /lib/ld-2.3.2.so init 1 root 10u FIFO 8,3 71415 /dev/initctl
3. ÇØÅ· ÃßÀû
3.1. ½Ã³ª¸®¿À ]#lsof -i -> ±âº» Æ÷Æ®¿¬°ÍÀ» È®ÀÎÇÕ´Ï´Ù. ]#lsof -p -> ÇÁ·Î¼¼½º¸¦ ºÐ¼®ÇÕ´Ï´Ù. ]#lsof /home/ȨÆäÀÌÁö µð·ºÅ丮 -> ƯÁ¤µð·ºÅ丮¿¡ ÀÖ´Â ÇÁ·Î¼¼½º °Ë»ç ]#lsof /tmp -> ÀÓ½ÃÆÄÀÏ °ü·Ã ÇÁ·Î¼¼½º ºÐ¼® ]#lsof /dev -> Á¤±Ô ÇØÅ· µð·ºÅ丮 ºÐ¼®
°¢Á¾ Á¤º¸¸¦ ¼öÁýÇØ°í Á¤¸® ¹× ´ëÀÀÀ» ÇÕ´Ï´Ù.
4. °á·Ð
º¸¾È °ü·ÃµÈ ÀÏÀ» ÇÏ´Â »ç¶÷Àº ¹Ýµå½Ã ¸¶½ºÅÍÇؾßÇÕ´Ï´Ù. |
|
|