웬만해선 각각의 desktop 에서는 프로세스들을 실시관 gui로 관리 할수 있는 task-manager를 제공한다.
하지만 리눅스 사용자라면 프로세스 확인과 종료에 대한 기본적인 원리를 알고 있어야 한다.
먼저 간단하게 프로세스를 볼 수 있는 명령어는 'ps' 이다.
// ps 명령어를 치면 나오는 것은 달랑 두개 이다.
$ ps
PID TTY TIME CMD
2863 pts/1 00:00:00 bash
2884 pts/1 00:00:00 ps
# 이것은 현재 사용자가 콘솔로서 활용하고 있는 기초적인 CUI 현황을 나타내고 있는 TTY/PTS 정보 이다.
// 단도직입적으로 ps 정보를 포괄적으로 확인해 보자.
$ ps -lea
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
4 S 0 1 0 0 80 0 - 29998 - ? 00:00:02 systemd
1 S 0 2 0 0 80 0 - 0 - ? 00:00:00 kthreadd
1 S 0 3 2 0 80 0 - 0 - ? 00:00:00 ksoftirqd/0
1 S 0 4 2 0 80 0 - 0 - ? 00:00:00 kworker/0:0
1 S 0 5 2 0 60 -20 - 0 - ? 00:00:00 kworker/0:0H
1 S 0 7 2 0 80 0 - 0 - ? 00:00:00 rcu_sched
1 S 0 8 2 0 80 0 - 0 - ? 00:00:00 rcu_bh
1 S 0 9 2 0 -40 - - 0 - ? 00:00:00 migration/0
5 S 0 10 2 0 -40 - - 0 - ? 00:00:00 watchdog/0
5 S 0 11 2 0 -40 - - 0 - ? 00:00:00 watchdog/1
1 S 0 12 2 0 -40 - - 0 - ? 00:00:00 migration/1
1 S 0 13 2 0 80 0 - 0 - ? 00:00:00 ksoftirqd/1
1 S 0 15 2 0 60 -20 - 0 - ? 00:00:00 kworker/1:0H
5 S 0 16 2 0 -40 - - 0 - ? 00:00:00 watchdog/2
1 S 0 17 2 0 -40 - - 0 - ? 00:00:00 migration/2
1 S 0 18 2 0 80 0 - 0 - ? 00:00:00 ksoftirqd/2
1 S 0 20 2 0 60 -20 - 0 - ? 00:00:00 kworker/2:0H
5 S 0 21 2 0 80 0 - 0 - ? 00:00:00 kdevtmpfs
1 S 0 22 2 0 60 -20 - 0 - ? 00:00:00 netns
1 S 0 23 2 0 60 -20 - 0 - ? 00:00:00 perf
1 S 0 24 2 0 80 0 - 0 - ? 00:00:00 khungtaskd
1 S 0 25 2 0 60 -20 - 0 - ? 00:00:00 writeback
1 S 0 26 2 0 85 5 - 0 - ? 00:00:00 ksmd
1 S 0 27 2 0 99 19 - 0 - ? 00:00:00 khugepaged
1 S 0 28 2 0 60 -20 - 0 - ? 00:00:00 crypto
1 S 0 29 2 0 60 -20 - 0 - ? 00:00:00 kintegrityd
1 S 0 30 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 31 2 0 60 -20 - 0 - ? 00:00:00 kblockd
1 S 0 32 2 0 60 -20 - 0 - ? 00:00:00 ata_sff
1 S 0 33 2 0 60 -20 - 0 - ? 00:00:00 md
1 S 0 34 2 0 60 -20 - 0 - ? 00:00:00 devfreq_wq
1 S 0 35 2 0 80 0 - 0 - ? 00:00:00 kworker/u6:1
1 S 0 38 2 0 80 0 - 0 - ? 00:00:00 kswapd0
1 S 0 39 2 0 60 -20 - 0 - ? 00:00:00 vmstat
1 S 0 40 2 0 80 0 - 0 - ? 00:00:00 fsnotify_mark
1 S 0 41 2 0 80 0 - 0 - ? 00:00:00 ecryptfs-kthrea
1 S 0 57 2 0 60 -20 - 0 - ? 00:00:00 kthrotld
1 S 0 58 2 0 60 -20 - 0 - ? 00:00:00 acpi_thermal_pm
1 S 0 59 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 60 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 61 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 62 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 63 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 64 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 65 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 66 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 67 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 68 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 69 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 70 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 71 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 72 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 73 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 74 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 75 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 76 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 77 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 78 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 79 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 80 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 81 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 82 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 83 2 0 80 0 - 0 - ? 00:00:00 scsi_eh_0
1 S 0 84 2 0 60 -20 - 0 - ? 00:00:00 scsi_tmf_0
1 S 0 85 2 0 80 0 - 0 - ? 00:00:00 scsi_eh_1
1 S 0 86 2 0 60 -20 - 0 - ? 00:00:00 scsi_tmf_1
1 S 0 91 2 0 60 -20 - 0 - ? 00:00:00 ipv6_addrconf
1 S 0 105 2 0 60 -20 - 0 - ? 00:00:00 deferwq
1 S 0 106 2 0 60 -20 - 0 - ? 00:00:00 charger_manager
1 S 0 108 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 110 2 0 60 -20 - 0 - ? 00:00:00 bioset
1 S 0 171 2 0 80 0 - 0 - ? 00:00:00 kworker/2:2
1 S 0 257 2 0 60 -20 - 0 - ? 00:00:00 kpsmoused
1 S 0 276 2 0 80 0 - 0 - ? 00:00:00 kworker/0:2
1 S 0 546 2 0 60 -20 - 0 - ? 00:00:00 kworker/0:1H
1 S 0 548 2 0 80 0 - 0 - ? 00:00:00 jbd2/sda1-8
1 S 0 549 2 0 60 -20 - 0 - ? 00:00:00 ext4-rsv-conver
1 S 0 560 2 0 60 -20 - 0 - ? 00:00:00 kworker/2:1H
1 S 0 589 2 0 80 0 - 0 - ? 00:00:00 kauditd
4 S 0 593 1 0 80 0 - 7443 - ? 00:00:00 systemd-journal
4 S 0 635 1 0 80 0 - 11312 - ? 00:00:00 systemd-udevd
1 S 0 1101 2 0 60 -20 - 0 - ? 00:00:00 iprt-VBoxWQueue
4 S 100 1110 1 0 80 0 - 25596 - ? 00:00:00 systemd-timesyn
1 S 0 1302 2 0 60 -20 - 0 - ? 00:00:00 kworker/1:1H
1 S 0 1464 2 0 60 -20 - 0 - ? 00:00:00 ttm_swap
4 S 0 1634 1 0 80 0 - 9444 - ? 00:00:00 cron
4 S 109 1636 1 0 80 0 - 91157 - ? 00:00:00 whoopsie
4 S 0 1638 1 0 80 0 - 7157 - ? 00:00:00 systemd-logind
0 S 0 1643 1 0 80 0 - 1100 - ? 00:00:00 acpid
4 S 0 1649 1 0 80 0 - 71238 - ? 00:00:00 accounts-daemon
4 S 0 1653 1 0 80 0 - 56870 - ? 00:00:00 snapd
4 S 106 1675 1 0 80 0 - 11022 - ? 00:00:00 dbus-daemon
4 S 0 1744 1 0 80 0 - 132990 - ? 00:00:00 NetworkManager
4 S 104 1747 1 0 80 0 - 64099 - ? 00:00:00 rsyslogd
4 S 111 1753 1 0 80 0 - 11197 - ? 00:00:00 avahi-daemon
4 S 0 1759 1 0 80 0 - 84346 - ? 00:00:00 ModemManager
4 S 0 1847 1 0 80 0 - 87593 - ? 00:00:00 lightdm
5 S 0 1848 1 0 80 0 - 4868 - ? 00:00:00 irqbalance
1 S 111 1850 1753 0 80 0 - 11197 - ? 00:00:00 avahi-daemon
4 S 0 1853 1 0 80 0 - 68706 - ? 00:00:00 cups-browsed
4 S 0 1858 1 0 80 0 - 69684 - ? 00:00:00 polkitd
4 S 0 1884 1 0 80 0 - 6034 - ? 00:00:00 vsftpd
4 S 0 1902 1847 0 80 0 - 67517 - tty7 00:00:07 Xorg
4 S 0 1905 1744 0 80 0 - 4030 - ? 00:00:00 dhclient
4 S 65534 1918 1744 0 80 0 - 15409 - ? 00:00:00 dnsmasq
4 S 0 2085 1847 0 80 0 - 57059 - ? 00:00:00 lightdm
4 S 1000 2091 1 0 80 0 - 11303 ep_pol ? 00:00:00 systemd
5 S 1000 2093 2091 0 80 0 - 15902 - ? 00:00:00 (sd-pam)
4 S 1000 2096 2085 0 80 0 - 13751 poll_s ? 00:00:00 upstart
1 S 1000 2174 2096 0 80 0 - 10407 poll_s ? 00:00:00 upstart-udev-br
1 S 1000 2175 2096 0 80 0 - 10867 ep_pol ? 00:00:00 dbus-daemon
1 S 1000 2214 2096 0 80 0 - 10391 poll_s ? 00:00:00 upstart-dbus-br
1 S 1000 2216 2096 0 80 0 - 10391 poll_s ? 00:00:00 upstart-dbus-br
1 S 1000 2218 2096 0 80 0 - 12553 poll_s ? 00:00:00 upstart-file-br
1 S 1000 2221 2096 0 80 0 - 69742 poll_s ? 00:00:00 fcitx
1 S 1000 2225 2096 0 80 0 - 53571 - ? 00:00:00 gnome-keyring-d
1 S 1000 2238 2096 0 80 0 - 43873 - ? 00:00:00 gpg-agent
4 S 0 2260 1 0 80 0 - 6177 - tty1 00:00:00 agetty
1 S 1000 2263 2096 0 80 0 - 10725 ep_pol ? 00:00:00 dbus-daemon
1 S 1000 2270 2096 0 99 19 - 6909 poll_s ? 00:00:00 fcitx-dbus-watc
0 S 1000 2284 2096 0 80 0 - 1127 wait ? 00:00:00 sh
0 S 1000 2295 2284 0 80 0 - 82080 poll_s ? 00:00:00 xfce4-session
0 S 1000 2297 2096 0 80 0 - 11910 poll_s ? 00:00:00 xfconfd
0 S 1000 2305 2096 0 80 0 - 55231 poll_s ? 00:00:00 xfwm4
0 S 1000 2309 2096 0 80 0 - 70151 poll_s ? 00:00:00 xfce4-panel
0 S 1000 2311 2096 0 80 0 - 44770 poll_s ? 00:00:00 Thunar
0 S 1000 2313 2096 0 80 0 - 116333 poll_s ? 00:00:00 xfdesktop
0 S 1000 2314 2295 0 80 0 - 80764 poll_s ? 00:00:00 xfce4-clipman
0 S 1000 2315 2295 0 80 0 - 156346 poll_s ? 00:00:05 docky
1 S 1000 2318 2096 0 80 0 - 93629 poll_s ? 00:00:00 xfsettingsd
0 S 1000 2322 2096 0 80 0 - 70846 poll_s ? 00:00:00 gvfsd
0 S 1000 2325 2295 0 80 0 - 133445 poll_s ? 00:00:00 light-locker
0 S 1000 2329 2295 0 80 0 - 156116 poll_s ? 00:00:00 update-notifier
0 S 1000 2332 2295 0 80 0 - 145994 poll_s ? 00:00:01 blueman-applet
0 S 1000 2333 2295 0 80 0 - 61282 poll_s ? 00:00:00 applet.py
1 S 1000 2336 2096 0 80 0 - 80433 poll_s ? 00:00:00 xfce4-power-man
0 S 1000 2338 2295 0 80 0 - 167782 poll_s ? 00:00:00 nm-applet
1 S 1000 2339 2096 0 80 0 - 113693 poll_s ? 00:00:00 xfce4-volumed
0 S 1000 2342 2096 0 80 0 - 101715 futex_ ? 00:00:00 gvfsd-fuse
0 S 1000 2344 2295 0 80 0 - 112642 poll_s ? 00:00:00 polkit-gnome-au
4 S 0 2359 1 0 80 0 - 89005 - ? 00:00:00 upowerd
0 S 1000 2365 2096 0 80 0 - 44633 poll_s ? 00:00:00 dconf-service
1 S 1000 2378 2096 0 69 -11 - 108894 poll_s ? 00:00:00 pulseaudio
4 S 117 2379 1 0 81 1 - 45886 - ? 00:00:00 rtkit-daemon
0 S 1000 2399 2096 0 80 0 - 84440 poll_s ? 00:00:00 at-spi-bus-laun
0 S 1000 2404 2399 0 80 0 - 10692 ep_pol ? 00:00:00 dbus-daemon
0 S 1000 2406 2096 0 80 0 - 51744 poll_s ? 00:00:00 at-spi2-registr
0 S 1000 2422 2309 0 80 0 - 111246 poll_s ? 00:00:00 panel-1-whisker
0 S 1000 2428 2309 0 80 0 - 42015 poll_s ? 00:00:00 panel-4-systray
0 S 1000 2429 2309 0 80 0 - 81273 poll_s ? 00:00:00 panel-5-power-m
0 S 1000 2430 2309 0 80 0 - 116543 poll_s ? 00:00:00 panel-6-indicat
0 S 1000 2446 2096 0 80 0 - 17597 poll_s ? 00:00:00 gconfd-2
0 S 1000 2451 2096 0 80 0 - 13721 poll_s ? 00:00:00 upstart
0 S 1000 2453 2451 0 80 0 - 106798 poll_s ? 00:00:00 indicator-messa
0 S 1000 2454 2451 0 80 0 - 168211 poll_s ? 00:00:00 indicator-sound
0 S 1000 2456 2451 0 80 0 - 98985 poll_s ? 00:00:00 indicator-appli
0 S 1000 2477 2096 0 80 0 - 73649 poll_s ? 00:00:00 gvfs-udisks2-vo
4 S 0 2480 1 0 80 0 - 91898 - ? 00:00:00 udisksd
0 S 1000 2494 2096 0 80 0 - 103144 poll_s ? 00:00:00 gvfs-afc-volume
0 S 1000 2500 2096 0 80 0 - 70163 poll_s ? 00:00:00 gvfs-gphoto2-vo
0 S 1000 2505 2096 0 80 0 - 67114 poll_s ? 00:00:00 gvfs-mtp-volume
0 S 1000 2510 2096 0 80 0 - 66623 poll_s ? 00:00:00 gvfs-goa-volume
0 S 1000 2518 2096 0 80 0 - 89922 poll_s ? 00:00:00 gvfsd-trash
0 S 1000 2525 2096 0 80 0 - 48726 poll_s ? 00:00:00 gvfsd-metadata
0 S 1000 2538 2096 0 80 0 - 37585 poll_s ? 00:00:00 obexd
1 S 0 2701 2 0 80 0 - 0 - ? 00:00:00 kworker/1:0
1 S 0 2793 2 0 80 0 - 0 - ? 00:00:00 kworker/u6:0
1 S 0 2797 2 0 80 0 - 0 - ? 00:00:00 kworker/2:0
1 S 0 2818 2 0 80 0 - 0 - ? 00:00:00 kworker/1:2
0 S 1000 2858 2096 0 80 0 - 108202 poll_s ? 00:00:00 xfce4-terminal
0 S 1000 2862 2858 0 80 0 - 3718 - ? 00:00:00 gnome-pty-helpe
0 S 1000 2863 2858 0 80 0 - 7830 wait pts/1 00:00:00 bash
5 S 65534 2885 1884 0 80 0 - 8670 - ? 00:00:00 vsftpd
5 S 1000 2887 2885 0 80 0 - 8676 - ? 00:00:00 vsftpd
1 S 0 2890 2 0 80 0 - 0 - ? 00:00:00 kworker/u6:2
0 R 1000 2895 2863 0 80 0 - 9421 - pts/1 00:00:00 ps
# 현재 사용되고 있는 모든 프로세스 현황을 볼수가 있으며 마지막 프로세스에 방금전 수행한 'ps' 명령어 떠 있는 것을 확인 할수가 있다.
// 그렇다면 저 프로세스들 중 하나인 독 프로그램인 'docky' 애플리케이션을 종료 해보도록 하자.
( 종료는 pid 번호를 활용 하며 명령어는 kill 이다.)
// 먼저 grep을 활용하여 docky 하나만을 확인하자.
$ ps -lea |grep docky
0 S 1000 2315 2295 0 80 0 - 156346 poll_s ? 00:00:06 docky
# 여기서 'docky'의 PID는 2315 이다.
// docky를 강제 종료해 보자.
$ kill -9 2315
(권한 문제로 종료 되지 않는 프로세스는 'sudo kill (pid)'로써 종료를 시도 하거난 루트 상태(sudo -s) 에서 종료를 시도한다.)
// 프로세스가 종료 되었는지 확인해 보자.
$ ps -lea |grep docky
# 아무것도 나오지 않는 다면 성공한 것이다.
지금까지 프로세스 확인 방법과 PID를 이용한 프로세스 종료 방법을 알아 보았다.
그렇다면 이번에는 좀 더 수월한 방법인 프로세스 이름을 활용하여 해당 프로세스를 종료 보도록 해 보겠다.
// 'killall' 명령을 사용하여 해당 프로세스를 종료 시킨다.
$ killall -9 docky
# 아무것도 나오지 않는 다면 성공한 것이다.
// 만약 killall이 수행 되지 않는다면 'psmisc'패키지를 설치 해야 한다.
$ sudo apt install psmisc
도움이 되셨다면 '♡' 버튼을 꼭눌러 주시면 감사 하겠습니다.
'리눅스 기초 가이드 > UNIX 시스템 ' 카테고리의 다른 글
[ 리눅스 시스템 가이드] 리눅스를 이용한 하드 디스크 완전삭제 정말 가능할까? (실험) (0) | 2017.05.23 |
---|---|
[리눅스 가이드] 리눅스 터미널(콘솔)에서 자동완성 기능을 활용하자. (0) | 2017.02.20 |
[리눅스 가이드] awk 프로그래밍 가이드 1 - 텍스트 파일의 열 불러오기 (0) | 2016.12.19 |
[유닉스 기초] 리눅스에서 '환경 변수' 란? 매우 이해하기 쉬운 강의 (0) | 2016.09.14 |
[리눅스 가이드] 리눅스 콘솔 CLI를 등재하는 TTY 에 대해서 간단하게 배워 봅시다. (0) | 2016.08.11 |