root@hhan:~# xmms &
Untuk memonitor proses-proses yang sedang berjalan pada system dapat menggunakan ps dan top.
- ps
ps yang merupakan kependekan dari “process snapshot” digunakan untuk meng-capture proses yang sedang berjalan. Untuk melihat semua proses pada system penggunkaanya adalah seperti berikut:
root@hhan:~# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 156 76 ? S 11:37 0:01 init [5]
root 2 0.0 0.0 0 0 ? SN 11:37 0:00 [ksoftirqd/0]
root 3 0.0 0.0 0 0 ? S< 11:37 0:00 [events/0]
root 4 0.0 0.0 0 0 ? S< 11:37 0:00 [khelper]
root 9 0.0 0.0 0 0 ? S< 11:37 0:00 [kthread]
root 24 0.0 0.0 0 0 ? S< 11:37 0:00 [kacpid]
hhan 3408 0.1 6.1 27448 15652 ? S 11:39 0:10 kdeinit: konsole
root 3428 0.0 1.3 4748 3548 pts/1 S 11:39 0:00 bash
root 3932 0.0 1.3 4748 3532 pts/2 S+ 13:40 0:00 bash
root 3985 1.1 3.3 49984 8600 pts/1 Sl 13:49 0:02 xmms
root 4360 0.0 0.3 2564 856 pts/1 R+ 13:52 0:00 ps aux
Terdapat 10 kolom yang ditampilkan dari perintah diatas, dengan masing-masing kolomnya adalah sebagai berikut:
USER : User yang menjalankan proses tersebut.
PID : Process ID.
%CPU : Besarnya penggunakan CPU sebuah proses.
%MEM : Besarnya penggunakan memory sebuah proses (dalam kB).
VSZ : besarnya penggunakan virtual memory.
RSS : Penggunakan memory yang resident oleh proses.
TTY : Terminal (tty), asal dari proses dijalankan.
STAT : Keadaan/status suatu proses.
- R : running process
- S : sleeping process
- I : idle process
- Z : Zombie process
- D : uninteruptable sleep
- < : high priority process
- N : low priority process
START : waktu proses mulai dijalankan.
TIME : lama proses telah berjalan.
COMMAND : perintah yang dijalankan.
Untuk melihat proses-proses yang dijalankan oleh satu user tertentu saja dapat menggunakan perintah ps yang dimodifikasi seperti berikut ini :
root@hhan:~# ps -U hhan
Dengan perintah seperti di atas maka hanya proses-proses yang dijalankan oleh hhan saja yang akan ditampilkan.
- top
Fungsi dari perintah top hampir sama dengan perintah ps, perbedaanya adalah perintah top meng-capture proses-proses pada system secara real time. Interval waktu peng-capture-an dapat ditentukan sesuai yang diinginkan. Kelemahan top dibandingkan dengan ps adalah, top lebih banyak memakan memory dibandingkan dengan ps. Adapun penggunakan perintahnya adalah seperti berikut :
root@hhan:~# top
top -14:01:00up 2:23, 1 user, load average: 0.03, 0.11, 0.06
Tasks: 59 total, 1 running, 58 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.4% us, 1.2% sy, 0.0% ni, 96.5% id, 1.0% wa, 0.0% hi, 0.0% si
Mem: 255124k total, 210572k used, 44552k free, 42404k buffers
Swap: 0k total, 0k used, 0k free, 92484k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3283 root 5 -10 64272 13m 2136 S 1.2 5.3 0:49.63 XFree86
3985 root 15 0 49984 8616 5776 S 1.0 3.4 0:07.20 xmms
3408 hhan 15 0 27688 15m 12m S 0.2 6.2 0:12.73 kdeinit
1 root 16 0 156 76 52 S 0.0 0.0 0:01.36 init
2 root 34 19 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/0
3 root 10 -5 0 0 0 S 0.0 0.0 0:00.06 events/0
4 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khelper
Untuk mengubah interval waktu, tekan “d” kemudian tuliskan interval yang diinginkan dalam detik. Untuk memunculkan bantuan tekan “h” kemudian akan muncul seperti di bawah :
Help for Interactive Commands - procps version 3.2.4
Window 1:Def: Cumulative mode Off. System: Delay 3.0 secs; Secure mode Off.
Z,B Global: 'Z' change color mappings; 'B' disable/enable bold
l,t,m Toggle Summaries: 'l' load avg; 't' task/cpu stats; 'm' mem info
1,I Toggle SMP view: '1' single/separate states; 'I' Irix/Solaris mode
f,o . Fields/Columns: 'f' add or remove; 'o' change display order
F or O . Select sort field
<,> . Move sort field: '<' next col left; '>' next col right
R . Toggle normal/reverse sort
c,i,S . Toggle: 'c' cmd name/line; 'i' idle tasks; 'S' cumulative time
x,y . Toggle highlights: 'x' sort field; 'y' running tasks
z,b . Toggle: 'z' color/mono; 'b' bold/reverse (only if 'x' or 'y')
u . Show specific user only
n or # . Set maximum tasks displayed
k,r Manipulate tasks: 'k' kill; 'r' renice
d or s Set update interval
W Write configuration file
q Quit
( commands shown with '.' require a visible task display window )
Untuk kembali ke tampilan awal tekan “q”, kemudian tekan “q” sekali lagi untuk keluar dari top.
- Init Proses
Init merupakan proses yang pertama kali akan dijalankan oleh system, setelah system menjalankan init maka init sendiri akan menjalankan proses-proses lain yang dijalankan pada saat booting. Init sendiri menjalankan proses-proses berdasarkan file konfigurasinya yang terdapat pada /etc/inittab. Berikut ini merupakan isi dari file /etc/inittab yang terdapat pada linux auditor security :
# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.9 2001/05/3110:37:50knopper Exp $
# The default runlevel.
id:5:initdefault:
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS
# What to do in single-user mode.
~~:S:respawn:/bin/bash -login >/dev/tty1 2>&1
# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
l6:6:wait:/etc/init.d/rc 6
# What to do when CTRL-ALT-DEL is pressed.
ca::ctrlaltdel:/sbin/shutdown -r now
# Action on special keypress (ALT-UpArrow).
kb::kbrequest:/bin/echo "Keyboard Request -- edit /etc/inittab to let this work."
# What to do when the power fails/returns.
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
#: : :
1:12345:respawn:/sbin/getty 38400 tty1
2:2345:respawn:/sbin/getty 38400 tty2
3:2345:respawn:/sbin/getty 38400 tty3
4:2345:respawn:/sbin/getty 38400 tty4
5:2345:respawn:/sbin/getty 38400 tty5
6:2345:respawn:/sbin/getty 38400 tty6
# Example how to put a getty on a serial line (for a terminal)
#
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3
#-- isdnutils begin
# Change the lines below for your local setup and uncomment them.
# Use "init q" to reread inittab.
# look at the vboxgetty / mgetty manpage for more information (mgetty isn't
# standard!)
#
#I0:2345:respawn:/usr/sbin/vboxgetty -d /dev/ttyI0
#I1:2345:respawn:/sbin/mgetty -D -m '"" ATZ OK AT&Eyourmsnhere OK AT&B512 OK' -s 38400 ttyI1
#-- isdnutils end
# Run X Window session from CDROM in runlevel 5
#w5:5:wait:/bin/sleep 2
#x5:5:wait:/etc/init.d/xsession start
No comments:
Post a Comment