Xem các process của user hiện hành ps hoặc ps -l ny inane iy aman Spe eran 1 ybuntu@ubuntut: ~ | STAT TIME COMMAND 13 6:61 /sbin/init BÊ tosendkeyetrehes ene 5 t pe Login to th
Trang 1
INDUSTRIAL
TRƯỜNG ĐẠI HỌC CÔNG NGHIỆP TP HÒ CHÍ MINH
KHOA: CÔNG NGHỆ THÔNG TIN
QSITY OF y
Zz z\
LAB REPORT
Student’s Name : Trần Phan Hải Nam
Student’s Code : 23634491
Subject(Môn) : Hệ Thống Máy Tính
Faculty : Công Nghệ Thông Tìn
Completed Date : 15/03/2024
Trang 2
NHẬN XÉT CUA GIANG VIEN HUONG DAN
Diém lab report:
Trang 3
PHẢN BÀI LÀM THỰC HÀNH -
(SV chụp màn hình thực hành các bước của các yêu cầu và giải thích kêt quả)
Quan ly tien trinh (Process Management) - -
1 Sử dụng lệnh top đề xem thông tin về các tiên trình, và thông tin chung của hệ thông
mM The Help | IP ] © 2 Baus
—: X | @ nem C] My Conputer TS bumeu
2 Sử dụng lệnh ps đề xem thông tin về các tiền trình
a Xem tât cả các process : (dạng cây)
pstree -a
+2 EB +) +: g# |^
Trang 4
b Xem tiến trình cha (tô tiên) của lệnh ps vừa thực thi : xem cột PID, PPID
ps -elJH |more
‘are Workstation = o x
aM ee He 2 O29 DER S\A-
X | @ Home [2 My Computer [8 Ubuatu
= - 9 ubuntu@ubuntut: ~
z ubuntu@ubuntu1
IS oe eL]H |more
we) UID PID P PGID SID RI NI ADDR
Ps keystrokes are 5 movement, “Tstal Took: Tretall Tools Remind Me Later Never Reming Me
fe
c Kiém tra mét s6 dich vu da chạy chưa ? ( như cron, atd, sshd, )
ps -e |grep cron -
Ct
16 ubuntu@ubuntu1: ~
ubuntu@ubuntu1:~$ ps -e |grep cron
91202 00:00:00 ana
ubuntu@ubuntu1:~$ |
1
video and performance Log in to the quest operating system and click “Install Tools” Install Tools Remind Me Later =| Never Remind Me
a
el 3/15/2024 Sa
Trang 5
d Xem trạng thái của process (running, sleeping, ) : xem cột S
ps -elJH |more
.m>xnnnnwEcxs(GTavnfanaarwfEcsnø^Ez —
5STD
2 cœ
ksoftirgd,/s
kworker/y/o:0H
2 c CS)
migqgrations1
ksoftiraqgd/sy/1
Install Tools Remind Me Later Mever Remind Me
XI - h2
xe TT —=. —
e Xem các process của user hiện hành
ps hoặc ps -l
ny inane iy aman Spe eran
1 ybuntu@ubuntut: ~
|
STAT TIME COMMAND
13 6:61 /sbin/init
BÊ tosendkeyetrehes ene 5 t pe Login to the guestoperabng “Install Tools”, Insta Tools| Remind Me Later | Never Remnd Me
Trang 6
£ Mở một termminal mới (tty2), login vao bang tài khoản userl Chạy vi
a x
9 aa Bas bị L7‹
ly Computer & Ubuntu
@ubuntu1:~$ | |
VIM - Vi IMproved Pre se ed
by Bram Mootenaar et aL
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Vim is open source and freely distributable HeLp poor cht+tdren tn Uganda!
type :heLp tccf or tnfornatton
seLp verston7 for verston tnfo Running in VL compatible m
3 PT aay for Vtm defauLts
type :heLp cp-defautt for tnfo on this
FEE yanare Tools enables many features and improves mouse movement, video and performance Log n to the guest operating system and click “Install Tools” Install Tools Remind Me Later Never Remand Me
1
top - 13:42:33 up 47 min, 3 users, load average: 0,07, 0,06, 0,05
Tasks: 187 total, 1 running, 186 sleeping, ® stopped, 8 zonbie
MCpu(s): 252 us, 9,7 sy, ©,0 nt, 97,0 1d; 9,8 wa, 6,8 hL, 9,2 sỉt,
KLB Mem: 2063840 total, 1074000 used, 989840 free, 82048 buffers
KiB Swap: 1046524 total, © used, 1046524 free 566036 cached Mem
PID USER VIRT RES SHR S %CPU X%MEM TIME+ COMMAND
1996 ubuntu 318360 91500 35736 S 6,0 4,4 -03 compiz
1072 root 175824 43516 12156 S a ly fas ae -91 Xorg
2007 ubuntu 209552 24880 19376 S O54 04,2 -58 nautilus
root 29 9 4456 2488 1424 S 0,0 0,1 -15 init
root $ 2 (3) () 9 5S 0,0 0,0 99 kthreadd
root 2 9S 0,0 0,0 -47 rcu_sched
woves mouse movement, video and performance Log in to the quest operating system and click “Install Tools" Install Tools Remind Me Later Never Remind Me
& [2
42 PM 3/15/2024
1 VIE
Trang 7
Trên terminal của root, dùng lệnh:
ps -a /ñhiện thị các process đang chạy trên các terminal hay
x nam1@ubuntu1: /home/ubuntu * _
ubuntu@ubuntu1:~$ su nami
Password:
nam1@ubuntu1: /home/ubuntu§$ ps -a
3932 pts/4 90:00:09 su
3933 pts/4 00:00:00 bash
3945 pts/4 00:00:00 ps
nam1@ubuntu1: /home/ubuntuS |
ent, video and performance Log in to the quest operating system and click “Install Tools” Install Tools Remind Me Later Never Remind Me
n thi cac proces ay trén cac terminal va chu nhan
ul: ome /ubuntu a
PID PPID C STIME TIME CMD
3932 3885 0 13:44 00:00:00 su nami
3933 3932 0 13:44 96:60:66 bash
3946 3933 0 13:44 00:00:00 ps -af
nami@ubuntu1: /home/ubuntu$ R
¡ and performance Log in to the guest operating system and click “Install Tools” Install Tools Remind Me Later Never Remind Me
QO D
1:45 PM
M3
ml 3/15/2024 oe)
Trang 8
3 Sử dụng lệnh kill và killall
a Xem đanh sách các SIGNAL của lénh kill kill -1
v
® - + ubuntu@ubuntu1:~
ubuntu@ubuntu1:~$ kill -1
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec or kill
~L [sigspec]
ubuntu@ubuntu1:~$ ktLLaLL
Usage: killall [OPTION] [ ] NAME
kLLLaLL -L, list
killall -V, version
-e, exact require exact match for very long names
-I, ignore-case case insensitive process name match
-g, process-group kill process group instead of process
-y, younger-than kill processes younger than TIME
-0, older-than kill processes older than TIME
interactive ask for confirmation before killing
list list all known signal names
don't print complaints regexp interpret NAME as an extended regular expression
gnal SIGNAL send this signal instead of SIGTERM
user USER kill only process(es) running as USER
verbose report if the signal was successfully sent
verston display version information
i wait for processes to die
jubuntu@ubuntu1:~$ |
~
coves mouse movement, video and performance Login to the guest operating system and dick “Install Tools” Install Tools Remind Me Later | Never Remind Me
1:4 7 PM
al NG 3/15/2024 có
b Xem ý nghĩa của 4 SIGNAL thường dùng (đọc manual)
SIGHUP: số hiệu 1: trì hoãn việc kiêm tra tren quan li terminal hoặc sự dừng của quản lí tiền trình
SIGNT: số hiệu 2: Được thông báo nếu người dùng sử dụng tín hiệu ngứt ( Ctrl+C)
SIGQUIT: số hiệu 3: Được thông báo nêu người dùng gửi một tin higu bo ( Ctrl+D)
SIGFPE: số hiệu 8: Được thông báo nếu một hoạt động thuộc vẻ toán không hợp phát được thử
chạy
c Chạy lệnh sau và thực hiện theo yêu cầu
find/ -name "cron*"
Trang 9
© Khi lệnh đang thực thi, nhân Ctrl_Z để dừng tiến trình
Ubuntu Desktop ty Boy) +2oo 1 |^
Petar ìnd -name "cron*
Perret tity
6
d
=
5
B
=
%
#5
wallpaper
Pre) ie eee el meme FL d8974ad893af7f8ca27
Tes]
unity/ftrst_run.stamp
/conpizconfig
sq Cldkin the virtual screen
PP sen keystrokes "a
h 9 © Ð @©== “Ñ rT | 1
o Kiém tra bang lệnh ps -Ì xem lệnh còn hoạt động không ? (Tiên trình ứng
PID nào? Ở trạng thái gì?)
“=—
T TIME COMMAND
9:01 /sbtn/tntt
vement, video and performance Log in to the guest operating system and cỉck "Install Tools” Install Tools Remind Me Later Never Remind Me
HOR L7 2:01 PM
CẢ J h7)
#1 VE
o_ Châm dứt hoạt động của tiền trình fnd băng lệnh sau có được không?
" kill -SIGTERM<PID fñnd>
ubuntu@ubuntu1:~$ kill -SIGTERM < PID_find>
bash: syntax error near unexpected token ‘newline’
ubuntu@ubuntu1: ~$ or :
uest operating system and click "Install Tools” Install Tools Remind MeLater Never Remind Me
Trang 10
« (kiêm tra lại bằng lệnh ps)
ubuntu@ubuntu1:~$ ps
PID TTY TIME
3330 pts/Ð 00:00:00
4023 pts/0 00:00:00
ubuntu@ubuntu1:~$ |
est operating system and click “Install Tools” Install Tools Remind Me Later Never Remind Me
ey
|
- xố
o_ Châm dứt hoạt động của tiền trình fnd băng lệnh sau có được không?
" kill -SIGINT <PID_find>
ubuntu@ubuntu1:~$ kill -SIGINT <PID_find>
bash: syntax error near unexpected token `newLine '
ubuntu@ubuntu1:~S
Tools enables many features and improves
novement, video and performance Log in to the Install Tools Remind Me Later Never Remind Me
erating system and click “Install Tools”
Ctrl+G
2:06 PM
3
Fl 3/15/2024 aa
buntu@ubuntu1:~$ ps
eee me TTIME
buntu@ubuntu1:~$ R
Tools enables many features and improves
ovement, video and performance Log in to the Install Tools Remind Me Later Never Remind Me
erating system and dick “Install Tools”
2:06 PM M2
fl 3/15/2024 SG
Trang 11
o_ Chấm dứt hoạt động của tiến trinh find , bằng lệnh sau có được không ?
" kill -SIGKILL <PID_find>
ubuntu@ubuntu1:~$ kill -SIGKILL <PID_find>
bash: syntax error near unexpected token `newLine '
ubuntu@ubuntu1:~S
Ire Tools enables many features and improves
> movement, video and performance Log in to the Install Tools Remind Me Later Never Remind Me
operating system and click “Install Tools”
ss Ctrl+G
2:08 PM
Vi
= 3/15/2024 bơ
" (kiêm tra lại băng lệnh ps )
TIME CMD
3330 pts/0 00:06:96 bash
4028 pts/0 00:00:00 ps
ubuntu@ubuntu1:~$
>
'e Tools enables many features and improves
movement, video and performance Log in to the Install Tools Remind Me Later Never Remind Me
operating system and dick “Install Tools”
s Ctrl+G @ắt® B
2:08 PM +7)
FI 7 3/15/2024 Ì
d._ Dùng kil huỷ terminal hiện tại : Terminal hiện tại tương ứng với tiễn trình bash, vậy nên huỷ termmal hiện tại có nghĩa là hủy tiên trinh bash => ket qua 1a sé ket thuc bash, và quay lại tiên trinh login (thây xuât hiện dâu nhac login)
š Hãy việt lệnh hủy tiên trình bash băng lệnh kill?
ubuntu@ubuntu1:~$ kill
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec or kill
-l [sigspec]
ubuntu@ubuntu1: ~$ H
*ˆ '® #X“ rs
in to the guest operating system and dick “Install Tools” Install Tools Remind Me Later Never Remind Me
2:10 PM
|
ao 3/15/2024 ac
Trang 12
Dùng killall huỷ tất cả các bash shell hiện tại trong | terminal :
-l [sigspec]
ubuntu@ubuntu1:~$ killall
Oil
killall -l,
kLLLaLL -V,
-e, eXact
-I, ignore-case
-g, process-group
younger -than
-0, older-than
-i, interactive
-L, LLst
-q, qutet
-r, regexp
-S, Signal SIGNAL
-u, user USER
killall [OPTION] [ ] NAME
list version require exact match for very long names case insensitive process name match kill process group instead of process kill processes younger than TIME kill processes older than TIME
ask for confirmation before killing
list all known signal names don't print complaints interpret NAME as an extended regular expression send this signal instead of SIGTERM
kill only process(es) running as USER
¬ -v, verbose
-V, version
-w, wait
report if the signal was successfully sent display version information
wait for processes to die
Install Tools Remind Me Later Never Remind Me
EQ © +2 B
Pa
a ees 3/15/2024 ae
o Trén terminal ttyl , login vao hé thong voi userl
o_ Dùng lệnh su, chuyên sang dùng quyền của user2
x nam1@ubuntu1: /home/ubuntu
ubuntu@ubuntu1:~$ su nam1
Password:
nami@ubuntu1:/home/ubuntus ff
‘and performance Log in to the guest operating system and click “Install Tools” Install Tools Remind Me Later Never Remind Me
E) © ®% L2
4
bd aaa oy ^ var Ue 3/15/2024 a)
Trang 13o_ Tiệp tục , dùng lệnh su, chuyển sang dùng quyền của user3
ubuntu@ubuntu1:~$ su nam3
Password:
nam3@ubuntu1: /home /ubuntuS
in to the guest operating system and dick “Install Tools” Install Tools Remind Me Later = Never Remind Me
@©1 DB
2:16 PM 3/15/2024 oa
o Xem toan bộ các tiên trình phát sinh sau chuỗi lệnh trên
" ps -alJH | grep tty
¢ Dé kill tat cả các bash shell hiện tại (trong 1 terminal) , dùng lệnh
kill -SIGKILL <PID_ của shell gốc trên cùng>
tinal File Edit View Search Terminal Help ty Bl 4) 1430 x]
30:55 up 1:35, 3 users, load average:
st: E Ee cohe) 1 running, 184 sleeping, X
8,8 us, 0,9 sy, 0,9 n†1,100,9 1d, 0,9 wa, ubuntu@ubuntu1: ~
2063840 total, 1072440 used, 991400 free, ee
i
Tre eo ® used, 1046524 free 566144 cached Mery kiLL [-s sigspec | -n signun | -sigspec] ptd | jobspec
1072
found
ubuntu@ubuntu1:~$ kill 1072
“bash: kill: (1072) - Operation not permitted D40 Qui lái Š$ k†LL -SIGKILL < co
bash: syntax error_near unexpected token
a ubuntuqubuntu1:~$ |
h
a
VEIT” aware Toate enables many features andimpraves mouse moverent, video and performance Login to the guest enerating system and dick “tal Took tretalTode | | Remind MeLater | Never Remind Me
Trang 14
< Dé kill tat cả các bash shell hiện tại trên tất cả các terminal, dùng
killall -SIGKILL bash
4 Tim hiéu dich vu lap lich cron:
a Lap lich dé mỗi phút ghi một chuỗi vào file test , Thao tác như sau :
o Dùng quyền của root, mở ñle /etc/crontab bằng vi hoặc nano Nhập vào cuối
file dòng sau :
**# # * root echo “hello” >> /test.fxt
l-|@(/9aaiDeacs BEjIĐ-
me =] My Computer [2 Ubuntu
® - - root@ubuntu1: /home/ubuntu
GNU nano 2.2.6 File: /etc/crontab Modified
(cả / ak run-pa
CS“ ko
rg Get Help & cat f Read File Prev Page Cut Text Cur Pos
353 arte 1 a Next Page MU UnCut | Ñ (13)
v
nhi VHware to “instal Tools’, Instal Tools Remnd Me Later | Never Remnd Me
Trang 15
o Kiểm tra bằng cách: chờ vài phút trôi qua, roi m6 file test.txt dé xem Hoặc
chính lại đồng ho hệ thông rồi xem lai file
- o xX
Hp | H-~ 2 2282 DE ÊE [4 -
đầy Here I My Computer y! Ubuntu
" other crontab you don’t have to run the ‘crontab’
# LL the new version when you edit this file
¬ : iles also have usernane fields,
_ bin/sh
/local/sbin: /us
EB /cron.weekLy }
526 1** root
See t /etc/cron.monthly )
^
b /crontab" 15 1tnes,
CXkínthe wrbual sree" | vuyyuẹ to send keystrokes = many use movement, loon 1d chck “Inatal Too” Install Tools | RemndMeLater | Never Remnd Me
& or precc CÍ