You are on page 1of 504

ti nghin cu khoa hc v pht trin cng ngh cp nh nc

kc - 06 - 03 cn

trin khai ph cp h iu hnh linux-vn


cho

my tnh thng hiu vit nam

C quan ch tr: Cng ty CP My tnh v Truyn thng Vit Nam n v thc hin: Trung tm ng dng Cng ngh Tin hc II Cng ty in t Cng nghip - CDC

H Ni Thng 9 nm 2004

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Mc lc

Phn GII THIU ........................................................................................................... 1 1. M u .........................................................................................................................1 2. Mc tiu v ni dung ca n ...................................................................................5 Phn I - NGHIN CU XUT H IU HNH CHO MY TNH VIT NAM V MT S CNG C TIN CH M BO QUYN S HU TR TU V KH NNG PH CP TRONG NC (Chuyn 3.1)......................... 7 I.1. Giy php s hu cng cng GPL v kh nng thc hin ti Vit Nam...................9 I.2. Kh nng php l cho vic pht trin H iu hnh my tnh Vit Nam da trn m ngun m ca Linux. .........................................................................................15 I.3. Cc vn kinh doanh H iu hnh da trn m ngun m.................................18 Phn II - NGHIN CU GII PHP PHN MM CHO A H IU HNH TRN MY TNH VIT NAM, TRONG C H IU HNH CH L LINUX-VN (Chuyn 3.2)..................................................................... 19 II.1. Kh nng Dual Boot a h iu hnh my tnh trong c Linux........................21 II.2. Cc vn sng chung gia Linux v Windows ...................................................21 II.3. Qui trnh ci t Embedded Linux-VN OS trn cc my tnh Vit Nam ..............27 Phn III - nghin cu gii php phn cng cho a h iu hnh trn my tnh vit nam, trong h iu hnh ch l linux-vn (Chuyn 3.3).................................................................... 31 III.1. C s v gii php phn cng................................................................................31 III.2. Gii php B chn a cng ..................................................................................36 III.3 Th nghim v Khuyn ngh s dng ....................................................................45 Phn IV - XY DNG CHNG TRNH V CC BIN PHP TRIN KHAI PH CP LINUX-VN TRONG CC C QUAN NH NC V TRONG O TO (Chuyn 3.4)............................................................ 49 IV.1. Cc bin php trin khai ph cp h iu hnh Linux-VN ..................................51 IV.2. Chng trnh khung ca cc chng trnh o to ph cp Linux ......................52 trong mi trng cc C quan, Doanh nghip Vit Nam ..............................................52 IV.3. Kh nng ph cp Linux-VN trong mi trng sinh vin v cc trng i hc 58 Phn V - TM TT KT QU NGHIN CU V KIN NGH ........................... 64 Phn TI LIU o to ph cp Linux-VN (Chuyn 3.5) ..................................... 65 Hng dn ci t H iu hnh Linux-VN Linux-VN - Cc lnh c bn Giao din ha GNOME Hng dn s dng StarOffice

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

PHN GII THIU

1. M u

Trong vi nm gn y, khi cc nhm nghin cu v Linux u tin ti Vit Nam c hnh thnh, xut hin nhiu kin khc nhau v vic Vit Nam c nn u t pht trin h iu hnh ring da trn Linux thay th cho h iu hnh Windows hay khng? n nay, cn c nhiu quan im cha thng nht, nhng nhng xu th pht trin ca Linux trn th gii l khng th ph nhn c. Theo nh gi ca gii chuyn mn, Phn mm ngun m (PMNM) vi nn tng l h iu hnh Linux l mt phong tro tin cy ang pht trin rt nhanh. S lng cc PMNM ngy cng nhiu v tng theo hm m. C th lit k mt s sn phm chnh nh sau: - Cc h iu hnh Linux, NetBSD v FreeBSD. Trong Linux dnh c s tham gia pht trin ca cng ng quc t, cn NetBSD v FreeBSD do i hc Berkeley, Hoa k pht trin. - Tp hp cc sn phm GNU ca FSF do Richard Stallman ch tr, pht trin c bit l trnh bin dch GNU C/C++. - Mt lot ngn ng lp trnh (nh Perl, Python, ) cht lng cao. - Cc my ch Web (nh Apache,). - Cc my ch proxy (nh squid,). - Cc h qun tr c s d liu quan h (nh MySQL, Postgres, ). - Cc h pht trin cc trang web nh HTML, XML, - Phn mm SAMBA, cho php truy cp v thay i cc tp do Windows NT v Windows 2000 qun l v qun l min. - .. Trong thi gian qua, cc PMNM thng ch yu gn vi mi trng Unix v mng Internet. Do chng thng c hay dng trong cc my ch, trong cc my phn phi dch v v cha d liu bn trong cc h thng thng tin ca cc c quan v trn Internet. Ngy nay chng dn dn xm nhp vo cc my khch, c bit sau khi xut hin hng lot cc cng c vn phng cht
Phn Gii thiu Trang 1

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

lng cho cc ng dng chuyn nghip, trong c StarOffice, OpenOffice. Vi nhng phin bn sau ny, Sun Micro System thng mi ha StarOffice, nhng OpenOffice vn tip tc l PMNM. Linux tr thnh mt h iu hnh cho php thc hin cc ng dng vn phng theo cc chun thng dng trn th trng nh Word, Excel, Nhiu cng ty CNTT ln trn th gii ng h PMNM, nh IBM, HP, Mt phn do tc ng ca nhng cng ty ny, phn khc mun lm gim vai tr thng tr ca Microsoft, mt s cng ty khc cng a sn phm ca h chy c di Linux vi gi thp hn nhiu so vi cc sn phm tng t chy di cc h iu hnh s hu ring, nh cc h qun tr CSDL quan h Oracle v Informix, cc phn mm SAP, mi trng pht trin Delphi dInprise, cc cng c vn phng Corel, vn vn Cng c nhng sn phm thng mi cht lng rt tt, cho php m phng Windows di Linux v thc hin cc chng trnh vit cho mi trng Windows. S pht trin ca Linux ngy nay vt qua tm mt ca cc chuyn gia cng ngh. Nhiu nc xy dng chin lc pht trin Linux ti quc gia ca h, in hnh nht phi k n Trung quc. Chnh ph Trung quc chnh thc cng b d n pht trin mt h iu hnh ring cho Trung quc da trn Linux v t tn cho h iu hnh ny l Hng K, tn ting Anh l Red Flag, mt ci bin t bn Red Hat. D n H iu hnh Hng K ca Trung quc c pht trin da trn s hp tc gia Vin nghin cu phn mm (SRI - Software Rechearch Institute) thuc Vin Hn lm Khoa hc Trung quc (CAS - Chinese Academy of Science) v Trng i hc tng hp Bc kinh. Phin bn Red-Flag Linux 1.0 ra i ln u tin vo ngy 6-1-2000 nh du mt thi k mi ca Trung quc nm bt v lm ch c cng ngh h iu hnh. Bn Red-Flag Linux dnh cho ngi s dng bnh thng s ra mt cng chng vo gia nm 2000. S kin Trung quc cng b v h iu hnh v d nh s dng chng trong ton b cc c quan chnh ph gy ch rng ri ca d lun trn ton th gii. c hn 10000 trang Web trn th gii bnh lun v tranh ci v s kin "Red Flag Linux" ca Trung quc. Bn cnh Red-Flag, mt cng ty Linux khc l Turbo Linux bn a ha Linux v rt thnh cng trn th trng h iu hnh Trung quc. Theo cc s liu mi nht, s lng sn phm bn ra trn th trng Trung quc trong qu 2 nm 2000 ca Turbo Linux vt ln trn Microsoft, mt thng tin ng cho chng ta quan tm. Theo nh gi ca nhiu nh phn tch, vic chnh ph Trung quc tuyn b chnh thc bt buc s dng Linux trong cc c quan ca nh nc ch cn l vn thi gian. Sau nhng nm 2000, ngy cng nhiu doanh nghip hng v Linux: Bu in Hoa k, Yellow Cab, NASA, Ikea, Fujitec, Sony, Corel Computers, qun i v hi qun Hoa k, cc c quan Chnh ph ca i Loan, Cng ho Lin bang c, Digital Domain, Mercedes-Benz, Cisco, Netscape, IBM, Apple, Digital Equipment, tp ch Byte, Ring phn mm Apache chim 60% th phn my ch Web trn Internet. Cho n nm 2002, PMNM c dng trong:

Phn Gii thiu Trang 2

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

- 90% my ch tn min (Domain Name) Hoa k, 70% my ch th tn in t v 60% my ch web trn th gii dng PMNM. - Th trng Linux pht trin nhanh hn d bo, ln hng th nh vo nm 1999, trc ngi ta cho rng n 2002 hoc 2003 mi t c v tr ny. - n gia nm 2001, c 56% s doanh nghip ton cu s dng PMNM. - Trong cc c quan nh nc: n thng 6-2001, Php b Vn ha chuyn 400 my ch sang GNU/Linux, Tng Cc Thu quc gia, mt c quan m vn an ton v bo mt d liu c coi l quan trng hng u, cng chuyn 950 my ch sang h iu hnh NM. Trung quc v M-hic chun y cc bin php chuyn h thng my tnh ca tt c cc c quan hnh chnh sang Linux Hng K. - Chnh ph c cm dng cc sn phm Microsoft trong cc h thng my tnh nhy cm. Nhm gim st v bo v cc mng my tnh ca cc quc gia thnh vin, Cng ng chu u khuyn co cc t chc ca Cng ng v cc c quan cng quyn ca cc quc gia thnh vin khuyn khch cc d n dng phn mm c m ngun cng khai, v l cch duy nht bo m trong phn mm khng c cc ca sau (back doors). Ti khu vc Chu , PMNM v c bit l Linux, pht trin rt mnh. Theo d bo ca Cng ty IDC, th trng cc h iu hnh Linux ti Trung Quc s tng hn gp i v s t gi tr 41,9 triu USD vo nm 2008 v ti Nht Bn s t gi tr 105 triu USD vo nm 2007. T nhiu nm qua, chnh ph cc nc chu vn khuyn khch v ra sc y mnh vic nghin cu, p dng h m m. Thng 9/2003, Trung Quc mi hng Hewlett-Packard tr gip cng ty Hng K Linux iu hnh h Hng K Server 4 trn cc tuyn my ch. Cng ty Hewlett-Packard cng tha thun vi b Cng ngh Thng tin Trung Quc gip xy dng mt phng th nghim Linux vi kinh ph ln n gn 24 triu la. Thi Lan cng loan bo d nh thnh lp trung tm M M chu vi mc tiu t c chun mc chung cho cc nh lp trnh trong khu vc. Hin ti, cng ty Hewlett-Packard cng ty my tnh ln u tin trn th gii cung cp cc my vi tnh c nhn hot ng vi h iu hnh Linux. thng qua tuyn b ca Chi nhnh HewlettPackard ti Nht Bn v vic s khi s cung cp my vi tnh dng h Linux ti 12 th trng ch yu ca chu nh Trung Quc, Hng Kng, Nam Hn, Malaysia, Thi Lan, Singapore, i Loan, Philippines, Indonesia v Vit Nam. Nu d n ti chu thnh cng th cng ty Hewlett-Packard s m rng th trng my vi tnh h Linux sang Bc M v chu u trong tng lai. Trong mi trng thun li c to ra t pha cc chnh ph, Cng ty phn mm Red Flag ca Trung Quc v cng ty Miracle Linux ca Nht cng hp tc to nn h iu hnh Asianux. i ng nhng chuyn vin lm vic v c gim st ti trung tm pht trin Oracle - Beijing, Trung Quc. Khi hon thnh, Asianux c cng nhn l mt h iu hnh t chun cht
Phn Gii thiu Trang 3

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

lng ca h thng Linux ton cu. Asianux cn nhn c s ng h t pha AMD, Dell, HP, Langchao Nh vy, Asianux tr thnh h iu hnh Linux chun u tin cho chu . Tham gia vao tro lu , Hn Quc vn ang tip tc cc cuc ngoi giao thng lng vi ngi i din cho Asianux vi mong mun tham gia nghin cu v pht trin h iu hnh ny. Di tc ng ca cc ln sng pht trin v PMNM, cui nhng nm 90, u nhng nm 2000. Nhng nhm nghin cu u tin v Linux ti Vit Nam xut hin, hoc di dng t pht, hot trn c s nhng d n ca nh nc. Hi tho quc gia ln th nht v PMNM c t chc thng 12/2000 c xem nh mt ct mc nh du s xut hin chnh thc ca PMNM ti Vit Nam. Hai nm sau , Hi tho quc gia v PMNM ln th hai, thng 12/2002, c coi l bc chun b v nng cao nhn thc v PMNM. Hi tho quc gia v phn mm m ngun m t chc ti H Ni thng 12/2003 t ra Xy dng k hoch khung pht trin phn mm m ngun m ti Vit Nam, a vic pht trin phn mm m ngun m thnh mt trong cc d n pht trin CNTT trng im ti Vit Nam. Cho n trc nm 2003, nn cng ngh tin hc Vit Nam t c mt s kt qu nht nh trong ng dng v pht trin PMNM, nhng nhng kt qu phn nhiu vn l sn phm ca nhng hot ng mang tnh t pht. Quyt nh s 235/Q-TTg, ngy 2/3/2004 ca Th tng Chnh ph ph duyt D n tng th ng dng v pht trin phn mm ngun m Vit Nam giai on 2004-2008 mi chnh thc l im mc nh du vic bt u trin khai PMNM ti Vit Nam. Ti ''Din n Phn mm m ngun m (PMMNM) Chu ln th 3'' ti H Ni, B Khoa hc Cng ngh cho bit giai on 2003-2007, Vit Nam s u t 312 t ng cho vic ng dng v pht trin PMNM. C th, Vit Nam s hon thnh h thng tiu chun v ng dng v pht trin PMNM vo nm 2005 n nm 2007 tt c cc my tnh c nhn, mng my tnh mi ti cc c quan nh nc u ci t PMNM, tt c cc c s gio dc s dng PMNM trong ging dy, hc tp v PMNM s c s dng trong cc c s d liu ln, cc trang web, ng dng trong quc phng, an ninh. Vit Nam cng t k hoch xy dng cng ng PMNM, hnh thnh 30 doanh nghip kinh doanh v pht trin PMNM, ba trung tm v mt s c s nghin cu PMNM. S quyt tm ca chnh ph to ra cho nn cng ngh tin hc Vit Nam phi nhanh chng gii quyt mt lot cc vn khi pht trin PMNM, trong c vic xy dng v pht trin cc bin php ph cp h iu hnh Linux VN cho my tnh thng hiu Vit Nam. y cng l mt nhim v c t ra Trong khun kh ti KC-03-06, nhm gp phn a cc sn phm PMNM t cc nh cung cp ti ngi tiu dng.

Phn Gii thiu Trang 4

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

2. Mc tiu v ni dung ca n Mc tiu ca n: Nghin cu cc bin php nhm ph cp H iu hnh Linux-VN cho my tnh thng hiu Vit Nam t c s php l n cc ni dung chnh trong xy dng, pht trin H iu hnh cho my tnh Vit Nam da trn m ngun m ca Linux. Cc gii php v phn mm, phn cng, cc bin php t chc v cung cp dch v o to cn thit. Cho php cc H iu hnh Linux-VN hi cc tnh nng cn thit p ng nhu cu ca ngi tiu dng Vit Nam. Ni dung ca n n c chia thnh 5 chuyn : - Chuyn 3.1: Nghin cu xut H iu hnh cho my tnh VN v mt s cng c tin ch m bo quyn s hu tr tu v kh nng ph cp trong nc - Chuyn 3.2: Nghin cu gii php phn mm cho a h iu hnh trn my tnh Vit Nam, trong c h iu hnh ch l LINUX-VN - Chuyn 3.3: Nghin cu gii php phn cng cho a h iu hnh trn my tnh Vit Nam, trong h iu hnh ch l LINUX-VN - Chuyn 3.4: Xy dng chng trnh v cc bin php trin khai ph cp h iu hnh m ngun m Linux trong cc c quan nh nc Vit Nam v trong o to - Chuyn 3.5: Ti liu o to ph cp LINUX-VN

Phn Gii thiu Trang 5

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Phn Gii thiu Trang 6

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Phn I
NGHIN CU XUT H IU HNH CHO MY TNH VIT NAM V MT S CNG C TIN CH M BO QUYN S HU TR TU V KH NNG PH CP TRONG NC

(Chuyn 3.1)

Ni dung chnh: - Giy php s hu cng cng GPL v kh nng thc hin ti Vit Nam - Kh nng php l cho vic pht trin H iu hnh my tnh Vit Nam da trn m ngun m ca Linux. - Cc vn kinh doanh H iu hnh my tnh VN da trn m ngun m.

Chuyn 3.1 Trang 7

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Chuyn 3.1 Trang 8

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

I.1. Giy php s hu cng cng GPL v kh nng thc hin ti Vit Nam
I.1.1. Khi nim QUYN HN i vi phn mm

Khi mt ngi nhn c mt phn mm no , khng lin quan n phn mm ny l ca ai v c pht hnh th no, cc khi nim hay quyn hn sau c a ra bi Stallman. Phi nhn mnh y t quyn hn hiu theo ngha quyn t do (freedom). C tt c 4 loi QUYN c nh s t 0 n 3. Quyn 0: Quyn chy (run) phn mm vi y cc chc nng sn c ca phn mm ny. Quyn 1: Quyn nghin cu, tm hiu, phn tch, nh gi v nu cn c th iu chnh chng trnh cho thch hp. c c quyn ny, iu kin tin quyt l m ngun chng trnh phi m. Quyn 2: Quyn sao chp, phn tn cc bn sao ca chng trnh cho ngi khc. Quyn 3: Quyn thay i, sa cha, nng cp v a ra cc sn phm nng cp ny cho x hi nhm mc ch nng cao tnh s dng ca chng trnh. c c quyn ny, iu kin tin quyt l m ngun chng trnh phi m. So snh vi cc lut hin thi ca s hu tr tu, mt ngi khi mua mt phn mm c bn quyn, anh ta ch c ng mt quyn l Quyn 0 i vi sn phm, cc quyn cn li (t 1 n 3) l dnh ring cho ch s hu ca sn phm.
I.1.2. Phn loi phn mm

C nhiu cch phn loi phn mm. V d c th phn loi theo cch m phn mm c bn ra: min ph hoc c ph. Cng c th phn loi theo cch ng k bn quyn ca phn mm: phn mm c hoc khng c bn quyn (copyright). Chng ti s a ra y cch phn loi theo lut s hu tr tu phn mm, hay ni cch khc phn loi theo T do ca phn mm trn cc quan im ca GNU. Trn phng din tng th phn mm s c chia lm hai loi: Phn mm T do v Phn mm Khng T do (Free Software & None-Free Software). Phn mm T do l phn mm m ngi s dng hp php ca phn mm s c c 4 quyn t do nh nu phn trn. Cc phn mm khng l T do s thuc loi Khng T do.

Chuyn 3.1 Trang 9

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

a). Phn mm Khng T do (None Free Software) Cc phn mm Khng T do u l nhng phn mm c ch s hu v c bn quyn c ng k. Trong nhm cc phn mm Khng T do c th k tn mt vi loi phn mm nh sau: Phn mm Min ph (Freeware) - phn mm c pht hnh min ph. Tuy nhin thng thng ngi s dng ch c quyn hn 0 v 2 i vi phn mm ny. Phn mm Chia s (Shareware) - phn mm c pht hnh thng qua vic sao chp v ti xung t mng t do dng th nhng khi s dng phi ng k v np ph ng k s dng. Ngi s dng ni chung cng ch c quyn 0 i vi phn mm loi ny. Phn mm ng (Closed) - l phn mm c bn quyn hiu theo ngha thng thng. c c ng k, ngi s dng phi tr tin trc v ch c ng mt quyn l Quyn 0 i vi phn mm (tu theo tng hng v tng sn phm, cc quyn ny c th thay i i cht nhng nhng nt chnh l khng thay i). b. Phn mm T do (Free Software) Trong cc phn mm T do li c chia lm hai loi: phn mm Khng ng k Bn quyn (not copyrighted) v phn mm C ng k Bn quyn (copyrighted). Phn mm T do khng ng k bn quyn thng c gi l Phn mm Cng cng (Public Software). Chng ta s c bit quan tm n nhm cc phn mm T do C ng k Bn quyn. Nhm ny c gi l Free Copyrighted Software, Linux l phn mm trong nhm ny. Gi s mt phn mm S nm trong nhm ny (T do C Bn quyn), khi phn mm S ny c tung ra th trng, c th min ph hoc c ph, nhng iu kin ti thiu ca n bao gm: - y l phn mm c tc gi v c ng k bn quyn, khng ai c tc ot i quyn ny t tay tc gi hoc bn hng (iu kin Copyrighted). - Phn mm ny bt buc phi thuc loi m ngun m, tc l khi chuyn giao sn phm phi bao gm ton b m ngun b ng cho ngi mua (iu kin Free). - Khi mt khch hng A mua sn phm phn mm S, khch hng A ny s phi c tt c cc quyn hn t 0 n 3 i vi sn phm ny (iu kin Free). Khi khch hng A c quyn 2 i vi sn phm S, A c quyn chuyn giao, sao chp phn mm S (c th sau khi thay i bn thn S) cho mt
Chuyn 3.1 Trang 10

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

khch hng th ba, v d l B. iu m chng ta quan tm l khi khch hng B s c hng cc quyn t do g i vi sn phm S. Rt c th xy ra, sau khi A thay i mt vi ch ca sn phm S, th A s tuyn b rng sn phm S l ca mnh v s t cc iu kin rng buc cho khch hng B, v do quyn t do ca sn phm S khi n tay khch hng B b mt hiu lc. Do tnh "T do" ca sn phm S khng l tuyt i v bnh ng vi mi khch hng ca mnh.
Trn thc t tng xy ra cc hin tng nh trn: Nhm cc phn mm Xfree86 thuc X windows khi c tung ra th trng l cc phn mm T do. Tuy nhin sau ny mt s cng ty s dng m ngun ca cc phn mm ny, iu chnh v nng cp thnh cc phn mm c bn quyn s hu v khng cn l t do na.

i vi Linux/GNU, hin tng trn cn phi loi b tn gc. Stallman l ngi u tin a ra khi nim phn mm Copyleft (tm dch l Bn quyn Tri) nhm loi b cc kh nng xy ra tng t nh vi cc phn mm Xfree86 nhc trn. Phn mm Bn quyn Tri (Copyleft) l mt loi phn mm T do c Bn quyn km thm iu kin c bit "ngt ngho" sau khi c s chuyn giao s hu t ngi ny sang ngi khc: Khi chuyn giao phn mm t tay ngi th nht (A) sang ngi th hai (B) th phi m bo rng ngi th hai (B) vn phi c tt c cc quyn t do (t 0 n 3) i vi phn mm ny. Nh vy phn mm thuc loi Copyleft mi thc s l phn mm m bo c tnh t do tuyt i ca ngi s dng. i vi phn mm thuc loi Copyleft s khng cn khi nim Ch s hu ca phn mm na. Tt c mi cng dn trn tri t u thc s bnh ng tuyt i i vi cc phn mm ny. Tuy nhin ch rng mc d khng cn khi nim ch s hu na nhng khi nim Tc gi i vi loi phn mm ny vn cn. Stallman c ngh cch ghi trn nhn ca phn mm ny nh sau: Copyleft by (tn tc gi) V d ta c th vit: Linux Kernel 2.2.14, Copyleft 1993 by Linus Torvalds. Cc phn mm thuc nhm Linux/GNU u nm trong loi Copyleft nh theo nh ngha trn. iu khng nh tnh t do tuyt i ca nhng phn mm v tc gi theo phong tro Linux. Trong thi gian mt vi nm tr li y, do xu hng pht trin mnh m ca Linux, mt s cng ty v t chc c ngh sa cm t Phn mm T do thnh Phn mm M ngun M (Open Source Software). Tuy nhin cng theo Stallman, khng nn dng cm t Phn mm M ngun M, v n khng phn nh ng thc cht ca Phn mm T do, gy ra s khng hiu ng hoc sai v GNU/Linux. Thm ch ng cnh bo rng mt s ngi mun thay i nh vy thc cht l che du mun kim chc v sinh li t Linux m thi.

Chuyn 3.1 Trang 11

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

M hnh phn loi phn mm c m t trong hnh v sau:

I.1.3. GNU GPL - GNU General Public License - Giy php S hu Cng cng phn mm ca GNU

Giy php S hu Cng cng phn mm (GPL) c GNU a ra nhm "p t" cho tt c cc phn mm thuc d n GNU. Mc ch duy nht ca GPL nhm m bo tnh t do tuyt i ca cc phn mm ca mnh. xem c y GNU GPL bn c th tham kho ti a ch Internet http://www.gnu.org, trong phn ny chng ti ch tm tt cc iu khon chnh ca Quyn S hu Cng cng phn mm GNU. Giy php S hu Cng cng GNU - GPL c p dng cho hu ht cc phn mm c pht hnh bi Qu Phn mm T do FSF (Free Software Foundation) v cho mi ngi s dng cc phn mm ny. ch ngi c cp php ta dng t "Bn", cn cc phn mm ca GNU chng ta s gi l "Chng trnh". 1. Bn c quyn sao chp v phn tn m ngun ca Chng trnh trn mi phng tin vi iu kin l Bn phi ghi r bn quyn, tc gi tng ng theo mi sao chp ca Chng trnh. Bn phi nu r cho ngi nhn cc iu khon lin quan ca Giy php S hu Cng cng phn mm ny v sao chp cho h mt bn (GPL). 2. Bn c th sao chp mt phn hay ton phn m ngun ca Chng trnh, c th thay i v phn tn cc thay i ny theo cc iu khon ca 1 v hn na phi tun th thm ton b cc iu khon sau:
Chuyn 3.1 Trang 12

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

a. Bn nht thit phi ch r cc file no b thay i v ngy c thay i. b. Ton b cc cng vic lin quan n s thay i ny Bn phi phn tn, cng b hoc xut bn chng min ph vi ton b Giy php Bn quyn S hu Cng cng ca GNU cho ngi nhn. c. Nu chng trnh thay i ny l tng tc trc tip vi ngi s dng, bn phi a vo chng trnh phn thng bo v bn quyn, bo hnh v cho php ngi s dng chng c ton quyn sao chp v phn tn theo cc iu khon ca Giy php Bn quyn S hu Cng cng ny. 3. Bn c th sao chp, phn tn Chng trnh v cc module ca n di dng M dch (object code) theo cc iu khon 1 v 2 ni trn v phi tun th thm ti thiu mt trong cc iu khon sau: a. Bn phi phn tn km theo m ngun m y ca cc module chng trnh ny v chng cng phi c tun th cc iu khon 1 v 2 trnh by trn. b. Bn phi ghi r thnh vn bn, vi thi hn hiu lc ti thiu 3 nm, giy bo gi tnh chi ph cho ngi nhn vi ph khng vt qu gi thnh sao chp, ng gi cng vi ton b m ngun m v ngi nhn c php sao chp, phn tn cc module m ngun ny theo cc iu khon 1, 2 ni trn. c. Trng hp Bn nhn c sn phm nh iu khon b th khi phn tn phi ghi r cc thng tin nh khi bn nhn c (ch p dng cho cc i tng khng phi l thng mi). 4. Bn khng c sao chp, thay i, phn tn v cp php cc Chng trnh khng nm trong cc iu khon ca Giy php Bn quyn S hu Cng cng ny. 5. Nu bn khng ng vi cc iu khon ca Giy php Bn quyn S hu Cng cng ny, bn s khng c cp bt c mt quyn hn no i vi cc Chng trnh nm trong khun kh ca GNU, nu vi phm bn s chu s trng pht ca php lut hin hnh v bn quyn s hu tr tu. 6. Mi khi bn sao chp hay phn tn Chng trnh hay Module theo cc iu khon 1, 2, 3 trn y, ngi nhn s t ng c cp php ca quyn S hu Cng cng. Bn khng c t thm bt c mt quyn no i vi cc quyn ny v khng c php lin kt vi bt k mt ai t ra cc hn ch khc i vi cc phn mm ny. 7. Trng hp bn khng th sao chp, phn tn chng trnh hay module tha mn ng thi cc iu khon ca Giy php Bn quyn S hu Cng cng ny v cc hn ch khc ca chng trnh th c ngha l bn s khng c bt c quyn g i vi cc chng trnh hay module ny.

Chuyn 3.1 Trang 13

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

8. Trng hp vic sao chp, phn tn b hn ch bi cc quyn s hu tr tu ca cc quc gia khc th khi phn tn, bn phi ghi r thm mt iu khon hn ch khng gian a l ca vic phn tn v sao chp ny. 9. Qu phn mm T do FSF c ton quyn iu chnh, sa i cc iu khon ca Giy php Bn quyn S hu Cng cng ny. Bn cn s dng phin bn mi nht ca GPL p dng trn thc t. 10. Nu bn mun chuyn cc phn mm thuc phm vi ca GPL ny sang mt nhm Phn mm T do khc, hy vit yu cu ca mnh v Qu Phn mm T do FSF. Chng ti s xem xt v quyt nh da trn li ch ti a ca ngi s dng v ngi pht trin phn mm. Ch : iu 7 c nu ra phng nga trng hp cc m ngun ca mt s chng trnh c s dng cc cng ngh c ng k bng sng ch (patent). y l mt trong nhng iu "bt cp" nht ca cc phn mm T do: trn nguyn tc, khi cng b cc phn mm t do, chng phi khng cha bt c mi cng ngh c ng k patent ca mt c nhn hay cng ty thng mi no (hoc phi c tc gi ca bng sng ch cho php s dng). Bn thn GNU v Stallman ngh v tranh lun nhiu v ti ny. iu khon v s hu bng sng ch hn ch rt ln s pht trin ca cc phn mm t do. V d khi bn v vic trng pht Microsoft trong v kin th k va qua, Stallman ngh phng n trng pht Microsoft bng cch bt Microsoft cng b cc thng s k thut ca cc cng ngh chnh ca mnh v Microsoft phi cho php cc cng ty khc s dng cc patent ca mnh.
I.1.4. GPL v Bn quyn S hu tr tu phn mm

T cc iu khon nu trn ca GPL ta c mt s nhn xt sau: - Cc phn mm pht trin di giy php GPL u l nhng phn mm c bn quyn, bn quyn ny c bo h ti nc s ti, ti Hoa k hay bt k mt quc gia no cng nhn h thng giy php GPL ny. Do vy GPL hon ton khng mu thun vi h thng Lut S hu tr tu hin hnh ti Vit Nam cng nh trn th gii. - im khc bit c bn nht gia cc phn mm thuc giy php GPL v cc phn mm "ng" kiu Microsoft l ch giy php phn mm cho php ngi dng nhng QUYN g i vi phn mm c bn quyn m thi. i vi cc giy php theo kiu "Microsoft" th ngi dng ch c ng 01 quyn, l quyn 0. Cn i vi giy php GPL th ngi dng s c c 4 quyn i vi phn mm ca mnh. - Nh vy giy php GPL hon ton khng mu thun vi nhng quui nh v Bn quyn S hu tr tu phn mm ca Th gii cng nh Vit Nam. iu ny hin ti vn cn nhiu ngi cha hiu v nhm ln ti Vit Nam.
Chuyn 3.1 Trang 14

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

I.2. Kh nng php l cho vic pht trin H iu hnh my tnh Vit Nam da trn m ngun m ca Linux.
I.2.1. Cc kh nng php l ca H iu hnh my tnh Linux cho Vit Nam

Tt c cc cu thnh php l ca h iu hnh da trn m ngun m Linux u thuc loi GNU v bt buc phi tun th nghim ngt cc iu khon ca giy php S hu phn mm cng cng GPL. Cc cu thnh php l ca mt h iu hnh Linux: Mt h iu hnh my tnh Linux bao gm cc cu thnh sau y: 1. Nhn (Kernel) ca h iu hnh Nhn hay li ca h iu hnh Linux l phn chng trnh bt buc cho mi h iu hnh thuc loi "Linux". Cu trc ca mt h iu hnh Linux c m t trong hnh sau:

V V Li V V Li ca h iu hnh Linux l phn chng trnh vi m ngun m tun th cc iu kin php l sau: - Tc gi: Torvalds Linux (ngi Phn Lan). - M ngun m cho tt c mi i tng. - Mi thay i, pht trin phi thng bo vi tc gi v c tc gi chp nhn. - Pht hnh theo cc phin bn, cc phin bn vi m s l - th nghim, m s chn - chnh thc. - Cm mi hnh thc kinh doanh ring phn li ca h iu hnh. Nh vy phn li (hay nhn) ca h iu hnh Linux l mt chng trnh m ngun m c bit c kim sot cht ch bi chnh tc gi Torvalds Linux. Bn thn ci li ny khng c quyn kinh doanh ring bit nhng c quyn ghp vo mt h iu hnh Linux hon chnh pht trin thnh mt sn phm c bn quyn, theo giy php GPL v c php kinh doanh.
Chuyn 3.1 Trang 15

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

2. Cc module v ca h iu hnh Phn v ca h iu hnh bao gm cc module bao xung quanh nhn v to ra mt h iu hnh my tnh hon chnh i vi ngi s dng u cui. Tt c cc module v ca h iu hnh Linux u phi tun th theo giy php cng cng GPL, l m ngun m theo nguyn tc GNU. C th hn ta c: - Mi c nhn, cng ty u c quyn pht trin cc module v ca Linux to thnh mt h iu hnh Linux hon chnh. Tt c cc sn phm ny u phi tun th giy php GPL. - Mt h iu hnh Linux c pht trin theo nguyn tc trn s phi tun th giy php GPL tc l vi m ngun m. - Cc c nhn hay cng ty pht trin cc module v ny c quyn kinh doanh nhng phi tun th giy php GPL i vi cc sn phm ca mnh. - Do vic pht trin cc module v ny l t do, do c rt nhiu nh pht trin cc module v ring bit hoc ton b h iu hnh Linux hon chnh. Hin ti ang c hn 60 cng ty ang pht trin v kinh doanh h iu hnh Linux do mnh pht trin. c im php l ca h iu hnh da trn Linux: Mt h iu hnh da trn Linux s c nhng c im php l quan trng v bt buc sau y: 1 - Nhn (li) ca h iu hnh thuc bn quyn ca Torvalds Linux. Tuy nhin nhn ny phi l m ngun m v cp pht cho tt c mi ngi s dng phn mm. M s ca nhn phi l s chn. 2 - Cc module v l cc sn phm c bn quyn vi giy php GPL. Khi cp sn phm cho ngi dng (chng hn trn a CDROM), bt buc phi cp thm phn m ngun y bao gm m ngun ca cc module v v m ngun ca nhn. 3 - Gi thnh bn sn phm ch bao gm phn cng vn chuyn, chi ph ng gi, ph bo hnh, bo tr v cc phn gi tr gia tng ca dch v hu mi sn phm. Khng c a phn gi tr gia tng ca thit k v pht trin sn phm vo gi thnh sn phm. Ch : Vi iu kin v gi thnh nh trn, mt h iu hnh my tnh da trn Linux s c gi thng th cao, thng thng gi bn mt giy php h iu hnh Linux ch khong t 5 n 20 USD.

Chuyn 3.1 Trang 16

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

I.2.2. H iu hnh my tnh LinuxVN thng hiu Vit Nam

Cc cu hi sau t ra vi mt h iu hnh my tnh thng hiu Vit Nam. 1. Th no l mt h iu hnh my tnh da trn Linux vi thng hiu Vit Nam? 2. Ai c th pht trin cc h iu hnh Linux thng hiu Vit Nam? 3. Chng ta c th pht trin c h iu hnh my tnh Vit Nam da trn Linux c hay khng? 4. Chng ta c kh nng thit k mt h iu hnh my tnh thng hiu Vit Nam m khng da trn Linux c khng?
1. Th no l mt h iu hnh my tnh da trn Linux vi thng hiu Vit Nam?

Tr li: H iu hnh my tnh da trn Linux vi thng hiu Vit Nam nu tha mn cc iu kin sau: - Tha mn cc c im php l miu t trong phn trn. - Pht trin bi mt c nhn hoc cng ty ca Vit Nam. - ng k nhn hiu hng ha v bn quyn s hu tr tu ca Nh nc Vit Nam.
2. Ai c th pht trin cc h iu hnh Linux thng hiu Vit Nam?

Tr li: Bt c ai, t chc hay c nhn u c quyn pht trin h iu hnh Linux thng hiu Vit Nam.
3. Chng ta c th pht trin c h iu hnh my tnh Vit Nam da trn Linux c hay khng?

Tr li: Hon ton c bi 2 l do chnh sau y: - Ton b h thng chng trnh ca Linux l m ngun m cho php chng ta tip cn trc tip v do c kh nng pht trin thnh sn phm ca Vit Nam. - Ton b cc phn kh nht ca h iu hnh nh nhn (li) v cc h thng giao din ha c lm sn. Cng vic ca nh pht trin ch l la chn giao din ha ph hp, la chn cc module, bn a ha thc n, hp hi thoi v lm phn ci t chng trnh.
4. Chng ta c kh nng thit k mt h iu hnh my tnh thng hiu Vit Nam m khng da trn Linux c khng?

Tr li: Xy dng mt h iu hnh my tnh t u l mt iu khng tng trong hon cnh ca Vit Nam hin nay. Chng ta cha trnh , cng ngh v khng vn thc hin iu ny. Chnh ph Trung quc u t hn 20 nm trong lnh vc ny v ri cng phi quay sang hng da trn Linux. Vit Nam cng khng th c con ng no khc ngoi cch da trn Linux pht trin mt h iu hnh ca ring mnh.
Chuyn 3.1 Trang 17

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

I.3. Cc vn kinh doanh H iu hnh da trn m ngun m


I.3.1. Cc phng n kinh doanh H iu hnh my tnh Linux ti Vit Nam

C 2 phng n Kinh doanh h iu hnh my tnh Linux ti Vit Nam nh sau: 1. Kinh doanh phn phi mt h iu hnh Linux ca mt cng ty nc ngoi. 2. Pht trin mt h iu hnh my tnh Linux thng hiu Vit Nam. C hai phng n trn u c nhng li th v khng li th. Bng sau s so snh hai phng n ny.
Ni dung\Phng n Phn mm c bn quyn Yu cu cng ngh Yu cu k thut Thng hiu Vit Nam Ph thuc vo nc ngoi Gi bn thp Dch v bo hnh, bo tr ri ro PA1: Phn phi sn phm OS ca nc ngoi Bn quyn ca nc ngoi Khng cn Yu cu cao Khng c C Thp C Cao PA2: OS thng hiu Vit Nam Bn quyn Vit Nam Rt cn cng ngh cao Yu cu rt cao C Khng ph thuc Thp C Cao

I.3.2. Kinh doanh H iu hnh my tnh thng hiu Vit Nam

Nh trn trnh by, chng ta hon ton c kh nng php l cng nh cng ngh pht trin v kinh doanh h iu hnh da trn Linux v h iu hnh ny s mang thng hiu Vit Nam.

Chuyn 3.1 Trang 18

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Phn II
NGHIN CU GII PHP PHN MM CHO A H IU HNH TRN MY TNH VIT NAM, TRONG C H IU HNH CH L LINUX-VN

(Chuyn 3.2)

Ni dung chnh: - Nghin cu kh nng Dual Boot a h iu hnh my tnh trong c Linux. - Cc vn sng chung gia Linux v Windows. - Qui trnh ci t Embedded Linux-VN OS trn cc my tnh Vit Nam.

Chuyn 3.2 Trang 19

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Chuyn 3.2 Trang 20

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

II.1. Kh nng Dual Boot a h iu hnh my tnh trong c Linux Linux l h iu hnh c kh nng ci t ng thi vi cc h iu hnh khc trn cng mt my tnh. Cc h iu hnh c kho st bao gm: 1. Microsoft Windows 2. IBM OS/2 3. UNIX (IBM, Sun, HP, .) 4. Solaris (Sun). Trn thc t ti Vit Nam hu ht cc my tnh c nhn hay c quan doanh nghip u s dng Windows, do vy bo co s c mt chng ring nghin cu s lin quan ca Dual Boot gia Linux v Windows. Kh nng thc t ca vic ci t song song gia Linux v cc h UNIX khc l khng th xy ra, do vy khng cn thit t vn vi cc h h iu hnh loi 3, 4 nh nu trn. i vi OS/2, vic nghin cu kh nng sng chung vi Linux hon ton tng t nh Windows, ngoi ra OS/2 cn c mt tin ch rt mnh cho php iu khin vic Dual Boot vi bt k mt h iu hnh no, do vy vn Dual Boot gia Linux v OS/2 khng cn mt nghin cu chuyn su no v gii php c sn trong OS/2. II.2. Cc vn sng chung gia Linux v Windows Vi s tin dng v n nh, h iu hnh Linux ngy cng c ph dng. Linux khng nhng ch chy mt mnh trn a cng, m n cn cho php chy cng vi nhiu h iu hnh khc (Windows95/98, Windows NT, OS/2) n nh trn cng mt computer. Vic ci t v config cho Linux v cc OS (Operating System) khc hot ng ng l mt iu quan trng. Nh ta bit, khi bt my, u tin BIOS s tin hnh kim tra phn cng v mt s vic khc. Tip theo, n s tin hnh c sector u tin ca a khi ng. Nu bn chn khi ng t a mm, sector u tin chnh l boot setor. Sector ny cha mt on chng trnh nh np h iu hnh. Nu bn khi ng t a cng, sector c np ln l Master Boot Record (MBR). Sector ny c cha mt chng trnh np v bng phn vng (partition table) cha cc thng tin v cc phn vng trn a cng. Chng trnh np chim 446 byte u tin ca MBR, 64 byte tip theo chnh l bng phn vng, hai byte cui cng nh du kt thc MBR c gi tr 0xAA55. Bnh thng, chng trnh np s chn phn vng c nh du tch cc (active) np sector u tin ca phn vng ny. Sector ny chnh l boot record ca phn vng tng ng, s c nhim v np h iu hnh c ci trn n v tr iu khin cho h iu hnh .

Chuyn 3.2 Trang 21

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

II.2.1. LILO (Linux Loader)

LILO l chng trnh np Linux thng dng nht hin nay. N khng ph thuc vo h thng file xc nh no, n c th np Linux kernel t a mm, t a cng v n c th hot ng nh "Boot manager" i vi cc h iu hnh khc. LILO l mt chng trnh cho php la chn khi ng cc h iu hnh khc nhau. C hai cch chnh s dng LILO l ci t LILO trn MBR v ci t LILO trn boot sector ca phn vng khi ng.
II.2.1.1. LILO c ci t trn MBR

Khi ci t h iu hnh Red hat Linux t a CD ROM, ta la chn kiu ci t LILO trn MBR. Vic hot ng ca LILO ln khi ng u tin sau khi ci t khc nhau i vi vic ci t Linux trc hay ci t Linux sau khi ci t cc h iu hnh khc.
Master Boot Record LILO Operating system Linux Other OS

- Nu trn my tnh ci t thnh cng h iu hnh Win95/98. Hoc trn my tnh c h Win95/98 ang hot ng ta c th phn chia li cng m khng lm mt d liu trn bng chng trnh phn chia a FIPS. Ta thc hin vic ci t h iu hnh Red hat Linux vi LILO c ci trn MBR. Trong qu trnh ci t th LILO s t nhn ra bng partition ca h iu hnh trc, v ln khi ng sau th LILO cho php bn chn h iu hnh no c hot ng. - Nu ta thc hin vic ci t h iu hnh Linux trc th LILO s c ci trn MBR. Sau ta tin hnh ci t Win95/98, tin trnh ci t cc h iu hnh ny s s dng MBR ca a cng trong qu trnh hot ng nh vy LILO trn MBR s b sa i v vy m trong ln khi ng tip theo th LILO khng hot ng c na. Nguyn nhn y l LILO b sa i trn MBR, vn ny c gii quyt theo phng php n gin sau. Thc hin vic boot Linux bng a mm, sau chy chng trnh /sbin/lilo np li LILO trn MBR. LILO t ng nhn ra cc phn vng ang c trn hard disk v ln khi ng sau LILO cho php bn chn h iu hnh hot ng nh bnh thng. khi phc li LILO trn MBR khi ta ci t Linux trc ta lm theo cc bc sau: - Ci t Linux vi LILO c ci trn MBR. - To a mm khi ng Linux. - Ci t Win95/98.
Chuyn 3.2 Trang 22

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

- Boot Linux bng a mm. - Ci t li LILO trn MBR bng cch chy /sbin/lilo. - Khi ng li my. Nhn xt: Trong vic ci t LILO trn MBR, vic thc hin ci t cc h iu hnh Windows trc sau mi ci t Linux n gin hn vic thc hin ci t h Linux trc.
II.2.1.2. LILO c ci trn Linux partition

Khi ci t LILO trn boot sector ca Linux partition th LILO s c khi ng bi mt chng trnh np nm trn MBR. Khi ta ci t Linux chung vi h iu hnh Windows95/98 th trn master boot record chnh l DOS - MBR.
Master Boot Record DOS - MBR Boot sector LILO Other OS Operating system Linux

y l cch ci t LILO kh ph bin. LILO c boot bi DOS master boot record. Cc h iu hnh khc c th c boot m khng dng LILO bng cch dng cc chng trnh nh fdisk hoc activate nh du phn vng l active. Tuy nhin vn l khng phi c ci xong LILO th trong ln khi ng sau LILO c th hot ng c. Bi v DOS - MBR khi khi ng n s tm n boot sector ca phn vng no c nh du l active np h iu hnh tng ng. Nh vy dng LILO khi ng th ta phi dng cc chng trnh nh fdisk hay activate nh du phn vng Linux l active. Trong ln khi ng sau th DOS - MBR s tm n boot sector ca Linux partition np LILO. Tuy nhin vn tin dng ca LILO l ta c th la chn h iu hnh hot ng t du nhc ca LILO. Vic ci t Linux trc hay sau cc h iu hnh khc th ta cng phi dng a mm khi ng Linux khi ng Linux. - Nu ta ci t Linux trc th khi ci t xong h iu hnh khc th ta phi chy li /sbin/lilo khi ta sa i tp lilo.conf trong th mc /etc. - Nu ci t Linux sau th nu mun thay i cch lm vic ca LILO th ta sa i tp lilo.conf, sau chy /sbin/lilo LILO nhn bit c s thay i. Sau khi thit lp LILO theo mun. dng LILO trn Linux partition th ta dng chng trnh fdisk vi ty chn a nh du vng active. Sau chn w ghi s thay i ln a.
Chuyn 3.2 Trang 23

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

II.2.1.3. LILO c khi ng bng BOOTACTV Master Boot Record BOOTACTV Boot sector LILO Other OS Operating system Linux

BOOTACTV l chng trnh c ci t trn MBR. Khi chng trnh np ca BIOS hot ng, n s np MBR ca a cng master v trao iu khin cho chng trnh np ca MBR ny. Nu MBR ca a cng ny c ci BOOTACTV th chng trnh BOOTACTV s hot ng. N s hi ta xem chn khi ng t phn vng no v np sector khi ng ca phn vng . LILO c th c ci t MBR hay trn Linux partition ph thuc vo mun ch quan ca ng s dng khi thc hin ci t Linux trn a CD ROM. Tuy nhin ta c th ci li LILO khi c h Linux bng cch thay i ni dung file lilo.conf trong th mc /etc. Sau chy li /sbin/lilo LILO nhn c s thay i.
II.2.1.4. LILO vi Windows NT

Cng tng t nh vic ci t vi h iu hnh Windows 95/98. Khi s dng Linux v Windows NT trn cng mt h thng th LILO trn MBR cho php chn Windows NT hay Linux khi ng. Ta cng c th khi ng Linux bng BOOT.INI ca Windows NT. dng c trnh np Boot.ini np Linux ta thc hin vic copy boot sector t Linux partition, sau sa i ni dung ca tp boot.ini ln khi ng sau c th np c Linux. S dng LILO np Windows 95, Windows NT, v Linux. Khi ci t Windows 95 vi FAT32, v ci Windows NT vi NTFS th chng ta phi kim tra xem phin bn Linux c h tr cc h thng file khng. Thc hin vic ci t Windows 95 trc, ci Windows NT v sau l Linux. Thay i file cu hnh ca LILO (lilo.conf) chy li /sbin/lilo, sa i mt s file trong Windows NT v Windows 95.

Chuyn 3.2 Trang 24

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

II.2.2. LOADLIN

Cch thc hot ng ca LOADLIN.


Master Boot Record
DOS

Boot sector MS - DOS

Operating system COMMAND.COM LOADLIN ------> Linux

MBR

Loadlin l mt chng trnh gip ngi dng c th khi ng h iu hnh linux ngay t mi trng DOS. Ta c th thm vo tp tin cu hnh ca DOS nh cc la chn np nhn ca linux. dng loadlin khi ng linux t mi trng DOS, ta phi c file cha nhn ca h thng linux. File ny nm trong th mc /boot. Trong h thng ca h iu hnh Red hat Linux 6.2, file cha nhn l /boot/vmlinuz-2.2.14-5.0. Sau khi copy file cha nhn sang phn vng ch DOS, ta c th khi ng linux t DOS bng cch g lnh: LOADLIN kernel_image root_device Trong kernel_image l file cha nhn m ta copy sang cn root_device chnh l phn vng a cha h thng file gc. Nu h thng file gc ch ra khng chnh xc, h thng s khng khi ng c. Khi c trnh np LOADLIN th ta c th thc hin chn khi ng h iu hnh Linux hay Windows 95/98 bng cch thm lnh np LOADLIN. Thm LOADLIN bng cch ta to mt tp .bat ring, v d nh l Linux.bat. Hoc ta thm vo tp Config.sys m khi khi ng Windows ta s cho chy trong tp Autoexec.bat. Ta thy vic s dng LOALIN np Linux kh thun tin. Ta cn c th khi to Linux t Windows 95 desktop. Nhng s dng c Loadlin th ta phi chy ch MS - DOS. Nhng vic thit lp n kh khn, n khng thun tin bng vic s dng LILO. Tuy nhin n li rt cn khi m ta khng ci LILO hoc LILO trn MBR b hng th buc ta phi dng chng trnh np LOADLIN.
II.2.3. SYSLINUX

SYSLINUX l mt chng trnh np h iu hnh cho Linux, n hot ng khng nm trong h thng file FAT ca MS - DOS/Windows. N gip cho vic ci t Linux ln u n gin, v cho vic to a tip cu (rescue disk) v a c mc ch c bit khc. SYSLINUX khng ph hp vi chng trnh np chung. N ch c th boot Linux t h thng file FAT, khng cho h thng file khc, v d nh ext2. Chng trnh np khc nh LILO ph hp hn. Trong h thng m c cha DOS hay Windows, LOADLIN s d dng s dng hn. Tuy nhin, SYSLINUX c nhng ci hu ch ca ring n trong mt vi ng dng vi mc ch c bit.
Chuyn 3.2 Trang 25

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

II.2.3.1 To a mm khi ng Linux

to a mm khi ng Linux s dng SYSLINUX, chng ta chun b mt a mm MS - DOS c formmat. Copy cc Linux kernel file ln a mm. Thc hin lnh DOS. syslinux [-s] a: Hoc thc hin lnh Linux. Syslinux [-s] /dev/fd0 Lnh trn s ghi boot sector ln a v copy file LDLINUX.SYS vo th mc gc. Nu c la chn -s th n s ci t phin bn "safe, slow v stupid" ca SYSLINUX.
II.2.3.2 Tp cu hnh

Tt c cu hnh ngm nh trong SYSLINUX c th b thay i bng cch thay i tp SYSLINUX.CFG trong th mc gc ca a mm. N l file text theo nh dng ca UNIX hay DOS, n cha cc mc sau: DEFAULT kernel options t dng lnh ngm nh, nu SYSLINUX khi ng t ng. Nu file h thng khng tn ti hoc khng c dng lnh DEFAULT no trong file cu hnh th kernel ngm nh c tn l "linux", v khng c cc ty chn. APPEND options Thm mt hoc nhiu ty chn vo nhn dng lnh. IMPLICIT flag_val Nu flag_val c gi tr l 0, khng np kernel tr khi n c khai bo trong dng LABEL. Ngm nh l 1. TIMEOUT timeout Ch ra thi gian phi ch i khi c du nhc cho ti khi n t ng khi ng (n v l 1/10 giy). gi tr nh nht l 0 v gi tr ln nht ca timeout l 35996 SERIAL port [baudrate] Khi ng cng hot ng nh console. "port" l mt s (0=/dev/ttys0=COM1); nu "baudrate" b qua th tc ngm nh l 9600 FONT filename Np phng nh dng .psf trc khi hin th u ra, SYSLINUX ch np phng vo video card. KBD keymap Ci t nh x bn phm n gin.
Chuyn 3.2 Trang 26

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

DISPLAY filename Hin th file c ch nh ln mn hnh khi khi ng my. PROMPT flag_val Nu flag_val c gi tr l 0, ch hin th du boot: nu n phm Shift, Alt, hoc phm Caps Lock, Scroll lock c t th n s khi ng ngm nh. Nu flag_val c gi tr l 1, th lun lun hin th du nhc "boot:". Khi ta khi ng Linux bng a mm dng trnh np SYSLINUX th n gin nht l ta phi to mt a mm DOS dng lnh sys (c th trong Windows hay Linux ty ). Sau thc hin lnh copy nhn h iu hnh Linux v to mt file SYSLINUX.cfg n gin l c th np c ri. Bi v tnh km thun tin ca chng trnh SYSLINUX, trong khi cc trnh np khc n gin v mm do hn. Nn chng ta cng khng quan tm nhiu n trnh np ny. II.3. Qui trnh ci t Embedded Linux-VN OS trn cc my tnh Vit Nam Qui trnh ci t h iu hnh Linux Vit Nam trn cc my tnh lp rp ti Vit Nam c th theo cc hnh thc sau: 1. Ci t sn v trc tip trn my tnh khi xut xng (PreInstall). 2. Cp a CDROM cha h iu hnh Linux km my tnh (Post Install). 3. Ci t b nn ngay trong a cng my tnh xut xng (Emmbeded Install).
4.3.1. Ci t sn v trc tip trn my tnh khi xut xng (PreInstall)

Vi qui trnh ny, cc my tnh khi xut xng c ci xong h iu hnh v ngi s dng ch vic m my ra lm vic. Tt nhin ngi dng s c cp giy php h iu hnh ring bit trn a CDROM c th ci t li bt c lc no. Qui trnh c th hin trong hnh v sau: Lp rp my tnh

Ci t H iu hnh

PreInstall Method

ng gi, bn giao ngi mua hng

Chuyn 3.2 Trang 27

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

u im: - Qui trnh ci t thng nht gia cc my tnh, tng i n gin. - Ngi dng khng phi lm thm ng tc g khi mua my tnh. - B ti liu hng dn s dng c th lm ngn gn. Nhc im: - Ngi dng khng c quyn la chn cc tnh nng ca sn phm khi ci t. - Cng vic ci t trn b mt h iu hnh ln a cng mt kh nhiu thi gian cho mi my tnh khi xut xng. Thi gian ci t xong mt h iu hnh Linux mt khong 20-45 pht. (C th dng phng php sao chp ton b mt a cng tuy nhin thi gian cng tn khng km).
II.3.2. Cp a CDROM cha h iu hnh Linux km my tnh (Post Install)

Vi qui trnh ny, khi xut xng my tnh khng cha bt c d liu hay h iu hnh no. Ngi dng s c cp b ti liu v a ci t h iu hnh y v s t ci t theo hng dn. Qui trnh c m t trong hnh sau: Lp rp my tnh

ng gi, bn giao ngi mua Post Install Method u im: - Qui trnh rt n gin, khng tn thi gian vo vic ci t h iu hnh. - Ngi dng c php la chn cc cu thnh v cng c khi ci t phn mm. Nhc im: - Ngi dng s phi t ci t h iu hnh cho ring mnh. y l mt cng vic phc tp nht l i vi ngi dng khng c hiu bit v my tnh v tin hc. - Vic bin son ti liu hng dn s dng, ci t s rt cn thn trng, t m c th cho ngi dng lm c. - Cng vic bo hnh, hng dn k thut, bo tr s tng ng k i vi qui trnh sn xut ny.
Chuyn 3.2 Trang 28

Ngi dng ci t h iu hnh

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

II.3.3. Ci t b nn ngay trong a cng my tnh xut xng (Emmbeded Install)

y l phng n ci t ti u nht i vi c hai pha nh cung cp v ngi s dng. Qui trnh ny kt hp c hai phng n PreInstall v PostInstall nu trn. Theo qui trnh ny, khi xut xng trn my tnh s c ci t trc (Pre Installation) cc tin ch sau: - Mt h iu hnh Linux minimum c ci t sn trong Boot Sector ca Active Primary Partition. - Chng trnh ci t nn ca h iu hnh Linux c t sn trong a cng (Linux Installer). - Trnh khi ng LILO dng khi ng qu trnh ci t h iu hnh t a cng. Khi ngi dng mua my tnh, ln u tin khi ng, qui trnh ci t t ng nh sau (Post Installation): - Linux OS Minimum khi ng np vo b nh. - Trnh LILO khi ng cho php la chn vic ci t Linux, mt h iu hnh khc hoc Restore my tnh tr v trng thi ban u. - Np v khi ng Linux Installer ci t Linux. Qui trnh trn c m t trong hnh v sau: Pre Installation Post Installation

Lp rp my tnh

Khi ng my tnh

Ci t Linux OS Minimum, LILO & Linux Installer

Np Linux OS, np LILO

ng gi, bn giao cho ngi mua hng

Khi ng Linux Installer, gii nn v ci t Linux OS Full ln my tnh

Chuyn 3.2 Trang 29

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

nh gi phng n Embedded Installation u im: - y l phng n ti u nht i vi ngi s dng, cho php ngi dng t do la chn cc phng n ci t t ng ca h iu hnh trn my tnh ca mnh. - Do vic ci t Linux thng qua Linux Installer vic ci t tr nn gn nh t ng, ngi dng khng cn c hiu bit v Tin hc cng thao tc c. Nhc im: - Kh khn ln nht ca phng n ny l kh nng cng ngh to c qui trnh np h iu hnh nh trnh by. Vi phn kho st k c nu trong chng II ca bo co ny trn nguyn tc chng ta hon ton c th lm ch c cng ngh ny. - Vic np cc tin ch trong qu trnh PreInstallation cng s tn mt khong thi gian nht nh, khong 5 - 20 pht cho mi my tnh. Tuy nhin c th ci tin phng n ny bng cch t hu ht cc tp nn d liu ca trnh Linux Installer trn CDROM th c th gim bt ng k thi gian ca PreInstallation xung cn mt vi pht.

Chuyn 3.2 Trang 30

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Phn III

nghin cu gii php phn cng cho a h iu hnh trn my tnh vit nam, trong h iu hnh ch l linux-vn

(Chuyn 3.3)

III.1. C s v gii php phn cng III.1.1. C s cho gii php Cho n nay, cc h iu hnh (HH) ca PC u c ci t trong a cng v khi ng (boot) t nh chng trnh BIOS a h iu hnh vo hot ng. Do vy, rt t nhin tng a h iu hnh trong mt PC ko theo tng ci t nhiu HH trn nhiu a cng trong mt PC, hoc ci t nhiu HH trn nhiu vng c phn hoch nh nhng a cng ring bit trn mt a cng. Cc a cng vi cc nh dng vt l c lm cc nh my sn xut, trc khi s dng u phi phn vng (partition) v nh dng logic t ln vng a mt h thng File, cho php HH s dng dung lng a c sn lu tr v truy cp cc File. Vic phn chia mt cng thnh nhiu vng, mi vng c th c s dng nh mt a cng ring v c nh dng vi h thng File tng ng ca HH ci t trn n, cho kh nng thc hin a h iu hnh trn mt PC. Do khng th can thip vt l vo tng vng trong cng nh i vi cng ring bit, nn vic qun l chy nhiu HH phi thc hin bng phn mm iu khin. Chi tit v gii php phn mm cho a h iu hnh ny c trnh by mt phn ring. Thit k nn PC (PC platform) cho cc my PC hin nay thng b tr trn Bng mch ch (Mainboard/Motherboard) 2 IDE controllers (Primary v Secondary IDE) kt ni vi thit b giao din IDE v BIOS tng ng. Do vy, cho kh nng lp nhiu a cng trn mt PC. Cc a cng tiu chun hin c trn th trng u c thit k c b jumpers t ch lm vic Master hay Slave cho a trong PC. Bng cch thay i v tr cm jampers, a cng s hot ng n c khi ch Master Drive hoc kp nh mt Slave Drive ca Master Drive. Do vy, tro i vt l vai tr Master v Slave ca a cng cng to ra kh nng tro i vic khi ng cc HH ci trn chng. Tn dng nhng kh nng sn c ca phn cng (Bng mch chnh, a cng) v phn firmware (BIOS), c nhng hng chnh sau s dng a h iu hnh bng gii php phn cng trong mt PC :
Chuyn 3.3 Trang 31

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

- Dng nhiu a cng, mi ci t mt HH, chy c lp. - Dng nhiu a cng, mi ci t mt HH hoc khng ci t HH ( d liu), chy kt hp vi nhau hoc kt hp vi CD/DVD. Di y l mt s gii php phn cng hin c dng theo cc hng nu trn. III.1.2. Mt s gii php phn cng hin dng III.1.2.1 -Gii php cng tho lp c tng ca gii php rt n gin l cn dng HH no th thay cng trong my bng cng ci t HH y. Ch cn gii quyt vn tho lp dng cng mi khi cn. Gii php cng tho lp c ban u c dng cho nhu cu ct gi an ton thng tin v nhu cu kho thng tin lu ng trong my server. Cc nh sn xut ch to ra nhng ci hp c kch thc va vi hc 5.25 ca v PC, n gm c: mt ci mng (5.25 mobile rack) vi tm lng (HDD backplane) c cc u ni ngun v u ni IDE ni cng vi ngun v Bng mch chnh; v mt ci khung tho lp c (Removable Frame) c tay cm y khung vo mng v ko khung ra d dng, trong mng lp cht trong mt cng 3.5. Khi c nhu cu a h iu hnh trong mt PC, gii php ny cng c dng. Mi a cng ci t mt HH, khi cn dng HH no th thay khung c cng ci t n vo my. Nhng do gi thnh cng tho lp c cao, phi dng nhiu v khng tin li cho s dng trong mi trng cng cng, nn gii php ny t c dng cho mc ch a h iu hnh trong mt PC. (Minh ha mt s nh cng tho lp c di y ly t website ca Enermax Technology Corp. Taiwan)

Chuyn 3.4 Trang 32

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Chuyn 3.3 Trang 33

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

III.1.2.2 Gii php Modul a cng chuyn nhanh Gii php Modul a cng chuyn nhanh (Hot-Swap HDD Modul) l s pht trin tip tc gii php cng tho lp c dng cho my server, vi nhng u im mi. Cc nh sn xut ch to modul a cng chuyn nhanh gm: mt ci hp cha c n 5 a cng tho lp c, trong c tm lng (backplane) cm cc , vi cc u ni ngun v u ni cp IDE/SCSI ni vi ngun v Bng mch chnh, v vi mch chc nng chuyn nhanh bng chuyn mch n tay; v card iu khin tm ngun vi cc n LED lp mt trc ca PC bo hiu trng thi lm vic ca a, qut gi. Gii php ny c u im hn gii php cng tho lp c l mi khi cn chuyn i HH khng phi mt nhiu thi gian tho lp cng, ch cn n cng tc. Nhng do gi thnh cao hn, nn cng ch c dng cho h thng server, m t dng cho my tnh bn. (Minh ha modul a cng chuyn nhanh di y ly t website ca Enermax Technology Corp. Taiwan)

Chuyn 3.4 Trang 34

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

III.1.2.3 Gii php Hp chuyn mch Do cc gii php cho server cha tht ph hp vi my tnh bn, nn rng ca gii php Hot-Swap HDD module c pht trin thnh gii php Hp chuyn mch (Switch Box) r tin hn v d dng hn cho my tnh bn. Gii php Hp chuyn mch c ngh thc t nht hin nay l B chn a cng (HDD Selector) do cng ty Hn Quc 911 Computer Co.Ltd cng b v ng k Bng sng ch (Patent) ti M v Canada. Gii php B chn a cng c a vo sn xut v ng dng thc t t nm 2000 v vn ang tip tc c nghin cu v pht trin. (Cc thng tin di y v Trios HDD Selector do 911 Computer Co.Ltd cng b trn website www.911.co.kr v cung cp trc tip cho tc gi thng 12 nm 2002). B chn a cng (HDD Selector) ln u tin c gii thiu ti China COMDEX 2000 v c bn ti M v Hn Quc vi nhn hiu Trios, ti Nht vi nhn hiu Winus. n nay mi c 2 lot (series) Trios 2000 v Trios 2002. Trios 2000 c phn ra version IDE v SCSI vi mi version li c kiu internal v external. Kiu internal IDE c coi l tiu chun economical cho s dng vn phng v thng dng, v kiu external IDE l tt cho nhng ngi dng my mnh v phng my (power and cabinet) d lp t v lu ng. Version SCSI cho cc chuyn gia c lm trn c s n hng. Trios 2002 ch c version IDE v phn ra kiu thng dng (general) v kiu an ton (security) dnh cho PC c kt ni mng. Chi tit v gii php ny c trnh by trong mc tip theo di y.

Chuyn 3.3 Trang 35

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

III.2. Gii php B chn a cng III.2.1. M t B chn a cng Trios 2000 & 2002 Trios l b chuyn mch cho ti a ba a cng boot c trn mt PC, ring Trios 2002 kiu security ch ti a l 2. Trios 2000 Kit c cc kiu sau:

Trios 2002 c cc kiu sau: General Type Security Type

Chuyn 3.4 Trang 36

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

III.2.2 Trios yu cu PC vi h thng IDE / E-IDE / SCSI v Award BIOS, AMI BIOS, Phinex BIOS nng cp c chc nng auto-detect a cng. C mt hc 5.25 cha s dng v mt khe (slot) PCI cha s dng (ch i vi Trios 2002). Trios ni tt c cc vo Primary IDE, vic chn mt ny lm ngt cc boot khc khi h thng. Mi a cng dnh cho mt HH mun boot (max l 3). III.2.3. Th tc ci t Trios 2000 v 2002 Trios 2000 Kit

Chuyn 3.3 Trang 37

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Trios 2002 Kit

Chuyn 3.4 Trang 38

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Chuyn 3.3 Trang 39

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Chuyn 3.4 Trang 40

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

III.2.4. S dng Trios III.2.4.1. S dng Trios 2000

S dng Trios 2000 t "Type" v "Mode" ca Primary Master v "AUTO", cn li tt c v "NON" Vo BIOS khi khi ng PC bng nhn phm "delete" trc khi np HH. Trong "Standard CMOS Set up", dng phm "Arrow" dch chuyn. Dng phm "page up" hoc "page down" t "Type" v "Mode" ca "Primary Master & Primary Slave" v "AUTO", v cn li tt c v "NON"

Chuyn 3.3 Trang 41

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Lu :

- Chn trc khi m my - Tt my trc khi chuyn

III.2.4.2. Cu hnh s dng cc IDE vi Trios 2002

Chuyn 3.4 Trang 42

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

III.2.4.3. S dng Security Trios 2002 Cu hnh s dng cc a cng

Chuyn 3.3 Trang 43

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Chuyn 3.4 Trang 44

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

III.3 Th nghim v Khuyn ngh s dng III.3.1 Th nghim Gii php B chn a cng c chy th nghim trong cc h thng my tnh PC ca IBM v tng thch IBM, Dell, Gateway, Hewlett Packard, Sony, NEC, Samsung, e-Machine, v.v, vi cc a cng kiu IDE ca Western Digital, Fujitsu, IBM, Maxtor, Quantum, Samsung, Seagate v Conner. Cc h iu hnh c chy th theo phng n a h iu hnh trn mt PC, dng B chn a cng, l tt c cc version ca Windows, OS/2, DOS, Linux, Unix, Solaris, Novel, v.v Chng c ci t vi bt k cch t hp HH, k c Linux, trn mi a gim ri ro do h hng multi-boot t phn mm partition. Gii php B chn a cng c th nghim cho cc mi trng s dng PC khc nhau. Bng cch ci t B chn a cng, nhng ngi s dng PC c th chia s mt PC vi hai hoc nhiu ngi khc vi HH ring h cn l tng cho gia nh, phng tp th, vn phng, v.v S chung ng my tnh cn c nhng mi trng PC v ngn ng khc nhau, nn B chn a cng chim c v tr chc chn l mt cng c thch hp nht cho nhng nhu cu cung nhit my tnh i hi mi trng PC v ngn ng tt nht bao gm nhng phn mm kinh doanh, s ni tr, tr chi v gio dc. H thng h tr nhng ngn ng khc nhau Anh, Ty Ban Nha, Trung Quc, Nht Bn, Hn Quc bi Windows 98 hoc 95. iu thu ht cc lp ngi s dng PC khc nhau bao gm trong kinh doanh, trng hc, phng th nghim, vin nghin cu, v.v. H c th bt u vi s tng tc ca a HH bng cch np chng vo nhng khc nhau v khi ng (boot) vi nhiu cch t hp cc a. Hn na sinh vin c iu kin dng a ring ca mnh. Thit b cng l thng dng bi v n sn sng cho cc doanh nghip a quc gia, c dng c version Windows ting Anh v ting nc khc. Ngi dng PC song ng c th khng phi kh chu v vn phng ch trong Windows ting Anh, v n cho php h s dng c phng ch ngn ng ca mnh mt cch d dng. Do khng c nh hng qua li gia ba HH, nn n c coi l gii php tt hn cho h tr a ngn ng bao gm ting Anh, Hn Quc, Trung Quc, Ty Ban Nha, v.v. H thng my tnh SOHO no cng c lc b hng (thng do h hng a cng), khi ngi dng phi ch cho n khi h thng c sa li hoc mua h thng thay th khc. Trios c th gip h khi gin on cng vic, khi c li a cng, bng ci t phn mm trn hai a cng tch ri nhau trn cng mt my. H c th khi ng t mt a cng ny v kia d phng (backup) cho h thng. Khi a cng ny khng lm vic c, ngi dng PC c thng bo n chuyn mch sang a cng kia, v thay th bng dng
Chuyn 3.3 Trang 45

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

phn mm d phng. H c th tr li ngay vi cng vic, cn kia sau khi sa s dng vo lc khc. i vi nhng ai mun th phn mm mi, th Trios l mt gii php tt hn bo v h thng gc. Trong khi th bt k phn mm no khc, cc vng (partition) ca a c th c phn hoch, c nh dng (formatted) v c dch chuyn (removed) khi cn m khng phi lo b mt hoc h hng. Trios cn cho php tch ri h thng vi nhng ci hin c trn mt PC, ngi dng c th tm kim trn mng khi dng mt h thng ny, trong khi bo qun d liu nhy cm trn h thng kia khi ly virt v b xem trm. (xem - A rainy-day solution from 911 Computer- International CompuTrade, Issue 194, Feb. 1, 2000) Trios cng c th nghim trong thi gian thc hin ti KC-06-03 CN mt s mi trng tng t kim nghim nhng nhn nh trn ca Nh sn xut Trios. Qua rt ra nhng khuyn ngh s dng di y. III.3.2. Khuyn ngh s dng Qua nhng th nghim thc t c th khuyn ngh s dng Gii php a h iu hnh bng B chn a cng trong nhng mi trng sau: 1. Cc T im internet (Internet point) hoc Trm thng tin (Information Kiosk) cng cng ci t hai, ba h iu hnh thng dng (Windows 98/2000, Linux) vi cc ngn ng thng dng (Vit, Anh, Trung Quc,), phc v khch hng (dn chng, khch du lch, ..) c nhu cu s dng cc h iu hnh vi ngn ng khc nhau v phc v khng b ngt qung trong iu kin d b ly nhim virt v h hng phn mm. 2. Cc Phng my tnh ca trng ph thng, i hc, trung tm thng tin-th vin, k tc x ci t hai, ba h iu hnh thng dng (Windows 98/2000, Linux) vi cc ngn ng thng dng (Vit, Anh, Trung Quc,), phc v hc sinh, sinh vin, gio vin v cc nh nghin cu c nhu cu s dng cc h iu hnh khc nhau, cc h iu hnh vi ngn ng khc nhau trong iu kin d b ly nhim virt v h hng phn mm. 3. My tnh dng trong h thng chun on y t v chm sc sc khe ci t h thng d phng trn mt a cng khc, m bo iu kin lm vic khng b t qung do h hng a cng v phn mm. 4. My tnh gia nh ci t ring bit h thng cho cng vic ca b m v h thng hc tp v chi tr chi ca tr con, tr con khng v tnh xa mt d liu hoc chng trnh ca b m . 5. My tnh dng trong kinh doanh v nghip v; trong cc trm bn v tu, xe; trong cc trm cn o; ci t h thng d phng trn mt a cng khc, m bo iu kin lm vic khng b t qung do h hng a cng v phn mm.
Chuyn 3.4 Trang 46

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

7. My tnh dng cho pht trin phn mm ci t ring bit h thng c s v h thng dng test phn mm mi, bo v h thng gc khi phi b hoc xa phn mm khc trong qu trnh test. 8. My tnh h tr k thut cc h iu hnh chnh (Windows 98/2000/NT/XP, OS/2 hoc Linux) c ci t trong mt my tnh h tr k thut c i hi a cu hnh PC, s dng tt c chng trn mt my hoc test mt h thng nguyn vn m khng lm tn hi n ng dng ang dng. 9. My tnh trong mi trng mng ca cnh st, qun i, ngn hng, v.vc yu cu cao v an ton mng - trong Security Trios 2002, mi mng (Internal / External Network) ni vi mt a cng vi HH ring, ngay c khi chng may virt thm nhp a cng qua Internet (external network), khng phi lo ngi cho a cng ni vi mng ni b (internal network) c cc d liu quan trng. Cn nhiu mi trng dng Trios s c pht hin v tip tc khuyn ngh sau ny.

Chuyn 3.3 Trang 47

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Chuyn 3.4 Trang 48

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Phn IV
XY DNG CHNG TRNH V CC BIN PHP TRIN KHAI PH CP LINUX-VN TRONG CC C QUAN NH NC V TRONG O TO (Chuyn 3.4)

Ni dung chnh: - Cc bin php trin khai ph cp h iu hnh Linux-VN - Chng trnh khung ca cc chng trnh o to ph cp Linux trong mi trng cc C quan, Doanh nghip Vit Nam. - Kh nng ph cp Linux-VN trong mi trng sinh vin v cc trng i hc ti Vit Nam.

Tm tt kt qa nghin cu Trang 49

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Chuyn 3.4 Trang 50

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

IV.1. Cc bin php trin khai ph cp h iu hnh Linux-VN o to l mt ni dung u t khng th tch ri ca cc chng trnh trin khai ph cp h iu hnh Linux-VN. Ni dung v cc bin php o to ph cp phi gn lin vi cc d n u t h thng thng tin c s dng h iu hnh m ngun m Linux trn my tnh v h thng mng. Theo s liu thng k, chi ph cho o to thng chim 8-10% gi tr u t ca d n. Cng vi chng trnh trin khai ph cp h iu hnh cho my tnh thng hiu Vit Nam. Cc bin php o to ph cp hng vo hai hng chnh: - o to ph cp Linux cho cc c quan, doanh nghip s dng h iu hnh Linux trn my tnh v mng. - Ph cp Linux trong gio dc v o to.
IV.1.1 Cc bin php o to ph cp h iu hnh Linux cho cc c quan doanh nghip

mt d n c s dng h iu hnh m ngun m Linux thnh cng, cn phi o to ph cp hai i tng sau: - Nhm 1: Cc i tng l cn b tin hc qun tr v khai thc h thng - Nhm 2: Cc i tng s dng my tnh trn h thng Bin php o to: - Vi cc cn b qun tr h thng: Cn c o to thm v H iu hnh m ngun m ti cc trng i hc, hoc cc chng trnh b tc ti ngay cc c quan. Cc ni dung o to c bn xem trong mc 6.2 - Vi cc i tng s dng my tnh trn h thng: bin php o to ph cp l trin khai cc kho b tc ngn hn v khai thc cc phn mm trn cc my tnh, mng my tnh s dng h iu hnh m ngun m. Cc chng trnh o to c bn, xem chi tit trong mc 6.2.
IV.1.2 o to ph cp h iu hnh Linux trong gio dc o to

Vn ph cp h iu hnh Linux trong lnh vc gio dc v o to l vn mang tm quc gia. Trong khun kh ca n nay, chng ti ch xin trnh by mt s nhng thun li v kh khn khi trin khai ph cp h iu hnh Linux trong lnh vc ny. Nhng kin chi tit c trnh by trong mc IV.3.

Chuyn 3.4 Trang 51

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

IV.2. Chng trnh khung ca cc chng trnh o to ph cp Linux trong mi trng cc C quan, Doanh nghip Vit Nam Phn ny xut cc chng trnh o to ph cp h iu hnh Linux trong cc C quan, Doanh nghip Vit Nam s dng h iu hnh m ngun m Linux trn my tnh v mng. Cc chng trnh o to c bin son thnh cc module, mi module 30 tit (bao gm 15 tit l thuyt v 15 tit thc hnh). Trong : - Nhm 1: hc cc module 1 n module 18 - Nhm 2: hc cc module 1 n module 6 1. Linux/Unix c bn
Gii thiu Linux/Unix Cc phin bn Linux/Unix Ci t Linux Cc lnh c bn trn Linux/Unix Qun tr h thng file Qun tr h thng User Ci t mng cho Linux Ci t v s dng X-Window In n trn Linux/Unix Ci t v s dng cc dch v Internet vi Linux/Unix

2. Hng dn s dng v ci t Linux trn my tnh PC


Gii thiu Linux v cc phin bn Linux Yu cu v phn cng v phn mm cho Linux Ci t v nng cp Linux Ci t v s dng LILO Ci t v cu hnh X-Window Cc tin ch GNU quan trng trong Linux Mt s lnh h thng c bn ca Linux Cc lnh lm vic vi h thng file Cc lnh lm vic vi h thng User Ci t mng trn Linux

3. Mi trng ha X-window trn Linux/Unix


Tng quan v kin trc X-Window Ci t v cu hnh X-Window
Chuyn 3.4 Trang 52

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Khi ng v ra khi X-Window Chy ng dng trong X-Window S lc v GNOME S lc v KDE S dng mt s tiu dng X-Window Cc cng c qun tr trn X-Window S dng ting Vit trong X-Window

4. Son tho vn bn trn Linux


S dng h son tho Vi, Vim trong ch Console S dng h son tho ca MC S dng cc h son tho trong X-Window (Open Office) S dng TeX S dng qeqn v gtbl In n trong Linux S dng ting Vit khi son tho vn bn

5. Nhp mn C s d liu trn nn Linux


Tng quan v h qun tr c s d liu Khi nim v cu trc cu lnh SQL Ci t v cu hnh MySQL, PostGreSQL Khi to Database, Table, View, Store Procedure Chn, thay i, xo d liu Truy vn d liu Bo mt c s d liu Ci t v cu hnh Oracle trn Linux Kt ni MS SQLServer, MS Access t Linux

6. Linux v cc phn mm Tin hc vn phng


Tng quan v Linux v kh nng ng dng Linux trong vn phng. Gii thiu s lc mi trng X-Window, GNOME, KDE Gii thiu b phn mm StarOffice v cc tiu dng ca X-Window S dng StarOffice Writer S dng KWord S dng StarOffice Calc S dng KSpreadSheet S dng trnh x l nh GIMP S dng ting Vit trong cc ng dng vn phong
Chuyn 3.4 Trang 53

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

In n trong Linux Trao i d liu vi cc ng dng MS Windows

7. Mi trng kt ni mng LAN v Internet trn nn Linux


S lc cc khi nim chung v mng Ci t v cu hnh mng cho Linux Chia s v nh x th mc trong Linux Gn quyn truy cp cho User Kt ni n mng dng Windows, Novell Ci t v cu hnh my in qua mng Ci t v cu hnh modem Ci t v cu hnh Dial-up Kt ni Internet qua Dial-up Ci t v cu hnh Proxy Cc lnh kim tra v theo di hot ng mng

8. Qun tr mng Linux/Unix


Tng quan v kin trc ca h iu hnh Khi nim User, Group, Permission, Logon, Logout Cc thao tc qun tr User, Group, Login, Logout Gn quyn hn cho User, Group Ci t v cu hnh mng Chia s th mc, file, my in trn mng Chia s my ch kt ni Internet Ci t v cu hnh Firewall Ci t v s dng mt s dch v: Web, Email, Telnet Bo mt cho h thng

9. X l ting Vit trn Linux


S lc cc vn lin quan n ting Vit trong tin hc Cc bng m ting Vit v Unicode Gii php a ting Vit vo Linux S dng ting Vit trong ch Console S dng ting Vit trong ch ho Ci t v s dng font ch trong Linux Trao i d liu c s dng ting Vit trn Linux

10. Gii thiu mi trng lp trnh ng dng trn nn Linux


Cc trnh bin dch v thng dch trong Linux Lp trnh Shell
Chuyn 3.4 Trang 54

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Lp trnh C Lp trnh C++ Lp trnh Perl Lp trnh PHP Lp trnh Java Lp trnh ng dng trong mi trng X-Window Dch v ng gi ng dng Ci t ng dng

11. X l a phng tin (Multimedia) trn h iu hnh Linux


Ci t Sound Card Cu hnh cho Sound Card S dng PC Speaker Cc phn mm x l m thanh trong Linux Ci t v cu hnh Card mn hnh Cc dng d liu ho trong Linux Phn mm v ho trong Linux Phn mm x l nh Phn mm x l Video trong Linux S dng CDROM trong Linux

12. Hng dn s dng mi trng ha KDE


S lc v KDE Khi ng KDE v khi qut giao din Cc kin thc c bn lm vic trong KDE Cc thao tc trn thanh KDE Chy ng dng trong KDE S dng mn hnh v ko th trong KDE Qun l tp tin S dng cc tiu dng ca KDE S dng KDE-TERMINAL Cu hnh KDE Trnh qun l ca s S dng b iu khin trung tm KDE Tng quan v h thng X-Window Cu hnh cho X-Window

Chuyn 3.4 Trang 55

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

13. Hng dn s dng mi trng ha GNOME


S lc v GNOME Khi ng GNOME v khi qut giao din Cc kin thc c bn lm vic trong GNOME Cc thao tc trn thanh GNOME Chy ng dng trong GNOME S dng mn hnh v ko th trong GNOME Qun l tp tin S dng cc tiu dng ca GNOME S dng GNOME-TERMINAL Cu hnh GNOME Trnh qun l ca s S dng b iu khin trung tm GNOME Tng quan v h thng X-Window Cu hnh cho X-Window

14. Gii thiu cc dch v Internet ca Linux


Tng quan v cc dch v Internet Ci t Dial-Up trong Linux S dng cc phn mm Web Browser S dng cc phn mm FTP Client S dng Telnet v Email Ci t v cu hnh Web Server Ci t v cu hnh Mail Server Ci t v cu hnh FTP Server Ci t v cu hnh Telnet Server Ci t v cu hnh Proxy Server Thit lp cc ch bo v cho Server

15. H Qun tr C s d liu MySQL


Tng quan v h qun tr c s d liu Cu trc cu lnh SQL v MySQL Cc kiu d liu dng trong MySQL Ci t v cu hnh MySQL Cc thao tc qun tr Database, Table, View Chn, sa, xo bn ghi Truy vn d liu Import, Export d liu
Chuyn 3.4 Trang 56

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Qun tr ngi dng MySQL Kt ni MySQL t cc ng dng khc.

16. H qun tr C s d liu PostGreSQL


Tng quan v h qun tr c s d liu Cu trc cu lnh SQL v PostGreSQL Cc kiu d liu dng trong PostGreSQL Ci t v cu hnh PostGreSQL Qun tr Database, Table, View Chn, sa, xo d liu Truy vn d liu S dng Store Procedure Qun tr ngi dng PostGreSQL Kt ni PostGreSQL t ng dng khc

17. Hng dn s dng Open Office


Gii thiu b phn mm StarOffice Khi to trnh son tho vn bn trong StarOffice Cc khi nim c bn v son tho vn bn nh dng vn bn Bng biu S dng i tng K thut ho In n ti liu Cc khi nim c bn v bng tnh Khi to v cc thao tc c bn trn bng tnh Tnh ton vi cng thc, hm nh dng bng tnh X l v phn tch d liu bng tnh In n bng tnh

18. Gii thiu GNU v phong tro phn mm t do vi ngun m Linux


GNU l g? Khi nim quyn hn i vi phn mm Th no l phn mm t do Phn bit gia phn mm t do v phn mm m ngun m Giy php cng cng GPL Linux v GPL Vit Nam v kh nng c h iu hnh ca ring mnh
Chuyn 3.4 Trang 57

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

IV.3. Kh nng ph cp Linux-VN trong mi trng sinh vin v cc trng i hc ti Vit Nam
IV.3.1. Cc kh khn

Vic ph cp Linux trong iu kin v hon cnh ca Vit Nam hin nay l hon ton khng d dng, c th ni l rt kh khn. Cc kh khn ny bao gm: 1. S lng ngi ang s dng cc h iu hnh dng Linux (Linux, Unix) ti Vit Nam l qu nh b (di 1%). Thc t ny c nhiu nguyn nhn, yu t khch quan v ch quan nhng n l mt trong nhng cn tr ln nht ca vic ph cp h iu hnh Linux-VN ti Vit Nam. Vi hn 99% ngi dng ti Vit Nam ang s dng "Windows", vic a mi trng Linux vo th trng ny chc chn s gp rt nhiu kh khn. 2. Tin hc mi ch xut hin ti Vit Nam ch yu t nhng nm 80 ca th k 20, tc l khi c PC. Trc , my tnh v khoa hc my tnh ch tn ti trong mt vi phng th nghim ca H Ni v thnh ph H Ch Minh v c th coi nh cha c khoa hc ny pht trin ti Vit Nam. Ngay t khi PC vo Vit Nam, cng vi PC l DOS v sau l Windows. Trong cc nh trng i hc, Cao ng ca Vit Nam cng vy, vo nhng nm 80, khi khoa hc my tnh xut hin trong cc nh trng i hc th cng vi chng l DOS v Windows. Nh vy ngay trong cc trng i hc ca Vit Nam hon ton vng bng Unix/Linux. Ngc li Unix xut hin trn khp cc trng i hc trn th gii vo nhng nm 60 ca th k trc v do h rt d dng chuyn i sang mi trng Linux khi xut hin h iu hnh ny vo cui th k trc. y l kh khn ln nht v cng ngh ca vic ph bin Linux ti Vit Nam. 3. Mt nguyn nhn quan trng na phi k n l thi quen dng phn mm khng bn quyn ti Vit Nam. Thc t ny dn n vic mi ngi Vit Nam chng ta u "mc nh" c dng mi phn mm, mi h iu hnh trn th gii. Vi "qui lut" khng thnh vn , h qu hin nhin l i a s ngi Vit Nam s dng h iu hnh no d dng nht, v s l Windows. 4. Mt trong nhng ro cn ln ca vic ph bin Linux trong mi trng Vit Nam l trnh k thut v cng ngh ca ngi Vit Nam chng ta cn qu thp so vi nhu cu. Trnh mt bng chung Cng ngh thng tin ca chng ta cn thp. Do vy chng ta s cn rt nhiu lc cho vic hc tp, nng cao kin thc v truyn b s dng my tnh. Hin ti ch c ngun lc chuyn giao cng ngh v o to hng "Windows" l cn sc p ng c nhu cu s dng ca mi ngi dn. Vi Linux th chng ta hon ton khng lc lm
Chuyn 3.4 Trang 58

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

vic ny. y l mt kh khn trc tip ln nht v chng ta khng th vt qua trong thi gian ngn. 5. Nguyn nhn cui cng v l quan trong nht l vai tr ca nh nc, chnh ph trong cng vic ny cn chm chp v cha r rng. Khi Linux xut hin, nhiu quc gia ng dn trn th gii nh Nht Bn, Trung Quc, n , Pakistan rt quan tm v lp tc coi y l mt c hi ln cho s pht trin ca CNTT ca t nc h, va l c hi pht trin cng ngh, va l c hi thot khi s c quyn ca Microsoft, va l cu cnh cho vn nn bn quyn phn mm. Vi nhiu ngha quan trng nh vy nhiu quc gia coi vic nghin cu v ph bin Linux c ngha sng cn ca li ch quc gia v ra nhng chnh sch thch hp pht trin h iu hnh ny trong phm vi quc gia ca mnh.
IV.3.2. Cc thun li

Nh trnh by trn, vic ph bin Linux ti Vit Nam l rt kh khn trong iu kin v hon cnh hin ti. Kh khn th nhiu, thun li th t. Sau y l lit k mt vi thun li chnh. 1. Xu th Linux trn th gii cng ngy cng pht trin. Hin nay trn Internet, s lng cc Web Site s dng Linux v cc cng ngh c lin quan vt xa so vi Windows. Xu th ny theo nh gi ca nhiu chuyn gia l khng th o ngc. V tt nhin xu th ny s phi nh hng n Vit Nam. 2. Cng vi xu th pht trin Linux trn th gii, cc hng phn mm Linux cng ci tin nhiu nh hng thn thin vi ngi dng hn. Cc h iu hnh Linux ngy cng tr nn d s dng, h tr nhiu phn cng v ngy cng c nhiu cc ng dng hn trn nn Linux.

Chuyn 3.4 Trang 59

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Phn V TM TT CC KT QU NGHIN CU V KIN NGH

Tm tt kt qa nghin cu Trang 60

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Phn V TM TT CC KT QU NGHIN CU
L mt b phn ca ti Nghin cu xy dng h thng tiu chun my tnh thng hiu Vit Nam v cc gii php cng ngh, thit b, t chc trin khai vic kim chun trong phm vi ton quc. ti nhnh Trin khai ph cp H iu hnh Linux-VN cho my tnh thng hiu Vit Nam tp trung nghin cu cc vn cung cp phn mm c bn quyn km theo cc my tnh thng hiu Vit Nam v cc bin php c bn khai ph cp h iu hnh Linux cho cc my tnh thng hiu Vit Nam. Cc ni dung nghin cu bao gm: - Nhng c s php l trong vic xy dng v ph cp cc PMNM v H iu hnh Linux ni ring - Cc vn k thut lin (bao gm c phn cng, phn mm) quan n vn ph cp H iu hnh Linux cho cc my tnh thng hiu Vit Nam. - Ni dung v cc bin php c th trong qu trnh trin khai ph cp h iu hnh Linux cho cc c quan, ngui tiu dng s dng my tnh thng hiu Vit Nam. Cc ni dung trn ln lt c gii quyt trong 5 chuyn . Chuyn 3.1 Nghin cu xut h iu hnh cho my tnh Vit Nam v mt s cng c tin ch m bo quyn s hu tr tu v kh nng ph cp trong nc Xut pht t trit l v quyn ca ngui s dng vi cc sn phm phn mm tin hc ca Richard Stallman, Chuyn 3.1 tm hiu v nhng nguyn tc lm c s php l xy dng nn cc phm mm t do. Qua , xc nh nhng quyn hn, nhng nguyn tc cn phi tun th trong vic s dng v pht trin h iu hnh Linux cho cc my tnh thng hiu Vit Nam. Chuyn tm tt 10 nguyn tc ca GNU phi tun th khi khai thc v pht trin H iu hnh Linux v cc PMNM, t xc nh v cc c s php l cho h iu hnh Linux cho cc my tnh thng hiu Vit Nam v cc bin php dm bo tnh php l khi khai thc v pht trin cc h iu hnh Linux-VN. Chuyn 3.2 Nghin cu gii php phn mm cho a h iu hnh trn my tnh Vit Nam, trong c h iu hnh ch l Linux-VN Chuyn 3.2 nghin cu mt s vn cng ngh c lin quan trong vic pht trin H iu hnh Linux thnh h iu hnh cho cc my tnh thng hiu Vit Nam, bao gm: - Kh nng Dual Boot

Tm tt kt qa nghin cu Trang 61

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

- Vn ci t Linux v Windows trn cng mt my tnh v cc ni dung c th cn thc hin khi trin khai vn ny - Cc qui trnh ci t Linux trn cc my tnh thng hiu Vit Nam y l nhng vn c bn cn gii quyt khi trin khai h iu hnh Linux trn cc my tnh thng hiu Vit Nam, c bit trong iu kin ngi Vit Nam quen s dng h iu hnh Windows. Chuyn khng nh c Linux c kh nng ci t ng thi vi cc h iu hnh khc trn cng mt my tnh nh Windows, OS/2. c bit, chuyn cng a ra cc gii php c th khi ci t Linux cng vi Windows trn cng mt my tnh v xut cc qui trnh ci t h iu hnh Linux cho cc my tnh c lp rp, sn xut ti Vit Nam. Do hn ch v thi gian v qui m ca ti nhnh. Chuyn cha cp n mt s hng nh: pht trin b g, font UNICODE cho Ting Vit, cc gi ti thiu cn c trong H iu hnh v vic pht trin cc cng c tin ch km theo khi s dng H iu hnh. Chuyn 3.3 Nghin cu gii php phn cng cho a h iu hnh trn my tnh Vit Nam, trong c h iu hnh ch l Linux-VN Chuyn 3.3 nghin cu v xut cc gii php phn cng c th thc hin khi dng h iu hnh Linux-VN l h iu hnh ch trn my tnh. Chuyn tp trung nghin cu cc gii php phn cng h tr cho vic ci t nhiu h iu hnh trn cng mt cng v trn nhiu cng, bao gm cc gii php: cng tho lp c, module a cng cuyn nhanh, hp chuyn mch vvChuyn cng trnh by qui trnh c th khi khai thc v s dng b chuyn mch cng Trios 2000 v 2002. Phn cui chuyn c xut cc khuyn ngh phn cng cho ngi s dng. Mt trong nhng hn ch ca H iu hnh Linux l kh nng nhn dng thit b. Hn ch ny s l mt tr ngi trong vic ph cp H iu hnh Linux, c bit l trong mi trng Vit Nam, phn ln cc my tnh trong nc c lp rp t cc cm linh kin nhp t nhiu Hng sn xut khc nhau trong khu vc trong c nhiu Hng sn xut cha pht trin cc h tr Linux trong cc sn phm ca mnh. Tuy nhin, do s pht trin mnh m ca PMNM, ngy cng c nhiu hng sn xut phn cng thng bo h tr Linux trong cc sn phm ca h. V vy, cn c nhng nghin cu, tng kt nhng pht trin ny, gip cho ngi tiu dng Vit Nam nh hng la chn sn phm v cc gii php thay th khuyn ngh cho cc nh lp rp my tnh Vit Nam khi h mun s dng H iu hnh Linux trong cc sn phm ca mnh. Trong khun kh ca chuyn , cha cp c phn ny. Chuyn 3.4 Xy dng chng trnh v bin php trin khai ph cp Linux-VN trong cc c quan Nh nc v trong o to

Tm tt kt qa nghin cu Trang 62

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

Ni dung chuyn 3.4 l xut mt bin php c th trong vic trin khai o to Linux-VN. Bao gm vic xc nh, phn loi cc hng v cc i tng o to. Cc hng pht trin o to ph cp c xut l: - o to ph cp Linux-Vn cho cc c quan doanh nghip c s dng my tnh thng hiu Vit Nam - Ph cp Linux trong gio dc v o to. Trong qu trnh o to, cn phn lp cc nhm i tng xy dng ni dung, chng trnh o to ph hp. Chuyn cng xut 18 chng trnh khung v cc ni dung cn o to cho cc i tng thuc cc c quan doanh nghip Ph cp Linux trong gio dc v o to l mt vn ln, lin quan n nhiu ngnh, nhiu lnh vc v cn c nhhng ti ring cho hng ny. Chuyn ch khng nh rng, y l ni dung cn phi thc hin trong trin khai ph cp h iu hnh Linux v nhng kh khn thun li khi trin khai. Chuyn 3.5 Cc ti liu phc v o to ph cp Chuyn 3.5 chim mt khi lng ln trong ti nhnh. Mc tiu ca chuyn l xy dng nhng ti liu c bn phc v cho vic trin khai o to ph cp h iu hnh Linux-VN. Cc ti liu ph cp c bin soan thnh bn ti liu: - Hng dn ci t h iu hnh Linux-VN: Ti liu ny trnh by cc buc c th h tr cc doanh nghip lp rp my tnh v ngi s dng ci t h iu hnh Linux-VN trn cc my tnh thng hiu Vit Nam. Ti liu bao gm 26 trang, trnh by cc ni dung v H iu hnh, cc bc ci t, cch s dng ting Vit v in n. - Linux-VN Cc lnh c bn: 213 trang, trnh by cc lnh c bn ca Linux, gip ngi s dng khai thc Linux trong qu trnh s dng - Giao din ho GNOME: 118 trang, gii thiu v cch t chc v mi trng giao din ho s dng trong Linux. Ti liu gip ngi dng khai thc Linux trong qu trnh s dng. - Hng dn s dng StarOfice: 58 trang, ti liu gii thiu v hng dn s dng StarOfice, b PMNM ng dng rt cn thit cho mi i tng. Cc ti liu trn c th dng lm c s xy dng cc ni dung o to trong cc chng trnh khung xut chuyn 3.4.

Tm tt kt qa nghin cu Trang 63

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

KIN NGH

h iu hnh Linux-VN c tr thnh ph cp i vi ngi Vit Nam, cn phi xem vic ph cp H iu hnh Linux l mt b phn khng th tch ri ca chng trnh quc gia v pht trin PMNM, ng thi cng l mc tiu ca nhng nh pht trin h iu hnh. vn trn thnh hin thc, chng ti kin ngh: - Vic ph cp h iu hnh Linux phi c quan tm t pha Nh nc. Thc t cho thy, quc gia no coi trng vic pht trin PMNM, PMNM quc gia c c hi pht trin mnh v mang la nhng li ch to ln. S quan tm y phi c th hin t vic u t, chnh sch pht trin n cc bin php o to ph cpvv. - Phi coi trng vn php l ngay t khi mi bt u xy dng sn phm. m bo cho cc sn phm c mt nn tng php l chc chn. - Kh nng d ph cp ca sn phm phi c qun trit trong st qu trnh xy dng v pht trin sn phm, th hin t tnh u vit ca sn phm n tnh tng thch vi cc sn phm khc (bao gm c vic pht trin kh nng h tr phn cng a dng n kh nng tng thch vi cc phn mm khc vv). - Phi to ra mt mi trng hc tp a dng v Linux: t mi trng hc tp cho hc sinh, sinh vin, n cc chng trnh o to ph cp, nng cao cho nhng c quan n v chuyn sang s dng h iu hnh Linux.

Kin ngh Trang 64

KC-06-03CN

n Trin khai ph cp H iu hnh Linux-VN

TI LIU
O TO PH CP LINUX-VN
(Chuyn 3.5)

Hng dn ci t H iu hnh Linux-VN Linux-VN - Cc lnh c bn Giao din ha GNOME Hng dn s dng StarOffice

Ti liu ph cp Linux-VN

H Ni - 2002

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

Mc Lc
H iu hnh LinuxVN 1.0 ................................................................................. 1 I. Gii thiu v h iu hnh LinuxVN 1.0................................................................... 1 1. H iu hnh LinuxVN l g? ............................................................................... 1 2. Nhng tnh nng ca LinuxVN OS 1.0 ................................................................. 1 3. H tr cc i tng.............................................................................................. 2 II. Hng dn ci t LinuxVN 1.0 (Installation Guide) .............................................. 3 1. Yu cu phn cng ................................................................................................ 3 2. Cc trng hp ci t........................................................................................... 3 3. Cc bc chnh .................................................................................................... 10 4. Chi tit cc bc.................................................................................................. 10 a/ Chun b ci t (Before you begin)................................................................ 10 b/ Chn ngn ng (Language Selection) - hnh 01. ............................................ 11 c/ D tm bn phm (Keyboard Type) - hnh 02.................................................. 11 d/ Mn hnh cho hi (Welcome to LinuxVN) - hnh 03. .................................. 12 e/ Chn kiu ci t (Installation Type) - hnh 04............................................... 12 f/ Chn kiu phn vng (Partitioning Method) - hnh 05.................................... 13 g/ Phn vng bng tay (Manual Partition). ......................................................... 14 h/ Chn phn vng cn nh dng (Format) - hnh 07. ....................................... 15 i/ Thit lp tn my (Hostname) - hnh 8. ........................................................... 15 k/ D tm chut (Mouse Type) - hnh 9. ............................................................. 16 l/ Chn mi gi (Timezone) - hnh 10................................................................. 16 m/ Mt khu ngi dng Root (Root Password) - hnh 11. ................................ 17 n/ D tm X (X Probe) - hnh 12. ........................................................................ 18 o/ Thng bo bt u ci t (Beginn Installation). ............................................ 18 p/ nh dng cc h thng file (Format Filesystems). ........................................ 18 q/ Mn hnh ci t chnh (Install System) - hnh 13.......................................... 18 r/ Cu hnh ln cui (Post Install)........................................................................ 19 s/ To a khi ng (Make Bootdisk) - hnh 14. .............................................. 19 t/ Ci t mn hnh (Monitor Setup).................................................................... 20 x/ Kt thc ci t (Complete). ........................................................................... 23 Ting Vit trn LinuxVN OS 1.0.................................................................... 24 1. Ting Vit trong mi trng text console ............................................................... 24 1.1. Font ch............................................................................................................ 24 1.2. B g ................................................................................................................ 24 2. Ting Vit trong mi trng X Window System .................................................... 25 2.1. Font ch............................................................................................................ 25 2.2. B g ................................................................................................................ 25 In n trong LinuxVN OS 1.0 ............................................................................ 26 1. Hng dn ci t my in trong h iu hnh LINUXVN 1.0 ............................... 26 2. In Ting Vit trong Netscape .................................................................................. 27

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

H iu hnh LinuxVN 1.0

I. Gii thiu v h iu hnh LinuxVN 1.0


1. H iu hnh LinuxVN l g? LinuxVN OS 1.0 l H iu hnh u tin do cc chuyn gia tin hc Vit Nam thit k, xy dng theo n t hng ca d n Linux Vit Nam do Tng cng ty in t v Tin hc Vit Nam (VEIC) ch tr. Da trn bn RedHat 6.2 vi nhn l Linux kernel 2.2.14, ln u tin, ngi Vit Nam lp ghp thnh cng mt h iu hnh vi cc giao din Vit ho 50% v cht lng tng ng cc H iu hnh cng loi nh Debian, Mandrake, RedHat, Slackware. Vi nh hng Linux, LinuxVN OS 1.0 l sn phm thng mi theo cc nguyn tc ca GNU - m ngun m. 2. Nhng tnh nng ca LinuxVN OS 1.0 Vi mc tiu l lm cho Linux ngy cng thn thin sao cho ngi s dng c th d dng ci t v dng n ngay trn PC ca mnh, phin bn th nghim c nhng tnh nng sau: - LinuxVN h tr ti a cc ng dng mng, CSDL cng nh cc ng dng vn phng. - Trnh ci t c ci tin sao cho d dng i vi ngi s dng khng chuyn tin hc (nhng ci tin s c nu ln lt trong cc bc sau). Hin ti, trnh ci t mi ch vn bn (TEXT MODE). Bn hon ton c th ci t t a CDROM, t cng hay t a mm. Vit ho hon ton trnh ci t v mt phn ca h thng. - LinuxVN tch hp vi hn 450 gi tin ch v ng dng quan trng nht, cc gi phn mm c xem l khng cn thit i vi ngi dng cui (end user) c lc b, lm cho h thng gn nh hn, r rng hn. - a thm mt s phn mm c xem l cn thit nh b g Telex, mt s ngn ng lp trnh thng dng nh Pascal, Java, ... Ln u tin bi ton ting Vit vi bng m 8-bit c gii quyt trn vn trong H iu hnh LinuxVN.

Trang 1

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

3. H tr cc i tng Bn th nghim a ra mt dng sn phm duy nht nhm ti vn phng, cng s, trng hc... v c trang b cc tnh nng sau: Giao din ho GNOME. H tr in n (Printing). Cc tin ch vn phng nh StarOffice,... Cc phn mm, tin ch cho LAN (Workstation) v Internet. H tr a phng tin (Multimedia). Tr chi v x l ho (Games & Graphics Manipulation). Cng c pht trin (Development Tools). V mt s tnh nng khc.

Trang 2

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

II. Hng dn ci t LinuxVN 1.0 (Installation Guide)


1. Yu cu phn cng LinuxVN chy trn cc my Intel x86, Pentium v cc b vi x l c cu trc tng thch tc 166MHz tr ln, b nh ti thiu 16 MB, a cng ti thiu l 200MB (h thng c bn khng c giao din ho v cc dch v v mng), ti a l 900MB (bao gm tt c cc ng dng, c giao din ho X Window trn mi trng GNOME v cc dch v v mng bao gm c cc dch v cho my ch nh NIS, DNS, NFS, SAMBA, WebServer, FTP Server...), trung bnh khong 500MB cho mt trm lm vic in hnh vi cc dch v c bn cho mng (phn Client), cc ng dng vn phng, ... 2. Cc trng hp ci t LinuxVN c th chy n nh, song song cng vi nhiu h iu hnh khc (Windows95/98, Windows NT, OS/2 ...) trn cng mt my tnh. Vic ci t v cu hnh cho LinuxVN v cc h iu hnh khc hot ng ng l mt iu quan trng. ci t h iu hnh LinuxVN v cc h iu hnh khc trn cng mt a cng bn cn lu nhng trng hp sau: a/ Bn ang s dng h iu hnh Windows 9x - a cng c mt phn vng duy nht: Sp xp li d liu trn cng bng cch s dng trnh Disk Defragmenter (ngoi ra bn cng c th s dng cc cng c khc nu mun). chy trnh Disk Defragmenter, bn thc hin cc bc nh sau:

+ Chn Start / Program / Accessories / System Tools / Disk Defragmenter + Hp thoi Select Drive xut hin cho php bn xc nh a cng cn sp xp d liu. Nhn OK v hy kin tr i mt thi gian tu theo dung lng a cng ca bn.

Trang 3

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

+ Sau khi qu trnh trn kt thc, bn khi ng li my, vo BIOS CMOS v chn ch khi ng t CDROM bt u qu trnh ci t LinuxVN 1.0. a cng c hai phn vng: Vic dn d liu vo vng cng nht nh s gip bn c c mt phn vng logic ri t nht l 550M thun tin cho vic sp xp li d liu. Sau hy bt u cng vic ci t LinuxVN.

V d : Trong trng hp ny chng ta nn dn d liu vo C & D, sau sp xp li d liu trong E, (cc bc sp xp lm tng t nh a cng ca bn khng phn vng logic )

b/ Bn ci t LinuxVN v mun b sung thm Windows Nh ta bit, khi bt my, u tin BIOS s tin hnh kim tra phn cng v mt s vic khc. Tip theo, n s tin hnh c sector u tin ca a khi ng. Nu bn chn khi ng t a mm, sector u tin chnh l boot setor. Sector ny cha mt on chng trnh nh np h iu hnh. Nu bn khi ng t a cng, sector c np ln l Master Boot Record (MBR). Sector ny c cha mt chng trnh np v bng phn vng (partition table) cha cc thng tin v cc phn vng trn a cng. Chng trnh np chim 446 byte u tin ca MBR, 64 byte tip theo chnh l bng phn vng, hai byte cui cng nh du kt thc MBR c gi tr 0xAA55. Bnh thng, chng trnh np s chn phn vng c nh du tch cc (active) np sector u tin ca phn vng ny. Sector ny chnh l boot record ca phn vng tng ng, s c nhim v np h iu hnh c ci trn n v tr iu khin cho h iu hnh . C rt nhiu cch h thng np c nhn ca Linux a vo hot ng. l cc trnh np LILO, SYSLINUX, LOADLIN. Trong khun kh bi vit ny, chng ti ch gii thiu vi cc bn cch hot ng ca chng trnh LILO. LILO l chng trnh np Linux thng dng nht hin nay. N khng ph thuc vo h thng file xc nh no, n c th np nhn Linux t a mm, t a cng v c th hot ng nh "Boot manager" i vi cc h iu hnh khc. Mt cch d hiu nht, LILO l mt chng trnh cho php bn la chn khi ng cc h iu hnh khc nhau. Nu bn thc hin vic ci t h iu hnh LinuxVN trc th LILO s c ci trn MBR. Sau tin hnh ci t Win95/98, tin trnh ci t cc h iu hnh ny s s dng MBR ca a cng trong qu trnh hot ng, nh vy LILO trn MBR s b sa i v trong ln khi ng tip theo, LILO khng hot ng c na. Nguyn nhn l do LILO b sa i trn MBR, vn ny c gii quyt theo phng php n gin sau: thc hin vic khi ng LinuxVN bng a mm, sau chy chng trnh /sbin/lilo np li LILO trn MBR. LILO t ng nhn
Trang 4

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

ra cc phn vng ang c trn a cng v ln khi ng sau, LILO cho php bn chn h iu hnh hot ng nh bnh thng. C th cc bc thc hin nh sau: - Ci t h iu hnh LinuxVN. - Trong trng hp ny c th chy ng thi song song hai h iu hnh bn phi to a mm khi ng cho LinuxVN. Nu khng, bn ch c th s dng c h iu hnh Windows. to a mm khi ng cho LinuxVN bn lm nh sau: Ti du nhc g lnh: mkbootdisk `uname r` (Lu : du nhy bao tham s uname -r l du ` ). - Sau khi to xong a mm khi ng, bn hy thc hin vic ci t h iu hnh Windows. - Khi ng LinuxVN t a mm. Thay i mt s cc thng s trong tp tin /etc/lilo.conf. Di y l v d c th ca mt file cu hnh lilo trn mt my tnh chy song song hai h iu hnh LinuxVN v Windows 98: boot=/dev/hda1 map=/boot/map install=/boot/boot.b prompt timeout=0 message=/boot/message linear default=linux image=/boot/vmlinuz-2.4.2-2 label=linux read-only root=/dev/hda5 other=/dev/hda2 label=windows Trong : - hda1, hda2 l cc phn vng tng ng ci t h iu hnh LinuxVN v Windows 98. - default=linux l dng khai bo h iu hnh khi ng mc nh, bn hon ton c th thay i chn h iu hnh mc nh l Windows bng cch thay default=windows. - label=linux, label=windows l nhn khai bo tn h iu hnh c ci t trn h thng. - Ci t li LILO trn MBR bng cch chy chng trnh /sbin/lilo.
Trang 5

# Mc nh khi ng LinuxVN

# y l hai dng bn s phi thm vo khai bo thm h iu hnh mi c ci t

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

- Khi ng li my. Nhn xt: ni chung, thc hin ci t cc h iu hnh Windows trc sau mi ci t LinuxVN n gin hn vic thc hin ci t h LinuxVN trc. c/ a cng ca bn ln hn 15G i vi a cng ln hn 15G, vic ci t s phc tp hn rt nhiu. c th ci t trn loi a ny bn cn c mt s kin thc c bn v h thng (cch phn vng a cng...). LinuxVN ch c th chy c khi th mc cha nhn h thng (/boot) nm trn 1 trong 4 primary. Mt s trng hp sau c th xy ra: a cng trng cha c d liu Trong qu trnh phn chia a, bn phi to thm mt phn vng linux native c dung lng 10Mb-15Mb. Nhng ht sc ch phn <kiu tn gn> bt buc phi g /boot, y l bc thc hin rt kh. a cng cha khong 10G d liu a cng c 4 primary c th ci t trong nhng trng hp ny, bn nn s dng cc tin ch nh FIPS, Parted, Partition Magic... y xin gii thiu vi cc bn tin ch PARTED, theo chng ti, y l mt cng c tr gip rt tt. + Gii thiu chung v chng trnh Parted Chng trnh Parted l mt chng trnh min ph do Andrew Clausen pht trin. Chng trnh ny c th lm c rt nhiu vic mt cch d dng v an ton (v d nh: to cc phn vng cng mi (create new partition), xo phn vng c (delete old partition), thay i kch thc ca mt phn vng c (resize partition), sao chp (copy partition). Ngoi ra Parted cn c th thay i, to mi mt s kiu h thng file (file system v d nh ext2, fat ...) bn trong cc phn vng. + Ti sao chng ti khuyn cc bn nn dng Parted? Gi s rng bn ang dng MS Windows hoc mt h iu hnh no v bn mun chuyn sang dng LinuxVN v s hp dn ca n nhng li khng mun b HH ang dng cng nh cc thng tin hay d liu c. lm c nh vy bn cn phi to ra mt phn vng (partition) mi ci LinuxVN. Nu bn dng cc chng trnh phn vng thng thng nh Fdisk, Fips, Partiton Magic ... th: - Fdisk: s to ra phn vng mi nhng ng thi xo lun d liu c ca bn. - Fips: c th to phn vng mi m khng mt d liu nhng rt kh dng. - Partition Magic: d dng hn Fips v khng mt d liu nhng bn phi tr kh nhiu tin c c n mt cch hp php. Chnh v vy m chng ti khuyn bn nn dng chng trnh Parted. Chng ti th nghim mt cch nghim tc v thy rng: t c mc ch l to phn vng mi cho vic ci t Linux m khng nh hng n d liu sn c th Parted l mt chng trnh cc k hu ch v rt d s dng. tr thnh ngi dng Parted thnh tho, bn ch cn lm quen vi mt vi khi nim n gin.
Trang 6

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

+ Khi ng Parted u tin bn phi khi ng my t a mm cha Parted, sau ch cho n khi trn mn hnh hin ra dng: Bash# _ th g Parted khi ng chng trnh Parted. Trn mn hnh s hin ra nh sau: (Parted) _ chng trnh bt u chy . + Tp lnh ca Parted Rt may cho chng ta l Parted c mt tp lnh n gin nhng rt hiu qu nn vic hc cch s dng n tr nn d dng hn rt nhiu. Cc lnh ca Parted: check MINOR: kim tra xem phn vng th MINOR c li khng. - cp FROM-DEVICE FROM-MINOR TO-MINOR: copy h thng file (filesystem) t phn vng FROM-MINOR ti phn vng TO-MINOR. help: hin th tr gip v chng trnh. mklabel LABEL-TYPE: to nhn mi cho a.

- mkfs MINOR FS-TYPE: to h thng file FS-TYPE cho phn vng MINOR. - mkpart PART-TYPE FS-TYPE START END: to phn vng mi c loi PART-TYPE, ch ra kiu h thng file l FS-TYPE, bt u t START cho ti END. - mkpartfs PART-TYPE FS-TYPE START END: to phn vng mi c loi PART-TYPE, to kiu h thng file l FS-TYPE, bt u t START cho ti END. Lnh ny tng ng vi 2 lnh mkpart v mkfs. - move MINOR START END: di chuyn phn vng MINOR n vng nh khc bt u bng START v kt thc bng END. - name MINOR NAME: t tn cho phn vng th MINOR l NAME (ch : NAME phi nm trong cp du ). V d: name 1 First partition print: in thng tin ca a ra mn hnh. quit: thot khi Parted.

- resize MINOR START END: thay i dung lng ca phn vng th MINOR, dung lng mi s bt u t START (MB) n END (MB) - rm MINOR: xo partition th MINOR (ch : d liu nm trn phn vng ny s mt ht). select DEVICE: chn a lm vic.

Trang 7

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

- set MINOR FLAG STATE: thay i c FLAG cho phn vng MINOR vi trng thi mi l STATE. Ton b tp lnh ca Parted l 15 lnh nhng phc v cho mc ch tch mt phn dung lng ca mt phn vng c ci Linux m khng lm mt d liu th bn ch cn s dng 6 lnh sau: help, mkpart, print, quit, resize, select. + Cc gi tr c th c ca cc tham s FLAG: boot, root, swap, hidden, raid, lvm, lba. FS-TYPE: ext2, FAT, hfs, linux swap, ntfs, reiserfs. LABEL-TYPE: bsd, mac, loop, pc98, msdos. MINOR: s ca partition. PART-TYPE: primary, logical, extended. START, END: s bt u v kt thc ( /v l MB). help: hin phn tr gip cho tng lnh hoc cho c Parted.

+ Cch dng lnh v v d V d: (parted) help > hin phn tr gip cho c Parted (thng tin v tp lnh ca Parted). (parted) help tn_lnh: hin ra phn tr gip ca lnh tn_lnh. - resize: thay i dung lng ca phn vng. y l lnh quan trng nht, gim dung lng phn vng MINOR th ch cn gim tham s END, cn mun tng dung lng ca n th ngc li (tt nhin l ch tng c khi cn a trng). Nu dung lng cn trng ca phn vng MINOR < (END START) th bn ch to ra c mt vng trng mi ti a bng vi dung lng trng hin thi ca phn vng MINOR. D liu sn c trn a s c dn v u phn vng. Ch : nu trong lnh resize m thay i thng s START th ng ngha vi vic xo ton b d liu c trong phn vng MINOR. - mkpart PART-TYPE FS-TYPE START END: to phn vng mi vi dung lng l END START trong phn a trng m lnh resize va to ra. V d: nu mun to mt phn vng mi c dung lng l 500 MB t MB 1200 -> MB 1700 th g nh sau: (parted) mkpart primary (logical) ext2 1200 1700 ext2 l kiu h thng file ca phn vng (Linux ch c th ci trn mt phn vng kiu ext2 khng ci c trn cc h thng file khc nh fat, ntfs ...). - Print: in ra thng tin v dung lng a, cc phn vng c -> dung lng a cn trng (cha c partition no s dng). select: chn a (Disk drive ) cn thay i. Ch : trong Parted, cc thng tin hin th u theo kiu ca Linux nn c mt s khi nim khc vi Dos. Khi c nhiu hn mt cng trong my th Parted s coi:
Trang 8

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

Primary master drive (harddisk 1) nh /dev/hda. Primary slave drive (harddisk 2) nh /dev/hdb. Secondary master drive (harddisk 3) nh /dev/hdc. secondary slave drive (harddisk 4 hoc Cdrom) nh /dev/hdd. V d: Nu bn mun thao tc trn a cng th 2 th g: (parted) select /dev/hdb cn nu mun lm vic trn a th 3 th g: (parted) select /dev/hdc mc nh ca Parted l lm vic trn /dev/hda. quit: thot khi Parted. + Mt s thng tin bn cn bit - Nu cng ca bn ln hn 8.4 GB th ci c Linux bn phi to mt vng partition ext2 c dung lng khong 16M nm trong khong 1024 Cylinder u tin (khong 7.5 GB u ) lm phn vng /boot khi bn ci Linux sau ny (y l mt li ca Bios khi chy Linux bn thn Linux khng s dng ngt ca Bios nhng LILO dng ngt 13h ca Bios ti nhn Linux nn b li ny). Sau bn cn phi to thm mt phn vng ext2 cha bn thn h iu hnh Linux (c th primary hoc logical - khi ci Linux bn s gn vng ny thnh / ) v mt phn vng linux swap (khong 100 Mb, t hn hay nhiu hn l tu thuc vo bn nhng khng nn thp qu, ni chung nn bng dung lng ca RAM), vng ny khi ci t Linux bn s gn n l linux swap. - Trong phin bn hin thi, Parted cha h tr hon ton cho nhiu h thng file khc nhau, sau y l bng cc h m Parted h tr: H thng file ext2 Fat Hfs Linux-swap Ntfs Reiserfs nhn ra yes yes yes yes yes yes to mi yes yes no no no no thay i yes yes no no no no sao chp yes yes no no no no kim tra yes yes No No No No

- Ngoi chc nng to phn vng mi ci Linux, Parted cn c th lm c rt nhiu vic khc thm ch l phn vng cho c mt a cng mi, to Raid, Lvm ... Phn cn li thc hin nh mt cng thng thng. d/ My tnh ca bn cha ci h iu hnh no Vn li rt n gin, bn ch cn thc hin ng cc bc ci t c bn ca LinuxVN.

Trang 9

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

3. Cc bc chnh 1. Chun b ci t (Before you begin). 2, Chn ngn ng (Language Selection). 3, D tm bn phm (Keyboard Type). 4, Mn hnh cho hi (Welcome to LinuxVN). 5, Chn kiu ci t (Installation Type). 6, Chn kiu phn vng (Partitioning Method). 7, Phn vng bng tay (Manual Partition). a, Thng tin phn vng hin thi (Current Partitions). b, Sa cc phn vng tn ti (Edit). c, Thm cc phn vng mi (Add). 8, Chn phn vng cn nh dng (Format). 9, Thit lp tn my (Hostname). 10, D tm chut (Mouse Type). 11, Chn mi gi (Timezone). 12, Mt khu ngi dng Root (Root Password). 13, D tm X (X Probe). 14, Thng bo bt u ci t (Beginn Installation). 15, nh dng cc h thng file (Format Filesystems). 16, Mn hnh ci t chnh (Install System). 17, Cu hnh ln cui (Post Install). 18, To a khi ng (Make Bootdisk). 19, Ci t mn hnh (Monitor Setup). a, Kiu mn hnh (Monitor Type). b, Chn ch (Mode Selection). c, Chn vng tn s qut (Frequency Range). d, D tm (Probe). e, Kt qu d tm (Result). f, Chn phn gii v su mu (Resolution & Color depth). g, Kim tra cu hnh X (X Testing). 20, Kt thc ci t (Complete). 4. Chi tit cc bc a/ Chun b ci t (Before you begin) Xc nh phn cng c bn c ci t trn my: Hard drive(s): Phi nm c kch c, kiu, s lng cng...
Trang 10

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

Memory: RAM CD-ROM: Kiu giao din (IDE, SCSI,...). SCSI adapter (nu c) Network card (nu c) Mouse: Kiu chut (serial, PS/2, bus mouse), giao thc (Microsoft, Logitech...). b/ Chn ngn ng (Language Selection) - hnh 01. Trnh ci t cho php chn mt trong hai ngn ng l: English Vietnamese

(hnh 01 - chn ngn ng) Sau khi chn ngn ng, nhn OK hay Tip tc tip tc trnh ci t. c/ D tm bn phm (Keyboard Type) - hnh 02. Bc tip theo, trnh ci t cho php bn la chn kiu bn phm. Bn nn chn bn phm ng vi ngn ng chn y. Trong hu ht cc trng hp trnh ci t t d tm kiu bn phm, kt qu d tm thng l bn phm us. Nu thy kt qu d tm sai vi thng s bn phm ca bn th chy trnh /usr/sbin/setup sau khi ci t kt thc.

Trang 11

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

(hnh 02 - d tm kiu bn phm) Nhn OK hoc Tip tc tip tc trnh ci t. d/ Mn hnh cho hi (Welcome to LinuxVN) - hnh 03. Mn hnh cho hi v gii thiu.

(hnh 03 - mn hnh cho hi) Nhn "OK" hoc "Tip tc" tip tc trnh ci t. e/ Chn kiu ci t (Installation Type) - hnh 04. Bn chn mt trong bn kiu ci t sau: - LinuxVN OS Workstation (nu bn ci cho mt trm lm vic thng thng). LinuxVN OS Server (ci cho my ch). LinuxVN OS Custom (tu chn cc gi ci t).

Trang 12

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

Upgrade the existing system (nng cp bn tn ti).

(hnh 04 - kiu ci t) Nhn OK hoc Tip tc tip tc trnh ci t. f/ Chn kiu phn vng (Partitioning Method) - hnh 05. Chn mt trong hai kiu phn vng sau: Phn vng t ng - Auto Partitioning (trnh ci t s phn vng t ng v s xo thng tin trn cc phn vng lin quan n Linux trc nh Linux native, Swap,... nu c). Nu chn kiu phn vng ny th b qua bc g. Phn vng bng tay - Manual Partitioning (bn s phi tin hnh phn vng v cu trc cc phn vng trn a cng u do s la chn ca bn).

(hnh 05 - kiu phn vng)


Trang 13

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

Nhn OK hoc Tip tc tip tc trnh ci t. g/ Phn vng bng tay (Manual Partition). a, Thng tin phn vng hin thi (Current Partitions) - hnh 06. Trnh ci t s hin th thng tin v cc phn vng hin thi nh: im kt gn (mount point). Thit b (device). Kch thc (size). Kiu h thng file trn phn vng (Filesystem Type). Thng tin v a vt l nh cc thng s C/H/S, size,...

Trnh ci t cho php xo, sa v thm mi cc phn vng.

(hnh 06 - thng tin v cc phn vng hin thi) Sau khi phn vng hon thnh, chn "OK" hoc "Xong" tip tc. b, Thm mt phn vng mi (Add) Cn xc nh cc thng tin sau thm mi mt phn vng: im kt gn (mount point): S dng phm mi tn a thanh sng n v tr ny v nh vo im kt gn ca phn vng bn mun to. V d nu bn mun to phn vng gc hy nh vo /; nh vo /usr cho phn vng /usr... Kch thc (size): nh vo kch thc ca phn vng mi.

Trang 14

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

Kiu h thng file (Filesystem Type): ext2. V mt s thng tin khc.

c, Sa cc phn vng tn ti (Edit) Tin hnh sa mt phn vng bao gm hiu chnh cc thng tin sau: im kt gn (mount point): Thay i v tr kt gn. V d /usr Kch thc (size): Sa li kch thc theo MB Kiu h thng file (FAT32, ext2, Swap, ...): Thay i kiu h thng file V mt vi thng tin khc.

h/ Chn phn vng cn nh dng (Format) - hnh 07. Sau khi phn vng bc 6 (nu chn phn vng bng tay), bn phi nh du cc phn vng cn nh dng.

(hnh 07 - chn phn vng cn nh dng) Nhn OK hoc Tip tc tip tc trnh ci t. i/ Thit lp tn my (Hostname) - hnh 8. Khng nht thit phi thit lp tn my, iu ny c th lm sau khi ci t. Tuy nhin chng c g kh khn nh vo tn my ca bn, chng hn: linuxsrv.linuxvn.net

Trang 15

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

(hnh 8 - thit lp tn my) Nhn OK hoc Tip tc tip tc trnh ci t.

k/ D tm chut (Mouse Type) hnh 9. Trnh ci t t d tm kiu chut. Nu thy kt qu d tm sai vi thng s chut ca bn th chy trnh /usr/sbin/setup sau khi ci t kt thc.

(hnh 9 - kt qu d tm chut) Nhn OK hoc Tip tc tip tc trnh ci t. l/ Chn mi gi (Timezone) - hnh 10. Trnh ci t cho php bn chn v tr a l cho my ca bn cng nh vic c thit lp ng h phn cng theo gi GMT hay khng. Nu my tnh ca bn s dng c MS Windows th vic thit lp ng h phn cng theo gi GMT (UTC) s lm cho MS Windows hin th sai thi gian. Mc nh l Asia/Hanoi.

Trang 16

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

(hnh 10 - chn mi gi) Nhn OK hoc Tip tc tip tc trnh ci t. m/ Mt khu ngi dng Root (Root Password) - hnh 11. H thng cho php mt ngi dng c y mi quyn hn, chnh l siu ngi dng (SuperUser - Root). Trong qu trnh ci t, cn phi nhp mt khu ngi dng Root (di t nht 6 k t). Bn cng c th i li c mt khu ny sau khi ci t. H thng cho php bn ng nhp bng ti khon ny thc hin cc cng vic qun tr. Mt khu root l mt chui k t d nh i vi bn, nhng phc tp ngi khc khng th on c. Mt mt khu tt l mt t hp t tp cc ch s, ch ci hoa v ch ci thng. hieu791201PX l mt v d v mt khu an ton. Hy ghi li mt khu ca bn vo mt ni thc s an ton phng khi qun.

(hnh 11 - mt khu ngi dng root) Nhn OK hoc Tip tc tip tc trnh ci t.

Trang 17

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

n/ D tm X (X Probe) - hnh 12. Trnh ci t tin hnh d tm Video Card. Nn nh khng phi loi Video Card no Linux cng h tr.

(hnh 12 - kt qu d tm Video Card) Nhn OK hoc ng tip tc trnh ci t. o/ Thng bo bt u ci t (Beginn Installation). Thng bo qu trnh sao chp thng tin t a bt u. y l c hi cui ngi dng ra sot li cc thng s c thit lp cc bc trc. Nhn OK hoc Tip tc tip tc trnh ci t. p/ nh dng cc h thng file (Format Filesystems). Trnh ci t tin hnh nh dng cc h thng file chn bc h. Nhn OK hoc Tip tc tip tc trnh ci t. q/ Mn hnh ci t chnh (Install System) - hnh 13. y l mn hnh chnh ca trnh ci t. Ch cho qu trnh ny thc hin xong v n bc tip theo.

Trang 18

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

(hnh 13 - mn hnh ci t chnh) r/ Cu hnh ln cui (Post Install). Trnh ci t tin hnh cu hnh ln cui. s/ To a khi ng (Make Bootdisk) - hnh 14. Trnh ci t hi xem bn c to a khi ng. Thng thng bn khng phi to a khi ng v trnh np LILO c mc nh ci trn MBR (Master Boot Record).

Trang 19

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

(hnh 14 - to a khi ng) Nu mun to a mm khi ng dng trong cc trng hp cn thit, hy cho a mm vo v nhn Yes hoc C. Chn No hoc Khng khi khng cn to. t/ Ci t mn hnh (Monitor Setup). y l bc thit lp hu ht cc thng s v mn hnh. a, Kiu mn hnh (Monitor Type) - hnh 15. Thng th trnh ci t s d kiu mn hnh cho bn, nhng khi d khng c, bn hy chn kiu La chn.

(hnh 15 - kiu mn hnh) Nhn OK hoc ng tip tc trnh ci t. b, Chn ch (Mode Selection) - hnh 16. Nu trnh ci t khng d tm thy mn hnh th buc bn phi ch ra cc thng s nh mode (VGA, SVGA, ...), tn s qut, phn gii,...

Trang 20

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

(hnh 16 - chn ch ) Nhn OK hoc ng tip tc trnh ci t. c, Chn vng tn s qut (Frequency Range) - hnh 17. Chn vng tn s qut cho ph hp vi tn s qut bn chn bc trc.

(hnh 17 - chn vng tn s) Nhn OK hoc ng tip tc trnh ci t. d, D tm (Probe) - hnh 18. Tin hnh d tm X.

Trang 21

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

(hnh 18 - d tm) Nhn OK hoc ng tip tc trnh ci t. e, Kt qu d tm (Result) - hnh 19. Kt qu d tm X.

(hnh 19 - kt qu d tm) Nhn Let me choose hoc ti chn chn phn gii v su mu. Nhn "Use default" hoc "Dng mc nh" chp nhn ch mc nh ca h thng. f, Chn phn gii v su mu (Resolution & Color depth) - hnh 20.

Trang 22

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

Bn c th s dng phn gii v su mu mc nh do h thng d tm trong bc trc hoc t la chn theo mnh.

(hnh 20 - chn phn gii v su mu) Nhn "OK" hoc "ng " tip tc. g, Kim tra cu hnh X (X Testing). Th kch hot X xem cc thng s ph hp cha. Nu thnh cng th nhn OK hoc Tip tc kt thc. Nu tht bi th thit lp li hoc chp nhn tht bi thit lp li vo mt dp khc. x/ Kt thc ci t (Complete). Kt thc qu trnh ci t.

Trang 23

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

Ting Vit trn LinuxVN OS 1.0


1. Ting Vit trong mi trng text console
1.1. Font ch Trong mi trng text console, ch hin th ASCII, font ch th hin ting Vit theo tiu chun TCVN3 l tcvn8x16.psf . 1.2. B g i vi mi trng text console, bn c th s dng lnh gvnkey np b g ting Vit (tuy nhin lm c iu ny, bn phi c quyn root). B g ting Vit trn text console ca chng ti l mt chng trnh thng tr, di dng mt kernel-module, c tn l gvnkey. nhn bit b g c c np hay khng, bn gc trn bn phi ca mn hnh c dng ch nh nhp nhy th hin trng thi ca chng trnh (ENG-g ting Anh, TELEX-g kiu telex, ...). chuyn i kiu nhp liu khi s dng b g, hy dng t hp phm Alt+Z. Hoc nhn ng thi cc phm CTRL+ALT+SPACE hin th ca s iu khin, khi , bn c th s dng cc phm tt thay i trng thi ca b g nh: Phm nng T V R E 3 Q U C I X Tc dng t b g vo ch g Telex t b g vo ch g VNI t b g vo ch g VIQR Khng kch hot b g (nhp liu ting Anh) t bng m ting Vit theo bng m TCVN3 t bng m ting Vit theo bng m VIQR t bng m ting Vit theo bng m UNICODE S dng ch b du kiu c (ha, he..) Thng tin v chng trnh ng ca s iu khin

Bn c th s dng lnh ugvnkey (tt nhin l vi t cch ngi dng root) g b b g ny khi khng cn s dng na.

Trang 24

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

2. Ting Vit trong mi trng X Window System


2.1. Font ch Font bitmap c chng ti dng hin th cho font h thng ca X Window, GNOME theo bng m TCVN-5712, (khc vi TCVN3) c y c ch hoa, thng. Font TrueType dng cho Netscape xem cc trang Web dng bng m TCVN l cc font "ABC" c nh nc cho php dng min ph. Font Type1 dng son tho v in n vi StarOffice c chng ti chuyn dng (convert) t cc font TrueType "ABC", do vy n cng theo bng m TCVN3. 2.2. B g Trong mi trng X Window, chng ti cng a ra mt gii php ring cho vic nhp liu ting Vit, chng trnh ny c tn l xgvnkey, n hot ng nh l mt ng dng thng thng trn X Window. chy chng trnh, kch chut vo menu h thng, trong mc Cc ng dng chn mc Ting Vit, sau chn XGVNkey. Bn s nghe thy mt ting beep v ti gc trn bn phi xut hin mt biu tng: . Bn cng c th s dng phm nng Alt+Z kch hot hoc ngng kch hot b g (nhng khng ng chng trnh), . trng thi khng kch hot bn s thy biu tng thay v B g trn X Window c nhiu la chn v c giao din thn thin, thun tin. kch , hoc nhn ng thi hot ca s iu khin, bn kch chut phi vo biu tng cc phm CTRL+ALT+SPACE, ca s iu khin s xut hin nh hnh bn. C rt nhiu tu chn v cc tnh nng khc nhau trong ca s iu khin nh hnh di.

Bn c th chn mt trong 3 kiu g ting Vit khc nhau nh Telex, VIQR, VNI trong mc Input method. la chn cc bng m khc nhau nh TCVN3, VNI, VIQR, Unicode hy vo mc Output method. Bn c th nh ngha cc macro g tt, hoc s dng mc Converter chuyn i vn bn sang cc bng m khc nhau. loi b b g, bn kch chut vo nt Unload trn ca s iu khin, sau nhn nt Cancel.
Trang 25

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

In n trong LinuxVN OS 1.0


1. Hng dn ci t my in trong h iu hnh LINUXVN 1.0
Trc ht bn phi ng nhp vi t cch root v chy chng trnh printtool bng cch: - Kch vo biu tng Menu chnh, chn mc: Cc ng dng / Chy chng trnh... - G lnh: printtool v kch vo nt: Run Trn mn hnh s hin ra mt ca s qun l my in: Bc 1: ci thm mt my in nhn vo nt Add, hp thoi Add a printer entry xut hin cho php bn xc nh cc kiu my in c thit lp (nh: local, samba, nfs). Hy chn ly mt my in ph hp vi h thng ca bn v nhn OK. Sau thng bo v vic t ng d tm thit b c a ra. Bc 2: - i vi my in cc b (local): Hp thoi xc nh cc thng tin v my in gm cc ni dung: Names (name1| name2|...): Xc nh tn my in. Spool Directory: Xc nh th mc hng i in. File limit in Kb (0=no limit): Xc nh dung lng ca file c in ra tnh theo Kb. Printer Device: Xc nh cng thit b m my in c cm vo. Input filter: Xc nh trong bc 3. - i vi my in samba: Hp thoi xc nh cc thng tin v my in gm cc ni dung: Names (name1| name2|...): Xc nh tn my in. Spool Directory: Xc nh th mc hng i in. File limit in Kb (0=no limit): Xc nh dung lng ca file c in ra (Kb). Hostname of Printer Server: Xc nh tn my ch dch v in. IP number of Server:(Optional): Xc nh a ch IP my ch dch v in. Printer Name: Xc nh tn my in c chia s trn mng.

Trang 26

KC-06-03CN

Hng dn ci t h iu hnh Linux-VN

User: Xc nh tn ngi dng c quyn s dng my in. Password: Xc nh mt khu ngi dng. Workgroup: Xc nh nhm s hu ca my ch dch v in. Input filter : Xc nh trong bc 3. Bc 3: Xc nh Input filter: Hp thoi Configure Filter cho bn xc nh cc thng tin cn thit cu hnh my in: Printer Type: Lit k danh sch cc my in c h tr trong h thng. Chn kiu ph hp vi my in ca bn, khi mc Driver Description s a ra nhng thng tin khi qut v kiu my in nh: Resolution - Xc nh phn gii ca my in (tnh theo dpi), Paper Size - Xc nh kh giy cho my in. Printting Options: o Send EOF after job to eject page? Nu c chn thi my in s t ng y giy ra khi kt thc cng vic in i vi cc my in kim. o Fix stair-stepping text? Nu c chn th trnh iu khin s kim tra hiu ng bc thang khi in. o Fast text printting (none-PS printer only)? Nu c chn th d liu s c a thng ra my in khng thng qua mt c ch thng dch no c. ( in vn bn ting vit th mc ny phi khng c chn) Mc Margin (in pts=1/72 of inch): Xc nh l trn trang in theo c hai chiu ngang v dc. Nhn OK kt thc vic ci t my in trong h iu hnh LinuxVN 1.0.

2. In Ting Vit trong Netscape


Vic in n Ting Vit trong LinuxVN 1.0 ni chung khng c g khc ngoi tr vic in trong Netscape. in n ting Vit trong Netscape, trn menu File bn chn mc In n ... Hp thoi in n hin ra cho bn la chn cc thng s v in n. Trong mc Lnh in bn g vo lnh: lpr |tv v n vo nt In.

Trang 27

H Ni - 2001

Linux-VN, cc lnh c bn

Mc lc
1.1. Gii thiu v UNIX v Linux ...........................................................................................6 1.1.1. S b v h iu hnh a ngi dng ...........................................................................6 1.1.2. Xut x, s pht trin v mt s c trng ca h iu hnh UNIX.............................6 1.1.3. Gii thiu s b v Linux..............................................................................................9 1.2. S b v cc thnh phn ca Linux ...............................................................................10 1.2.1. S b v nhn .............................................................................................................11 1.2.2. S b v shell ..............................................................................................................11 1.3. Gii thiu v vic s dng lnh trong Linux ..................................................................12 1.3.1. Cc quy c khi vit lnh ...........................................................................................14 1.3.3. Lm n gin thao tc g lnh ...................................................................................17 1.3.4. Tip ni dng lnh......................................................................................................19 1.4. Trang Man (Man Page).................................................................................................20 2.1. Qu trnh khi ng Linux ............................................................................................23 2.2. Th tc ng nhp v cc lnh thot khi h thng......................................................24 2.2.1. ng nhp ..................................................................................................................24 2.2.2. Ra khi h thng.........................................................................................................25 2.2.3. Khi ng li h thng ...............................................................................................27 2.3. Lnh thay i mt khu .................................................................................................28 2.4. Lnh xem, thit t ngy, gi hin ti v xem lch trn h thng ..................................30 2.4.1. Lnh xem, thit t ngy, gi......................................................................................30 2.4.2. Lnh xem lch .............................................................................................................32 2.5. Lnh gi ngn ng tnh ton s hc ..............................................................................33 2.6. Xem thng tin h thng ..................................................................................................35 2.7. Hin dng vn bn ........................................................................................................36 2.8. Thay i ni dung du nhc shell .................................................................................37 3.1. Tng quan v h thng tp tin .......................................................................................39 3.1.1. Mt s khi nim ........................................................................................................39 3.1.2. S b kin trc ni ti ca h thng tp tin................................................................41 3.1.3. Lin kt tng trng (lnh ln) .....................................................................................45 3.2. Quyn truy nhp th mc v tp tin ..............................................................................46 3.2.1. Quyn truy nhp .........................................................................................................46 3.2.2. Cc lnh c bn..........................................................................................................49 3.3. Thao tc vi th mc .....................................................................................................53 3.3.1. Mt s th mc c bit .............................................................................................53 3.3.2. Cc lnh c bn v th mc .......................................................................................55 3.4. Cc lnh lm vic vi tp tin.........................................................................................60 3.4.1. Cc kiu tp tin c trong Linux ..................................................................................60 3.4.2. Cc lnh to tp tin ....................................................................................................61 3.4.3. Cc lnh thao tc trn tp tin.....................................................................................62 3.4.4. Cc lnh thao tc theo ni dung tp tin .....................................................................72 3.4.5. Cc lnh tm tp tin ....................................................................................................82 3.5. Nn v sao lu cc tp tin .............................................................................................90 3.5.1. Sao lu cc tp tin (lnh tar)......................................................................................90 3.5.2. Nn d liu .................................................................................................................94 3.6. S dng rpm ..................................................................................................................97

Linux-VN, cc lnh c bn

3.6.1. Gii thiu chung v rpm .............................................................................................97 3.6.2. RPM vi ngi dng ...................................................................................................98 4.1. Ti khon ngi dng..................................................................................................100 4.2. Cc lnh c bn qun l ngi dng ...........................................................................100 4.2.1. Tp tin /etc/passwd ................................................................................................100 4.2.2. Thm ngi dng vi lnh useradd.........................................................................101 4.2.3. Thay i thuc tnh ngi dng................................................................................104 4.2.4. Xa b mt ngi dng (lnh userdel) ....................................................................105 4.3. Cc lnh c bn lin quan n nhm ngi dng .......................................................105 4.3.1. Nhm ngi dng v tp tin /etc/group ..................................................................106 4.3.2. Thm nhm ngi dng ............................................................................................106 4.3.3. Sa i cc thuc tnh ca mt nhm ngi dng (lnh groupmod) ......................107 4.3.4. Xa mt nhm ngi dng (lnh groupdel) .............................................................107 4.4. Cc lnh c bn khc c lin quan n ngi dng....................................................108 4.4.1. ng nhp vi t cch mt ngi dng khc khi dng lnh su ...............................108 4.4.2. Xc nh ngi dng ang ng nhp (lnh who)....................................................108 4.4.3. Xc nh cc tin trnh ang c tin hnh (lnh w)..............................................110 5.1. Gii thiu v cch thc Linux qun l thit b ngoi vi ...............................................111 5.2. Cc cch qun l thit b lu tr trong Linux .............................................................112 5.2.1. Lnh mount v lnh umount...................................................................................113 5.2.2. Cc lnh nh dng a v to h thng tp tin trong Linux....................................115 5.2.3. Lnh qun l a.......................................................................................................120 5.3. Cc cng ni tip v modem .......................................................................................124 5.4. Cc cng song song v my in ....................................................................................124 5.4.1. Khi to v thit lp my in trong lpd......................................................................124 5.4.2. Cc lnh in n c bn...............................................................................................126 5.5. Sound card...................................................................................................................133 6.1. Khi ng Vim.............................................................................................................137 6.1.1. M chng trnh son tho Vim ...............................................................................137 6.1.2. Tnh nng m nhiu ca s.......................................................................................138 6.1.3. Ghi v thot trong Vim .............................................................................................139 6.2. Di chuyn tr son tho trong Vim .............................................................................139 6.2.1. Di chuyn trong vn bn ..........................................................................................139 6.2.2. Di chuyn theo cc i tng vn bn .....................................................................140 6.2.3. Cun mn hnh .........................................................................................................141 6.3. Cc thao tc trong vn bn .........................................................................................141 6.3.1. Cc lnh chn vn bn trong Vim ............................................................................141 6.3.2. Cc lnh xo vn bn trong Vim ..............................................................................142 6.3.3. Cc lnh khi phc vn bn trong Vim ....................................................................142 6.3.4. Cc lnh thay th vn bn trong Vim .......................................................................143 6.3.5. Sao chp v di chuyn vn bn trong Vim................................................................144 6.3.6. Tm kim v thay th vn bn trong Vim..................................................................145 6.3.7. nh du trong Vim .................................................................................................146 6.3.8. Cc phm s dng trong ch chn .......................................................................146 6.3.9. Mt s lnh trong ch o.....................................................................................147 6.3.10. Cc lnh lp ...........................................................................................................148 6.4. Cc lnh khc ..............................................................................................................148 6.4.1. Cch thc hin cc lnh bn trong Vim ...................................................................148

Linux-VN, cc lnh c bn

6.4.2. Cc lnh lin quan n tp tin .................................................................................149 7.1. Khi nim ....................................................................................................................151 7.2. Cc lnh c bn...........................................................................................................151 7.2.1. Lnh fg v lnh bg ....................................................................................................151 7.2.2. Tm ra cc tin trnh ang chy vi lnh ps .............................................................154 7.2.3. Hy dit tin trnh vi lnh kill .................................................................................156 7.2.4. Cho my ngng hot ng mt thi gian vi lnh sleep...........................................157 7.2.5. Xem cy tin trnh vi lnh pstree ............................................................................158 7.2.6. Lnh thit t li u tin ca tin trnh nice v lnh renice................................160 8.1. Midnight Commander l g? .......................................................................................162 8.2. Khi ng MC .............................................................................................................162 8.3. Giao din ca MC .......................................................................................................162 8.4. Dng chut trong MC..................................................................................................163 8.5. Cc thao tc bn phm ................................................................................................163 8.6. Thc n thanh ngang (menu bar) ..............................................................................166 8.7. Cc phm chc nng ....................................................................................................168 8.8. B son tho ca Midnight Commander.....................................................................169 9.1. Phn gii thiu ............................................................................................................172 9.2. Cc thuc tnh chung ca cc lnh mtools.................................................................172 9.2.1. Cc tu chn v tn cc tp tin ................................................................................172 A.1. Gii thiu s b v Linux ............................................................................................192 A.2. Chun b cho vic ci t ...........................................................................................192 A.3. To a mm khi ng...............................................................................................193 A.4. Phn vng li a DOS/Windows hin thi .............................................................193 A.5. Cc bc ci t (bn RedHat 6.2 v khi ng t CD-ROM) ..................................194 A.5.1. La chn ch ci t...........................................................................................194 A.5.2. La chn ngn ng hin th......................................................................................194 A.5.3. La chn cu hnh bn phm....................................................................................194 A.5.4. Chn cu hnh chut. ...............................................................................................194 A.5.5. H thng a ra li gii thiu v bn Red Hat ang ci t. ..................................195 A.5.6. La chn kiu ci t...............................................................................................195 A.5.7. Xc nh cc Partition..............................................................................................196 A.5.8. Chn Partition Format. ......................................................................................197 A.5.9. Chn cu hnh LILO (Linux Loader).......................................................................198 A.5.10. Chn mi gi..........................................................................................................198 A.5.11. Thit t cu hnh Account (ngi s dng) ..........................................................198 A.5.12. Thit t cu hnh quyn hn (Authentication Configuration)..............................199 A.5.13. La chn cc gi phn mm ci t (Pakage Selection) .......................................199 A.5.14. Thit t cu hnh X (X Configuration) ..................................................................201 A.5.15. Bt u qu trnh copy t a CD vo cng .......................................................201 A.6. Cc hn ch v phn cng i vi Linux ....................................................................201 A.6.1. Cc b vi x l m Linux h tr...............................................................................201 A.6.2. Cc yu cu v khng gian cng...........................................................................202 A.6.3. Cc yu cu v b nh .............................................................................................202 A.6.4. S tng thch vi cc h iu hnh khc: DOS, OS/2, 386BSD, Win95.................203 B.1. Khi qut v Soundcard ..............................................................................................205 B.2. H tr phn cng ........................................................................................................205 B.3. Cu trc cc tp tin cho Soundcard............................................................................206

Linux-VN, cc lnh c bn

B.4. Lp cu hnh v ci t modules cho Sound Card .....................................................207 B.5. Kim tra trng thi soundcard....................................................................................209 B.6. Cc chng trnh ng dng h tr m thanh ..............................................................210

Linux-VN, cc lnh c bn

Chng 1. Gii thiu chung v lnh trong linux 1.1. Gii thiu v UNIX v Linux 1.1.1. S b v h iu hnh a ngi dng UNIX (v Linux) l h iu hnh a ngi dng (multi-users). H iu hnh a ngi dng thuc vo loi h iu hnh a chng trnh nh hng "thn thin vi ngi dng". Ti cng mt thi im, c nhiu ngi dng cng s dng my tnh v i vi mi ngi dng nh vy u c cm gic nh c s dng my tnh mt cch "c quyn" v h c trc tip lin kt vi chng trnh ca mnh ang thc hin trong my tnh. iu ny tng ng vi mt chc nng ca h iu hnh l "h iu hnh nh mt my tnh o" theo gc ca ngi s dng. Nh vy, trong my tnh ng thi xut hin nhiu chng trnh ngi dng, cc chng trnh ny chia nhau s dng cc ti nguyn ca h thng, trong c cc ti nguyn quan trng nht l CPU, b nh trong v h thng tp tin (h thng File). Mi ngi dng hng n ti nguyn chung qua trm cui (terminal) ca mnh (cc trm cui ny c t tn v c h thng qun l). Trong trng hp n gin, trm cui ch bao gm hai thit b l mn hnh ( hin thng tin cho ngi dng) v bn phm ( ngi dng a yu cu i vi h iu hnh). Trong nhiu trng hp khc, c th s dng mt my tnh c nhn ng vai tr ca mt trm cui v nh vy mi ngi dng va c php s dng ti nguyn ring va c php s dng ti nguyn chung. in hnh nht trong cng vic phn chia ti nguyn ca h thng my tnh trong h iu hnh a ngi dng l vic phn chia CPU theo mt chu k thi gian m mi ngi dng c s dng CPU trong mt khong thi gian nht nh (c gi l lng t thi gian) v sau khi mi ngi c phn chia CPU th li chuyn n lt phn chia tip theo. Nh vy, phn chia thi gian (Time shared system) l cch thc ca h a ngi dng khi iu phi CPU. L mt h iu hnh a ngi dng, UNIX kh ph bin trong cc lnh vc hot ng CNTT, c th c s dng t my vi tnh cho ti my tnh mainframe. N c bit thch hp i vi cc h Client-Server v mng my tnh din rng. 1.1.2. Xut x, s pht trin v mt s c trng ca h iu hnh UNIX Nm 1965, Vin cng ngh Massachusetts (MIT: Massachusetts Institute of Technology) v Phng th nghim Bell ca hng AT&T thc hin d n xy dng mt h iu hnh c tn gi l Multics (MULTiplexed Information and Computing Service) vi mc tiu: to lp c mt h iu hnh ph trn vng lnh th rng (hot ng trn tp cc my tnh c kt ni), a ngi dng, c nng lc cao v tnh ton v lu tr. D n ni trn thnh cng mc ht sc khim tn v ngi ta bit n mt s khim khuyt kh khc phc ca Multics. Nm 1969, Ken Thompson, mt chuyn vin ti phng th nghim Bell, ngi tham gia d n Multics, cng Dennics Richie vit li h iu hnh a-bi ton trn my PDP-7 vi tn l UNICS (UNiplexed Information and Computing Service) t mt cu gi a ca mt ng nghip. Trong h iu hnh UNICS, mt s khi tho u tin v H thng tp tin c Ken Thompson v Dennis Ritchie thc hin. n nm 1970 h iu hnh 6

Linux-VN, cc lnh c bn

c vit trn assembler cho my PDP-11/20 v mang tn l UNIX. Nm 1973, Riche v Thompson vit li nhn ca h iu hnh UNIX trn ngn ng C, v h iu hnh tr nn d dng ci t ti cc loi my tnh khc nhau; tnh cht nh th c gi l tnh kh chuyn (portable) ca UNIX. Trc , khong nm 1971, h iu hnh c th hin trn ngn ng B (m da trn ngn ng B, Ritche pht trin thnh ngn ng C). Hng AT&T ph bin chng trnh ngun UNIX ti cc trng i hc, cc cng ty thng mi v chnh ph vi gi khng ng k. Nm 1982, h thng UNIX-3 l bn UNIX thng mi u tin ca AT&T. Nm 1983, AT&T gii thiu H thng UNIX-4 phin bn th nht trong c trnh son tho vi, th vin qun l mn hnh c pht trin t i hc Tng hp California, Berkley. Giai on 1985-1987, UNIX-5 phin bn 2 v 3 tng ng c a ra vo cc nm 1985 v 1987. Trong giai on ny, c khong 100000 bn UNIX c ph bin trn th gii, ci t t my vi tnh n cc h thng ln. u thp k 1990. UNIX-5 phin bn 4 c a ra nh l mt chun ca UNIX. y l s kt hp ca cc bn sau: AT&T UNIX-5 phin bn 3 Berkley Software Distribution (BSD) XENIX ca MicroSoft SUN OS Trong thi gian gn y (khong nm 1997) mt s phin bn mi ca UNIX c gii thiu v ph bin trn Internet. C th tm thy cc ni dung lin quan ti a ch website http://problem.rice.edu/. Cc nhm nh cung cp khc nhau v UNIX ang hot ng trong thi gian hin nay c k n nh sau: Unix International (vit tt l UI). UI l mt t chc gm cc nh cung cp thc hin vic chuyn nhng h thng UNIX-5 v cung cp bn AT&T theo cc nhu cu v thng bo pht hnh mi, chng hn nh iu chnh bn quyn. Giao din ha ngi dng l Open Look. Open Software Foundation (OSF). OSF c h tr bi IBM, DEC, HP ... theo hng pht trin mt phin bn ca Unix nhm tranh ua vi h thng UNIX-5 phin bn 4. Phin bn ny c tn l OSF/1 vi giao din ha ngi dng c gi l MOTIF. Free SoftWare Foundation: mt t chc ch trng pht hnh mt dng ca UNIX m ngun m, min ph: l h iu hnh Linux. Bng sau y lit k mt s ci t UNIX kh ph bin (thng thy c ch X cui tn gi ca H iu hnh): 7

Linux-VN, cc lnh c bn

Tn h AIX A/UX Dynix HP-UX Irix Linux NextStep OSF/1 SCO UNIX Solaris SunOS Ultrix Unicos XENIX

Nh cung cp International Business Machines Apple Computer Sequent Hewlett-Packard Silicon Graphics Free SoftWare Foundation Next Digital Equipment Corporation Santa Cruz Operation Sun Microsystems Sun Microsystems Digital Equipment Corporation Cray MicroSoft BSD BSD

Nn pht trin AT&T System V AT&T System V BSD (Berkeley SoftWare Distribution) BSD AT&T System V

AT&T System V AT&T System V BSD UNIX BSD UNIX AT&T System V AT&T System V AT&T System III-MS

UnixWare Novell

Di y lit k mt s c trng ca h iu hnh UNIX: H iu hnh c vit trn ngn ng bc cao; bi vy, rt d c, d hiu, d thay i ci t trn loi my mi (tnh d mang chuyn, nh ni), C giao din ngi dng n gin nng lc cung cp cc dch v m ngi dng mong mun (so snh vi cc h iu hnh c t trc th giao din ca UNIX l mt tin b vt bc), Tha mn nguyn tc xy dng cc chng trnh phc tp t nhng chng trnh n gin hn: trc ht c cc mun c bn nht ca nhn sau pht trin c ton b h iu hnh, S dng duy nht mt h thng File c cu trc cho php d dng bo qun v s dng hiu qu, S dng ph bin mt dng n gin trnh by ni ti ca File nh mt dng cc byte cho php d dng khi vit cc chng trnh ng dng truy nhp, thao tc vi cc d liu trong File, C kt ni n gin vi thit b ngoi vi: cc file thit b c t sn trong 8

Linux-VN, cc lnh c bn

H thng File to ra mt kt ni n gin gia chng trnh ngi dng vi cc thit b ngoi vi, L h iu hnh a ngi dng, a tin trnh, trong mi ngi dng c th thc hin cc tin trnh ca mnh mt cch c lp. Mi thao tc vo - ra ca h iu hnh c thc hin trn h thng File: mi thit b vo ra tng ng vi mt file. Chng trnh ngi dng lm vic vi file m khng cn quan tm c th tn file c t cho thit b no trong h thng. Che khut cu trc my i vi ngi dng, m bo tnh c lp tng i ca chng trnh i vi d liu v phn cng, to iu kin thun li hn cho ngi lp trnh khi vit cc chng trnh chy UNIX vi cc iu kin phn cng hon ton khc bit nhau. 1.1.3. Gii thiu s b v Linux Linus Tovalds (mt sinh vin Phn lan) a ra phin bn u tin ca h iu hnh Linux vo thng 8 nm 1991. Linus Tovalds xy dng h iu hnh Linux da trn mt phin bn nh ca UNIX c tn Minix (Minix do mt chuyn gia hng u v h iu hnh l Gio s Andrew S. Tanenbaum xy dng) theo hng hot ng trn my tnh c nhn. T thi im , theo t tng GNU, hng nghn chuyn gia trn ton th gii tham gia vo qu trnh pht trin Linux v v vy Linux ngy cng p ng nhu cu ca ngi dng. C th k ra mt s c im sau y ca h iu hnh Linux hin ti: Linux tng thch vi nhiu h iu hnh nh DOS, MicroSoft Windows ...: C th ci Linux cng vi cc h iu hnh khc trn cng mt cng: Linux c th truy nhp n cc file ca cc h iu hnh cng mt a. Linux cho php chy m phng cc chng trnh thuc cc h iu hnh khc. Do gi c chun ca UNIX nn s chuyn i gia Linux v cc h UNIX khc l d dng. Linux l mt h iu hnh UNIX tiu biu: a ngi dng, a chng trnh v a x l. Linux c giao din ho (GUI) qua X-Window. Linux h tr nhiu giao thc mng. Linux cn h tr tnh thi gian thc. Linux kh mnh v chy rt nhanh ngay c khi nhiu qu trnh hoc nhiu ca s. Linux c ci t trn nhiu chng loi my tnh khc nhau: PC, mini v vic ci t kh thun li song cha xut hin trn my tnh ln (mainframe). Linux ngy cng c h tr bi cc phn mm ng dng: son tho, qun l mng, qun tr c s d liu, bng tnh v.v. Linux h tr tt cho tnh ton song song v my tnh cm (PC-cluster) l mt hng nghin cu trin khai ng dng nhiu trin vng hin nay. L mt h iu hnh vi m ngun m, c pht trin qua Free SoftWare Foundation nn Linux pht trin nhanh v l mt h iu hnh c quan tm 9

Linux-VN, cc lnh c bn

nhiu nht trn th gii hin nay. Linux l mt h iu hnh h tr a ngn ng mt cch ton din nht. Do Linux cho php h tr cc b m chun t 16 bit tr ln (trong c cc b m Unicode, ISO10646) cho nn vic bn a ha trn Linux l trit nht trong cc h iu hnh. Tuy nhin cng cn mt s kh khn lm cho Linux cha thc s tr thnh mt h iu hnh ph dng, trong c th k n mt s kh khn nh sau: Kh khn khi ci t Linux v kh nng tng thch ca Linux vi mt s loi thit b phn cng cn thp do cha c cc trnh iu khin cho nhiu thit b, Phn mm ng dng chy trn nn Linux tuy phong ph song so vi cc h iu hnh khc nh MS Windows th vn cn c khong cch. Vi s h tr ca nhiu cng ty Tin hc hng u (IBM, SUN, HP ...) v s tham gia pht trin ca hng vn chuyn gia trn ton th gii, cc kh khn ca Linux chc chn s nhanh chng c khc phc. Chnh v l hnh thnh mt s nh cung cp Linux trn th gii. Bng di y l tn ca mt s nh cung cp Linux c ting nht v a ch website ca h. ng ch nht l Red Hat Linux v Red Flag Linux. Red Hat c coi l lu i v tin cy, cn Red Flag l mt cng ty Linux ca Trung quc, c quan h vi cng ng Linux Vit nam v chng ta c th hc hi mt cch trc tip kinh nghim cho qu trnh a Linux vo Vit nam. Tn cng ty Caldera OpenLinux Corel Linux Debian GNU/Linux Linux Mandrake Red Hat Linux Red Flag Linux Slackware Linux SuSE Linux TurboLinux 1.2. S b v cc thnh phn ca Linux H iu hnh Linux c chia thnh 4 thnh phn nh sau: Nhn (system kernel), Shell, H thng tp tin (File system), Cc tin ch (utilities) hay l h thng lnh ca Linux. 10 a ch website www.caldera.com www.corel.com www.debian.com www.mandrake.com www.redhat.com www.redflag-linux.com www.slackware.com www.suse.com www.turbolinux.com

Linux-VN, cc lnh c bn

Tin ch chnh l lnh c sn trong h iu hnh (di y tin ch c coi l lnh thng trc). Ni dung chnh yu ca cun sch ny gii thiu chi tit v mt s lnh thng dng nht ca Linux. H thng tp tin s c gii thiu trong chng 3. Trong cc chng sau ca cun sch cp ti nhiu ni dung lin quan n nhn v shell, song ngay sau y th mt s nt s b v chng s c gii thiu. 1.2.1. S b v nhn Nhn (cn c gi l h li) ca Linux, l mt b cc mdun chng trnh c vai tr iu khin cc thnh phn ca my tnh, phn phi cc ti nguyn cho ngi dng (cc tin trnh ngi dng). Nhn chnh l cu ni gia chng trnh ng dng vi phn cng. Ngi dng s dng bn phm g ni dung yu cu ca mnh v yu cu c nhn gi ti shell: Shell phn tch lnh v gi cc chng trnh tng ng vi lnh thc hin. Mt trong nhng chc nng quan trng nht ca nhn l gii quyt bi ton lp lch, tc l h thng cn phn chia CPU cho nhiu tin trnh hin thi cng tn ti. i vi Linux, s lng tin trnh c th ln ti con s hng nghn. Vi s lng tin trnh ng thi nhiu nh vy, cc thut ton lp lch cn phi hiu qu: Linux thng lp lch theo ch Round Robin (RR) thc hin vic lun chuyn CPU theo lng t thi gian. Thnh phn quan trng th hai trong nhn l h thng cc mun chng trnh (c gi l li gi h thng) lm vic vi h thng tp tin. Linux c hai cch thc lm vic vi cc tp tin: lm vic theo byte (k t) v lm vic theo khi. Mt c im ng ch l vic tp tin trong Linux c th c nhiu ngi cng truy nhp ti nn cc li gi h thng lm vic vi tp tin cn m bo vic tp tin c truy nhp theo quyn v c chia x cho ngi dng. 1.2.2. S b v shell Mt s ni dung chi tit v shell (cn c gi l h v) trong Linux c trnh by trong chng "Lp trnh trn shell". Nhng ni dung trnh by di y cho chng ta mt cch nhn s b v shell v vai tr ca n trong hot ng chung ca h iu hnh. Ngi dng mong mun my tnh thc hin mt cng vic no th cn g lnh tng ng th hin yu cu ca mnh h thng p ng yu cu . Shell l b dch lnh v hot ng nh mt kt ni trung gian gia nhn vi ngi dng: Shell nhn dng lnh do ngi dng a vo; v t dng lnh ni trn nhn tch ra cc b phn nhn c mt hay mt s lnh tng ng vi cc on vn bn c trong dng lnh. Mt lnh bao gm tn lnh v tham s: t u tin l tn lnh, cc t tip theo (nu c) l cc tham s. Tip theo, shell s dng nhn khi sinh mt tin trnh mi (khi to tin trnh) v sau , shell ch i tin trnh con ny tin hnh, hon thin v kt thc. Khi shell sn sng tip nhn dng lnh ca ngi dng, mt du nhc shell (cn gi l du nhc nhp lnh) xut hin trn mn hnh. Linux c hai loi shell ph bin l: C-shell (du nhc %), Bourne-shell (du nhc $) v mt s shell pht trin t cc shell ni trn (chng hn, TCshell - tcsh vi du nhc ngm nh > pht trin t C-shell v GNU Bourne - bash vi du nhc bash # pht trin t Bourne-shell). Du mi phn bit shell ni trn khng phi hon ton r rng do Linux cho php ngi dng thay i li du nhc shell nh vic thay gi tr cc bin mi trng PS1 v PS2. Trong cun sch ny, chng ta s dng k hiu "hng ro #" biu th du 11

Linux-VN, cc lnh c bn

nhc shell. C-shell c tn gi nh vy l do cch vit lnh v chng trnh lnh Linux ta nh ngn ng C. Bourne-shell mang tn tc gi ca n l Steven Bourne. Mt s lnh trong C-shell (chng hn lnh alias) khng cn c trong Bourne-shell v v vy nhn bit h thng ang lm vic vi shell no, chng ta g lnh: # alias Nu mt danh sch xut hin th shell ang s dng l C-shell; ngc li, nu xut hin thng bo "Command not found" th shell l Bourne-shell. Lnh c chia thnh 3 loi lnh: Lnh thng trc (c sn ca Linux). Tuyt i a s lnh c gii thiu trong cun sch ny l lnh thng trc. Chng bao gm cc lnh c cha sn trong shell v cc lnh thng trc khc. Tp tin chng trnh ngn ng my: chng hn, ngi dng vit trnh trn ngn ng C qua b dch gcc (bao gm c trnh kt ni link) to ra mt chng trnh trn ngn ng my. Tp tin chng trnh shell (Shell Scrip). Khi kt thc mt dng lnh cn g phm ENTER shell phn tch v thc hin lnh. 1.3. Gii thiu v vic s dng lnh trong Linux Nh gii thiu phn trn, Linux l mt h iu hnh a ngi dng, a nhim, c pht trin bi hng nghn chuyn gia Tin hc trn ton th gii nn h thng lnh cng ngy cng phong ph; n thi im hin nay (nm 2000) Linux c khong hn mt nghn lnh. Tuy nhin ch c khong vi chc lnh l thng dng nht i vi ngi dng. Cun sch ny cng hn ch gii thiu khong vi chc lnh . Chng ta ng e ngi v s lng lnh c gii thiu ch chim mt phn nh trong tp hp lnh bi v y l nhng lnh thng dng nht v chng cung cp mt phm vi ng dng rng ln, tha mn yu cu ca chng ta. Cng nh ni trn, ngi dng lm vic vi my tnh thng qua vic s dng trm cui: ngi dng a yu cu ca mnh bng cch g "lnh" t bn phm v giao cho h iu hnh x l. Khi ci t Linux ln my tnh c nhn th my tnh c nhn va ng vai tr trm cui, va ng vai tr my tnh x l. Dng tng qut ca lnh Linux c th c vit nh sau: # <Tn lnh> [<cc tham s>] trong : Tn lnh l mt dy k t, khng c du cch, biu th cho mt lnh ca Linux hay mt chng trnh. Ngi dng cn h iu hnh p ng yu cu g ca mnh th phi chn ng tn lnh. Tn lnh l bt buc phi c khi g lnh. 12

Linux-VN, cc lnh c bn

Cc tham s c th c hoc khng c, c vit theo quy nh ca lnh m chng ta s dng, nhm cung cp thng tin v cc i tng m lnh tc ng ti. ngha ca cc du [, <, >, ] c gii thch phn quy tc vit lnh. Cc tham s c phn ra thnh hai loi: tham s kha v tham s v tr. Tham s v tr thng l tn tp tin, th mc v thng l cc i tng chu s tc ng ca lnh. Khi g lnh, tham s v tr c thay bng nhng i tng m ngi dng cn hng tc ng ti. Tham s kha chnh l nhng tham s iu khin hot ng ca lnh theo cc trng hp ring. Trong Linux, tham s kha thng bt u bi du tr "-" hoc hai du tr lin tip "--". Khi g lnh, cng ging nh tn lnh, tham s kha phi c vit chnh xc nh trnh by trong m t lnh. Mt lnh c th c mt s hoc rt nhiu tham s kha. Ph thuc vo yu cu c th ca mnh, ngi dng c th chn mt hoc mt s cc tham s kha khi g lnh. Trong cc m t lnh, ph bin xut hin cc ty chn lnh m c vit tt l ty-chn. Cc ty chn lnh (hu ht l cc tham s kha) cho php iu chnh hot ng ca lnh trong Linux, lm cho lnh c tnh ph dng cao. Cc tu chn lnh cho php lnh c th p ng mun ca ngi dng i vi hu ht (tuy khng phi lc no cng vy) cc tnh hung t ra cho thao tc ng vi lnh. K hiu "" biu th vic g phm ht dng <Enter>. kt thc mt yu cu, ngi dng nht thit phi g phm "". V d, khi ngi dng g lnh xem thng tin v cc tp tin: # ls -l g* trong lnh ny: ls l tn lnh thc hin vic a danh sch cc tn tp tin/ th mc con trong mt th mc, -l l tham s kha, cho bit yu cu xem y thng tin v cc i tng hin ra. Ch , trong tham s kha ch ci (ch "l") phi i ngay sau du tr "-". Tng ng vi lnh ls cn c cc tham s kha -a, -L, ... v chng cng l cc ty chn lnh. Trong mt s tham s kha c nhiu ch ci thay cho mt du "-" l hai du "--" u tham s. V d, nh trng hp tham s --file ca lnh date. g* l tham s v tr ch r ngi dng cn xem thng tin v cc tp tin c tn gi bt u l ch ci "g". Trong cun sch ny, chng ta quy c rng khi vit mt lnh (trong m t lnh v g lnh) th khng cn phi vit du "" cui dng lnh , song lun ghi nh rng phm ENTER ("") l bt buc khi g lnh. Lu : Linux (v UNIX ni chung) c xy dng trn ngn ng lp trnh C, v vy khi g lnh phi phn bit ch thng vi ch hoa. Ngoi tr mt s ngoi l, trong Linux chng ta thy ph bin l: 13

Linux-VN, cc lnh c bn

Cc tn lnh l ch thng, Mt s tham s c th l ch thng hoc ch hoa (v d, trong lnh date v thi gian h thng th hai tham s -r v -R c ngha hon ton khc nhau). Tn cc bin mi trng cng thng dng ch hoa. Trong cun sch ny, ti nhng dng vn bn din gii, chng ti vit tn lnh, cc tham s kha bng kiu ch khng chn, m nh date, -R, -r ... Linux phn bit siu ngi dng (ting Anh l superuser hoc root, cn c gi l ngi qun tr hay ngi dng ti cao hoc ngi dng cao cp) vi ngi dng thng thng. Trong tp hp lnh ca Linux, c mt s lnh m ch siu ngi dng mi c php s dng cn ngi dng thng thng th khng c php (v d nh lnh adduser thc hin vic b sung thm ngi dng). Mt khc trong mt s lnh, vi mt s tham s kha th ch siu ngi dng c php dng, cn vi mt s tham s khc th mi ngi dng u c php (v d nh lnh passwd thay i mt khu ngi dng). Mt dng lnh c th c nhiu hn mt lnh, trong lnh sau c ngn cch bi vi lnh i ngay trc bng du ";" hoc du "|". V d v mt s dng lnh dng ny: # ls -l; date # head Filetext | sort >temp Chng v lp trnh shell s gii thiu chi tit hn v cc cch thc ni trn. Sau khi ngi dng g xong dng lnh, shell tip nhn dng lnh ny v phn tch ni dung vn bn ca lnh. Nu lnh c g ng th lnh c thc hin; ngc li, trong trng hp c sai st khi g lnh th shell s thng bo v sai st v du nhc shell li hin ra ch lnh tip theo ca ngi dng. V ph bin, nu nh sau khi ngi dng g lnh, khng thy thng bo sai st hin ra th c ngha lnh c thc hin mt cch bnh thng. Trc khi i vo ni dung chi tit cc lnh thng dng, chng ta xem xt v mt s quy nh dng trong m t lnh c trnh by trong cun sch ny. 1.3.1. Cc quy c khi vit lnh Trong cun sch ny, cc lnh c trnh by theo mt b quy tc c php nht qun. B quy tc ny cho php phn bit trong mi lnh cc thnh phn no l bt buc phi c, cc thnh phn no c th c hoc khng ... Di y l ni dung ca cc quy tc trong b quy tc . Tn lnh l bt buc, phi l t u tin trong bt k lnh no, phi c g ng nh khi m t lnh. Tn khi nim c nm trong cp du ngoc quan h (< v >) biu th cho mt lp i tng v l tham s bt buc phi c. Khi g lnh th tn khi nim (c th c coi l "tham s hnh thc") phi c thay th bng mt t (thng l tn tp tin, tn th mc ... v c th c coi l "tham s thc s") ch i tng lin quan n thao tc ca lnh. 14

Linux-VN, cc lnh c bn

V d, m t c php ca lnh more xem ni dung tp tin l # more <tp-tin> th t more l tn lnh, cn <tp-tin> l tham s trong tp-tin l tn khi nim v l tham s bt buc phi c. Lnh ny c tc ng l hin ln mn hnh theo cch thc cun ni dung ca tp tin vi tn ch trong lnh. xem ni dung tp tin c tn l temp, ngi dng g lnh: # more temp Nh vy, tn lnh more c g ng nh m t c php (c ni dung v v tr) cn "tp-tin" c thay th bng t "temp" l tn tp tin m ngi dng mun xem ni dung. Cc b phn nm gia cp du ngoc vung [ v ] l c th g hoc khng g cng c. V d, m t c php ca lnh halt l # halt [ty-chn] Vi cc ty chn l -w, -n, -d, -f, -i m mi ty chn cho mt cch thc hot ng khc nhau ca lnh halt. Lnh halt c tc ng chnh l lm ngng hot ng ca h iu hnh, tuy nhin khi ngi dng mun c mt cch hot ng no ca lnh ny th s chn mt (hoc mt s) tu chn lnh tng ng. Mt s cch g lnh halt ca ngi dng nh sau y l ng c php: # halt # halt -w # halt -n # halt -f Cc gi tr c trong cp { v } trong cc b phn cch nhau bng du s ng "|" cho bit cn chn mt v ch mt trong cc gi tr nm gia hai du ngoc . V d, khi gii thiu v ty chn lnh ca lnh tail xem phn cui ni dung ca tp tin, chng ta thy: -f, --follow[={tn | c t}] Nh vy, sau tham s kha --follow, nu xut hin thm du bng "=" th phi c hoc tn hoc c t. y l trng hp cc chn la "loi tr nhau". Du ba chm ... th hin vic lp li thnh phn c php i ngay trc du ny, vic lp li c th t khng n nhiu ln (khng k chnh thnh phn c php ). Cch thc ny thng c dng vi cc tham s nh tn tp tin. V d, m t lnh chown nh sau: chown [ty-chn]... <ch>[.[nhm]]<tp-tin>... 15

Linux-VN, cc lnh c bn

Nh vy trong lnh chown c th khng c hoc c mt s ty chn lnh v c t mt n nhiu tn tp tin. Cc b phn trong m t lnh, nu khng nm trong cc cp du [ ], <>, {} th khi g lnh thc s phi g y ng nh khi m t (ch , quy tc vit tn lnh l mt trng hp ring ca quy tc ny). Vic kt hp cc du ngoc vi nhau cho php to ra cch thc s dng quy tc t hp cc tham s trong lnh. V d, lnh more bnh thng c c php l: # more <tp-tin> c ngha l thay <tp-tin> bng tn tp tin cn xem ni dung, nu kt hp thm du ngoc vung [ v ], tc l c dng sau (chnh l dng tng qut ca lnh more): # more [<tp-tin>] th <tp-tin> ni chung phi c trong lnh more, tuy nhin trong mt s trng hp c th b qua tham s tp-tin. Lu : i vi nhiu lnh, cho php ngi dng g tham s kha kt hp tng ng vi ty-chn trong m t lnh. Tham s kha kt hp c vit theo cch <xu-k-t>, trong xu-k-t gm cc ch ci trong tham s kha. V d, trong m t lnh in lch cal: cal [ty-chn] [thng [nm] ] c ba tham s kha l -m, -j, -y. Khi g lnh c th g mt t hp no t ba tham s kha ny c tnh hung s dng lnh theo mun. Chng hn, nu g lnh cal -mj 3 th lnh cal thc hin theo iu khin ca hai tham s kha -m (chn Th Hai l ngy u tun, thay v cho ngm nh l Ch Nht) v -j (hin th ngy trong thng di dng s ngy trong nm k t u nm). Trong mt s lnh, c hai tham s kha cng tng ng vi mt tnh hung thc hin lnh, trong mt tham s gm mt k t cn tham s kia li l mt t. Tham s di mt t l tham s chun ca lnh, cn tham s mt k t l cch vit ngn gn. Tham s chun dng c trong mi Linux v khi g phi c k t trong t. V d, khi m t lnh date c ty chn: -d, --date=STRING nh vy hai tham s -d v --date=STRING c cng ngha. Ngoi nhng quy c trn y, ngi dng ng qun mt quy nh c bn l cn phn bit ch hoa vi ch thng khi g lnh.

16

Linux-VN, cc lnh c bn

1.3.3. Lm n gin thao tc g lnh Vic s dng bn phm nhp lnh tuy khng phi l mt cng vic nng n, song Linux cn cho php ngi dng s dng mt s cch thc thun tin hn khi g lnh. Mt s trong nhng cch thc l: S dng vic khi phc dng lnh, S dng cc phm c bit, S dng cc k hiu thay th v phm <Tab>, S dng thay th alias, S dng chng trnh lnh. Cch thc s dng thay th alias v chng trnh lnh (shell script) s c gii thiu chi tit trong cc chng lin quan. Di y, chng ta xem xt cch thc s dng vic khi phc dng lnh, phm c bit v k hiu thay th. Vic khi phc dng lnh Linux cung cp mt cch thc c bit l kh nng khi phc lnh. Ti du nhc shell: Ngi dng s dng cc phm mi tn ln/xung (/) trn bn phm nhn li cc dng lnh c a vo trc y ti du nhc shell, chn mt trong cc dng lnh v bin tp li ni dung dng lnh theo ng yu cu mi ca mnh. V d, ngi dng va g xong dng lnh: # ls -l tenfile* sau mun g lnh ls -l tentaptin th ti du nhc ca shell, ngi dng s dng cc phm di chuyn ln () hoc xung () nhn c: # ls -l tenfile* dng cc phm tt di chuyn, xo k t (xem phn sau) c c: # ls -l ten v g tip cc k t "taptin" nhn c: # ls -l tentaptin chnh l kt qu mong mun. Trong trng hp s lng k t thay th l rt t so vi s lng k t ca ton dng lnh th hiu qu ca cch thc ny rt cao. Lu : Vic nhn lin tip cc phm di chuyn ln () hoc xung () cho php ngi dng nhn c cc dng lnh g t trc m khng ch dng lnh mi c g. Cch thc ny tng t vi cch thc s dng tin ch DOSKEY trong h iu hnh MS-DOS.

17

Linux-VN, cc lnh c bn

Mt s phm c bit khi g lnh Khi ngi dng g lnh c th xy ra mt s tnh hung nh sau: Dng lnh ang g c ch sai st, khng ng theo yu cu ca ngi dng v vy cn phi sa li i cht ni dung trn dng lnh . Trong trng hp cn s dng cc phm c bit (cn gi l phm vit tt hay phm tt) di chuyn, xo b, b sung vo ni dung dng lnh. Sau khi s dng cch thc khi phc dng lnh, chng ta nhn c dng lnh tng t vi lnh cn g v sau s dng cc phm tt hon thin lnh. Di y gii thiu cc phm tt v ngha ca vic s dng chng: Nhn phm di chuyn con tr sang bn phi mt v tr Nhn phm di chuyn con tr sang bn tri mt v tr Nhn phm <ESC-BACKSPACE> xo mt t bn tri con tr Nhn phm <ESC-D> xo mt t bn phi con tr Nhn phm <ESC-F> di chuyn con tr sang bn phi mt t Nhn phm <ESC-B> di chuyn con tr sang bn tri mt t Nhn phm <CTRL-A> di chuyn con tr v u dng lnh Nhn phm <CTRL-E> di chuyn con tr v cui dng Nhn phm <CTRL-U> xa dng lnh C th dng phm <ALT> thay cho phm <ESC>. Cc k hiu m t nhm tp tin v phm <Tab> Khi g lnh thc s nhiu trng hp ngi dng mong mun mt tham s trong lnh khng ch xc nh mt tp tin m li lin quan n mt nhm cc tp tin m tn gi ca cc tp tin trong nhm c chung mt tnh cht no . Trong nhng trng hp nh vy, ngi dng cn s dng cc k hiu m t nhm tp tin (wildcards), chng ta gi l k hiu m t nhm (cn c gi l k hiu thay th). Ngi ta s dng cc k t *, ? v cp hai du [ v ] m t nhm tp tin. Cc k t ny mang ngha nh sau khi vit vo tham s tn tp tin thc s: "*" : l k t m t nhm gm mi xu k t (thay th mi xu). M t ny cho mt nhm ln nht trong ba m t. "?" : m t nhm gm mi xu vi di khng qu 1 (thay th mt k t). Nhm ny l tp con ca nhm u tin (theo k t "*"). [xu-k-t] : m t nhm gm mi xu c di 1 l mi k t thuc xu ni trn. M t ny cho mt nhm c lc lng b nht trong ba m t. Nhm ny l tp con ca nhm th hai (theo k t "?"). Khi g lnh phi g c hai du [ v ]. Mt dng khc ca m t nhm ny l [<k_t_1>-<k_t_2>] ngha l gia cp du ngoc c ba k t trong k t gia l du ni (du -) th cch vit ny tng ng vi vic lit k mi k t t <k_t_1> n <k _t_2>. Chng hn, 18

Linux-VN, cc lnh c bn

cch vit [a-d] tng ng vi cch vit [abcd]. V d, gi s khi mun lm vic vi tt c cc tp tin trong mt th mc no , ngi dng g * thay th tham s tp-tin th xc nh c cc tn tp tin sau (chng ta vit bn tn tp tin trn mt dng):
info-dir mail.rc mtab shadowsyslog.conf temp initlog.conf mailcap shells temp termcap inittab minicom.users smb.conf termcap lynx.cfg motd shadow sysctl.conf up2date.conf

mtools.conf services

Nu ngi dng g s* ( ch cc tn c ch ci u l s) thay th tham s tp-tin th xc nh c cc tn tp tin sau:


shadow syslog.conf shadowshells sysctl.conf

Nu ngi dng g [si]* ( ch cc tn c ch ci u l s hoc i, ch dng c hai k t [ v ]) thay th tham s tp-tin th xc nh cc tn tp tin sau:
info-dir shadow sysctl.conf initlog.conf shadowsyslog.conf inittab shells services smb.conf

Lu : Nh vy, Linux (v UNIX ni chung) khng ch s dng hai k t m t nhm * v ? m cn c cch thc s dng cp k t [ v ]. Cn phn bit cp du [ v ] c s dng khi ngi dng g lnh c ngha hon ton khc vi ngha ca chng khi c s dng trong m t lnh. Hn th na, Linux cn cung cp cho ngi dng cch thc s dng phm <TAB> hon thnh nt tn tp tin (tn th mc) trong lnh. V d, khi chng ta g dng lnh # ls /u<TAB>local<TAB>b<TAB> th n cng tng ng nh g dng lnh (v y chnh l ni dung xut hin ti du nhc shell): # ls /usr/local/bin vi iu kin trong th mc /usr ch c th mc local c bt u bi ch "l" v trong th mc local cng ch c th mc bin c bt u bi ch "b". Trong trng hp nu nh mt k t cha xc nh, ngi dng cn g thm k t tip theo trong tn tp tin (tn th mc) v nhn phm <TAB> hon thnh dng lnh. 1.3.4. Tip ni dng lnh Nh lu trn y, mt dng lnh c th gm mt hoc mt s lnh, mt khc tham 19

Linux-VN, cc lnh c bn

s ca lnh c th l rt di khng th trong khun kh ca mt dng vn bn c. Khi g lnh, nu dng lnh qu di, Linux cho php ngt dng lnh xung dng di bng cch thm k t bo hiu chuyn dng " \ " ti cui dng; trong trng hp , k t " \ " phi l k t cui cng thuc dng lnh trc. V d, # cd vsd\ thumuc th dng th hai l phn tip theo ca dng th nht v kt hp c hai dng ny thc cht l mt dng lnh Linux. 1.4. Trang Man (Man Page) Chng ta c th ni rng Linux l mt h iu hnh rt phc tp vi hng nghn lnh v mi lnh li c th c ti vi hoc vi chc tnh hung s dng do chng cho php c nhiu ty chn lnh. thuc ht c ni dung tt c cc lnh ca Linux l mt iu ht sc kh khn, c th ni l khng th. Linux cho php ngi dng s dng cch thc gi cc trang Man c c cc thng tin y gii thiu ni dung cc lnh. Di y l mt s ni dung v cch thc s dng trang Man. "Man" trong "trang Man" l t vit tt ca "manual", c coi l ti liu trc tuyn trong Linux lu tr ton b cc lnh c sn vi cc thng tin tham kho kh y cho php ngi dng c th m ra nhn c tr gip. m trang Man ca mt lnh, chng ta s dng lnh man ca Linux v g: # man <tn-lnh> Ni dung ca trang Man ni chung l khng qu kh hiu, song hiu ht c n cng i hi khng t thi gian. Tuy nhin, khi qun ni dung mt lnh no th cch tt nht l hy s dng trang Man. Cu trc chung ca mt trang Man nh sau: COMMAND(1) NAME tn lnh - khi qut tc dng ca lnh SYNOPSIS c php ca lnh DESCRIPTION m t c th hn v tc dng ca lnh OPTIONS lit k cc ty chn lnh v tc dng ca chng FILES lit k cc tp tin m lnh s dng hoc tham chiu n 20 Linux Programmer's Manual COMMAND(1)

Linux-VN, cc lnh c bn

SEE ALSO lit k cc lnh, cc ti liu, ..., c lin quan n lnh REPORTING BUGS a ch lin h nu gp li khi s dng lnh AUTHOR tn tc gi ca lnh Ngi dng thm ch khng nh chnh xc tn lnh. Linux cn c mt cch thc h tr ngi dng c th nhanh chng tm c lnh cn s dng trong trng hp ch nh nhng ch ci u ca tn lnh, l cch thc s dng phm TAB. Trong cch thc ny, ngi dng cn nh mt s ch ci u tin ca tn lnh. C th trnh by cch thc theo c php sau y: # <dy-ch-ci><TAB><TAB> Trong dy-ch-ci c t mt n mt vi ch ci thuc phn u ca tn lnh. Ch rng, cc ch ci v hai phm <TAB> phi c g lin tip nhau. Kt hp cch thc ny vi cch thc s dng lnh man (vi s phong ph v ty chn ca lnh man) nhn c mt cch thc kh tuyt vi tr gip ngi dng. V d, mun s dng lnh history nhng li khng nh chnh xc tn lnh c vit ra nh th no m ch nh n c bt u bi ch h, hy g ch h ti du nhc shell v nhn phm TAB hai ln, s thy mt danh sch cc lnh c ch ci u tin l h c hin ra trn mn hnh: # h<TAB><TAB>
h2ph hostname hltest helptool head hboot htdigest hoststat hinotes hexbin help h2xs hcc htpasswd host hipstopgm hexdump helpme halt hpcdtoppm hostid history hf77 hcp hash hpftodit

Nh vy, tt c cc lnh c tn bt u vi ch h c hin th trn mn hnh v cho php ngi dng c th xc nh c lnh cn quan tm. Trng hp tn ti mt s lng ln cc lnh c cng ch ci u tin m ngi dng g, thay v hin ht mi tn lnh, h iu hnh cho ra mt thng bo hi ngi dng c mun xem ton b cc lnh hay khng. Ngi dng p ng thng bo tu theo mun ca mnh. V d, khi ngi dng g ni dung nh sau: # p<TAB><TAB> th h thng p li l:
There are 289 possibilities. Do you really wish to see them all? (y or n)

21

Linux-VN, cc lnh c bn

Ngi dng g phm "y" nu mun xem, hoc g "n" nu b qua. Ngi dng c th g nhiu hn mt ch ci u tn lnh v iu cho php gim bt s tn lnh m h thng tm c v hin th. Chng hn, khi bit hai ch ci u l "pw" v ngi dng g: # pw<TAB><TAB> th h thng s hin ra danh sch cc tn lnh bt u bi "pw":
pwck pwunconv pwconv pwd pwdb_chkpwd

Trong trng hp ny, ngi dng s nhn bit c tn lnh ang cn tm thun tin hn.

22

Linux-VN, cc lnh c bn

Chng 2. Mt s lnh lin quan n h thng 2.1. Qu trnh khi ng Linux Qu trnh ci t Linux c trnh by trong ph lc A ca cun sch ny. Trong phn ny, chng ta xem xt s b qu trnh khi ng h iu hnh Linux. Mt trong nhng cch thc khi ng Linux ph bin nht l cch thc do chng trnh LILO (LInux LOader) thc hin. Chng trnh LILO c np ln a ca my tnh khi ci t h iu hnh Linux. LILO c np vo Master Boot Record ca a cng hoc vo Boot Sector ti phn vng khi ng (trn a cng hoc a mm). Gi s my tnh ca chng ta ci t Linux v s dng LILO khi ng h iu hnh. LILO thch hp vi vic trn my tnh c ci t mt s h iu hnh khc nhau v theo , LILO cn cho php ngi dng chn la h iu hnh khi ng. Giai on khi ng Linux ty thuc vo cu hnh LILO c la chn trong tin trnh ci t Linux. Trong tnh hung n gin nht, Linux c khi ng t a cng hay a mm khi ng. LILO

Nhn

init

Qu trnh khi ng Linux c th c m t theo s trn: Theo s ny, LILO c ti vo my thc hin m vic u tin l a nhn vo b nh trong v sau ti chng trnh init thc hin vic khi ng Linux. Nu ci t nhiu phin bn Linux hay ci Linux cng cc h iu hnh khc (trong cc trng hp nh th, mi phin bn Linux hoc h iu hnh khc c gn nhn - label phn bit), th thng bo sau y c LILO a ra:
LILO boot:

cho php nhp xu l nhn ca mt trong nhng h iu hnh hin c trn my khi ng n. Ti thi im , ngi dng cn g nhn ca h iu hnh cn khi ng vo, v d, g
LILO boot: linux

nu chn khi ng lm vic trong Linux, hoc g


LILO boot: dos

nu chn khi ng lm vic trong MS-DOS, Windows. Lu : Nu chng ta khng nh c nhn ca h iu hnh c trong my chn, hy g phm <TAB> c LILO cho bit nhn ca cc h iu hnh.
LILO boot: <TAB>

s hin ra danh sch cc nhn (v d nh): linux

dos ...

v hin li thng bo ni trn ta g nhn ca h iu hnh. 23

Linux-VN, cc lnh c bn

LILO cng cho php t ch chn ngm nh h iu hnh khi ng m theo nu chng ta khng c tc ng g sau thng bo chn h iu hnh th LILO s t ng chn h iu hnh ngm nh ra khi ng. Nu chng ta khng can thip vo cc file tng ng ca trnh LILO th h iu hnh Linux l h iu hnh ngm nh. Gi s Linux c chn khi ng. Khi init thc hin, chng ta s thy mt chui (khong vi chc) dng thng bo cho bit h thng phn cng c Linux nhn din v thit lp cu hnh cng vi tt c trnh iu khin phn mm c np khi khi ng. Qu trnh init l qu trnh khi thy, l cha ca mi qu trnh. Ti thi im khi ng h thng init thc hin vai tr u tin ca mnh l chy chng trnh shell trong tp tin /etc/inittab v cc dng thng bo trn y chnh l kt qu ca vic chy chng trnh shell . Sau khi chng trnh shell ni trn c thc hin xong, qu trnh ngi dng ng nhp (login) vo h thng c tin hnh. 2.2. Th tc ng nhp v cc lnh thot khi h thng 2.2.1. ng nhp Sau khi h thng Linux (ly Red Hat 6.2 lm v d) khi ng xong, trn mn hnh xut hin nhng dng sau:
Ret Hat Linux release 6.2 (Zoot) Kernel 2.2.14-5.0 on an i686 May1 login:

Dng th nht v dng th hai cho bit loi phin bn Linux, phin bn ca nhn v kin trc phn cng c trn my, dng th ba l du nhc ng nhp ngi dng thc hin vic ng nhp. Ch l cc dng trn y c th thay i cht t ty thuc vo phin bn Linux. Chng ta c th thay i cc dng hin th nh trnh by trn y bng cch sa i tp tin /etc/rc.d/rc.local nh sau: Thay on chng trnh echo "" > /etc/issue echo "$R" >> /etc/issue echo "Kernel $(uname -r) on $a $SMP$(uname -m)" >> /etc/issue cp -f /etc/issue /etc/issue.net echo >> /etc/issue thnh echo "" > /etc/issue echo "Thng bo mun hin th" >> /etc/issue v d sa thnh: echo "" > /etc/issue echo "This is my computer" >> /etc/issue th trn mn hnh ng nhp s c dng sau:
This is my computer hostname login:

24

Linux-VN, cc lnh c bn

Ti du nhc ng nhp, hy nhp tn ngi dng (cn gi l tn ng nhp): y l tn k hiu cung cp cho Linux nhm nhn din mt ngi dng c th. Tn ng nhp ng vi mi ngi dng trn h thng l duy nht, km theo mt mt khu ng nhp.
May1 login: root Password:

Khi nhp xong tn ng nhp, h thng s hin ra thng bo hi mt khu v di chuyn con tr xung dng tip theo ngi dng nhp mt khu. Mt khu khi c nhp s khng hin th trn mn hnh v chnh iu gip trnh khi s "nhm ng" ca ngi khc. Nu nhp sai tn ng nhp hoc mt khu, h thng s a ra mt thng bo li:
May1 login: root Password: Login incorrect My1 login:

Nu ng nhp thnh cng, ngi dng s nhn thy mt s thng tin v h thng, mt vi tin tc cho ngi dng... Lc , du nhc shell xut hin ngi dng bt u phin lm vic ca mnh.
May1 login: root Password: Last login: Fri Oct 27 14:16:09 on tty2 root@may1 /root]#

Dy k t trong dng cui cng chnh l du nhc shell. Trong du nhc ny, root l tn ngi dng ng nhp, may1 l tn my v /root tn th mc hin thi (v y l ngi dng root). Khi du nhc shell xut hin trn mn hnh th iu c ngha l h iu hnh sn sng tip nhn mt yu cu mi ca ngi dng. Du nhc shell c th khc vi trnh by trn y (Mc 2.8 s cung cp cch thc thay i du nhc shell), nhng c th hiu n l chui k t bt u mt dng c cha tr chut v lun xut hin mi khi h iu hnh hon thnh mt cng vic no . 2.2.2. Ra khi h thng kt thc phin lm vic ngi dng cn thc hin th tc ra khi h thng. C rt nhiu cch cho php thot khi h thng, y chng ta xem xt mt s cch thng dng nht. Cch n gin nht m bo thot khi h thng ng n l nhn t hp phm CTRL+ALT+DEL. Khi , trn mn hnh s hin th mt s thng bo ca h thng v cui cng l thng bo thot trc khi tt my. Cn ch l: Nu ang lm vic trong mi trng X Window System, hy nhn t hp phm CTRL+ALT+BACKSPACE trc ri sau hy nhn CTRL+ALT+DEL. 25

Linux-VN, cc lnh c bn

Cch th hai l s dng lnh shutdown vi c php nh sau: shutdown [ty-chn] <time> [cnh-bo] Lnh ny cho php dng tt c cc dch v ang chy trn h thng. Cc ty-chn ca lnh ny nh sau: -k khng thc s shutdown m ch cnh bo. -r khi ng li ngay sau khi shutdown. -h tt my thc s sau khi shutdown. -f khi ng li nhanh v b qua vic kim tra a. -F khi ng li v thc hin vic kim tra a. -c b qua khng chy lnh shutdown. Trong ty chn ny khng th a ra tham s thi gian nhng c th a ra thng bo gii thch trn dng lnh gi cho tt c cc ngi dng. -t s-giy qui nh init(8) ch khong thi gian s-giy tm dng gia qu trnh gi cnh bo v tn hiu kill, trc khi chuyn sang mt mc chy khc. v hai tham s v tr cn li: time t thi im shutdown. Tham s time c hai dng. Dng tuyt i l gg:pp (gg: gi trong ngy, pp: pht) th h thng s shutdown khi ng h my trng vi gi tr tham s. Dng tng i l +<s> l hn sau thi khong <s> pht s shutdown; coi shutdown lp tc tng ng vi +0. cnh-bo thng bo gi n tt c ngi dng trn h thng. Khi lnh thc hin tt c cc my ngi dng u nhn c cnh bo. V d, khi ngi dng g lnh: shutdown +1 Sau mot phut nua he thong se shutdown! trn mn hnh ca tt c ngi dng xut hin thng bo "Sau mot phut nua he thong se 26

Linux-VN, cc lnh c bn

shutdown! " v sau mt pht th h thng shutdown thc s. Cch th ba l s dng lnh halt vi c php nh sau: halt [ty-chn] Lnh ny thc hin vic tt hn my. Cc tu chn ca lnh halt: -w khng thc s tt my nhng vn ghi cc thng tin ln tp tin /var/log/wtmp (y l tp tin lu tr danh sch cc ngi dng ng nhp thnh cng vo h thng). -d khng ghi thng tin ln tp tin /var/log/wtmp. Ty chn -n c ngha tng t song khng tin hnh vic ng b ha. -f thc hin tt my ngay m khng thc hin ln lt vic dng cc dch v c trn h thng. -i ch thc hin dng tt c cc dch v mng trc khi tt my. Chng ta cn nh rng, nu thot khi h thng khng ng cch th dn n hu qu l mt s tp tin hay ton b h thng tp tin c th b h hng. Lu : C th s dng lnh exit tr v du nhc ng nhp hoc kt thc phin lm vic bng lnh logout. 2.2.3. Khi ng li h thng Ngoi vic thot khi h thng nh cc cch thc trn y (n t hp ba phm Ctrl+Alt+Del, dng lnh shutdown hoc lnh halt), khi cn thit (chng hn, gp phi tnh hung mt trnh ng dng chy qun) c th khi ng li h thng nh lnh reboot. C php lnh reboot: reboot [ty-chn] Lnh ny cho php khi ng li h thng. Kh siu ngi dng s dng lnh reboot th khng sao, nhng nu ngi dng bnh thng ang lm vic th lnh reboot vn c thc hin song h thng i hi vic xc nhn mt khu. Cc ty chn ca lnh reboot nh sau l -w, -d, -n, -f, -i c ngha tng t nh trong lnh halt.

27

Linux-VN, cc lnh c bn

2.3. Lnh thay i mt khu Mt khu l vn rt quan trng trong cc h thng a ngi dng v m bo tnh bo mt ti a, cn thit phi ch ti vic thay i mt khu. Thm ch trong trng hp h thng ch c mt ngi s dng th vic thay i mt khu vn l rt cn thit. Mt khu l mt xu k t i km vi tn ngi dng m bo cho php mt ngi vo lm vic trong h thng vi quyn hn c quy nh. Trong qu trnh ng nhp, ngi dng phi g ng tn v mt khu, trong g mt khu l cng vic bt buc phi thc hin. Tn ngi dng c th c cng khai song mt khu th tuyt i phi c m bo b mt. Vic ng k tn v mt khu ca siu ngi dng c tin hnh trong qu trnh khi to h iu hnh Linux. Vic ng k tn v mt khu ca mt ngi dng thng thng c tin hnh khi mt ngi dng mi ng k tham gia s dng h thng. Thng thng siu ngi dng cung cp tn v mt khu cho ngi dng mi (c th do ngi dng ngh) v dng lnh adduser (hoc lnh useradd) ng k tn v mt khu vi h thng. Sau , ngi dng mi nht thit cn thay i mt khu bo m vic gi b mt c nhn tuyt i. Lnh passwd cho php thay i mt khu ng vi tn ng nhp ngi dng. C php lnh passwd nh sau: passwd [ty-chn] [tn-ngi-dng] vi cc ty chn nh sau: -k thay i mt khu ngi dng. Lnh i hi phi xc nhn quyn bng vic g mt khu ang dng trc khi thay i mt khu. Cho php ngi dng thay i mt khu ca mnh c lp vi siu ngi dng. -f t mt khu mi cho ngi dng song khng cn tin hnh vic kim tra mt khu ang dng. Ch siu ngi dng mi c quyn s dng tham s ny. -l kha mt ti khon ngi dng. Vic kha ti khon thc cht l vic dch bn m ha mt khu thnh mt xu k t v ngha bt u bi k hiu "!". Ch siu ngi dng mi c quyn s dng tham s ny. -stdin vic nhp mt khu ngi dng ch c tin hnh t thit b vo chun khng th tin hnh t ng dn (pipe). Nu khng c tham s ny cho php nhp mt khu c t thit b vo chun hoc t ng dn. -u m kha (tho b kha) mt ti khon (i ngu vi tham s -l). Ch siu 28

Linux-VN, cc lnh c bn

ngi dng mi c quyn s dng tham s ny. -d xa b mt khu ca ngi dng. Ch siu ngi dng mi c quyn s dng tham s ny. -S hin th thng tin ngn gn v trng thi mt khu ca ngi dng c a ra. Ch siu ngi dng mi c quyn s dng tham s ny. Nu tn-ngi-dng khng c trong lnh th ngm nh l chnh ngi dng g lnh ny. V d khi ngi dng user1 g lnh: # passwd user1 h thng thng bo:
Changing password for user user1 New UNIX password:

ngi dng nhp mt khu mi ca mnh vo. Sau khi ngi dng g xong mt khu mi, h thng cho ra thng bo:
BAD PASSWORD: it is derived from your password entry Retype new UNIX password:

ngi dng khng nh mt ln na mt khu va g dng trn (nh phi g li ng ht nh ln trc). Ch nn qu phn vn v thng bo dng pha trn v hu ht khi g mt khu mi lun gp nhng thng bo kiu i loi nh vy, chng hn nh:
BAD PASSWORD: it is too simplistic/systematic

V sau khi chng ta khng nh li mt khu mi, h thng cho ra thng bo:
Passwd: all authentication tokens updated successfully.

cho bit vic thay i mt khu thnh cng v du nhc shell li hin ra. Khi siu ngi dng g lnh: # passwd -S root s hin ra thng bo
Changing password for user root Password set, MD5 encryption

cho bit thut ton m ha mt khu m Linux s dng l mt thut ton hm bm c tn l MD5. Lu : C mt li khuyn i vi ngi dng l nn chn mt khu khng qu n gin qu (nhm trnh ngi khc d d tm ra) hoc khng qu phc tp (trnh kh khn cho chnh ngi dng khi phi ghi nh v g mt khu). c bit khng 29

Linux-VN, cc lnh c bn

nn s dng h tn, ngy sinh, s in thoi ... ca bn thn hoc ngi thn lm mt khu v y l mt trong nhng trng hp mt khu n gin nht. Nu thng bo mt khu qu n gin c lp i lp li mt vi ln v khng c thng bo mt khu mi thnh cng quay v du nhc shell th nn g li lnh v chn mt mt khu mi phc tp hn i cht. 2.4. Lnh xem, thit t ngy, gi hin ti v xem lch trn h thng 2.4.1. Lnh xem, thit t ngy, gi Lnh date cho php c th xem hoc thit t li ngy gi trn h thng. C php ca lnh gm hai dng, dng xem thng tin v ngy, gi: date [ty-chn] ... [+nh-dng] v dng thit t li ngy gi cho h thng: date [ty-chn] [MMDDhhmm[ [CC]YY] [.ss]] Cc ty-chn nh sau: -d, --date=xu-vn-bn hin th thi gian di dng xu-vn-bn, m khng ly "thi gian hin ti ca h thng nh theo ngm nh; xu-vn-bn c t trong hai du nhy n hoc hai du nhy kp. -f, --file=tp-tin-vn-bn ging nh mt tham s --date nhng ng vi nhiu ngy cn xem: mi dng ca tp-tin-vn-bn c vai tr nh mt xu-vn-bn trong trng hp tham s --date. -I, --iso-8601[=m-t] hin th ngy gi theo chun ISO-8601 (v d: 2000-11-8). -I tng ng vi tham s --iso-8601='date' Vi --iso-8601: nu m-t l 'date' (hoc khng c) th hin th ngy, nu m-t l 'hours' hin th ngy+gi, nu m-t l 'minutes': ngy+gi+pht; nu m-t l 'seconds': ngy + gi + pht + giy. -r, --reference= tp-tin hin th thi gian sa i tp-tin ln gn y nht. -R, --rfc-822 hin th ngy theo RFC-822 (v d: Wed, 8 Nov 2000 09:21:46 -0500). -s, --set=xu-vn-bn thit t li thi gian theo kiu xu-vn-bn. -u, --utc, --universal 30

Linux-VN, cc lnh c bn

hin th hoc thit t thi gian theo UTC (v d: Wed Nov 8 14:29:12 UTC 2000). --help hin th thng tin tr gip v thot. Trong dng lnh date cho xem thng tin ngy, gi th tham s nh-dng iu khin cch hin th thng tin kt qu. nh-dng l dy c t mt n nhiu cp gm hai k t, trong mi cp k t u tin l % cn k t th hai m t nh dng. Do s lng nh dng l rt nhiu v vy chng ta ch xem xt mt s nh dng in hnh ( xem y cc nh dng, s dng lnh man date). Di y l mt s nh dng in hnh: %% Hin ra chnh k t %. %a Hin ra thng tin tn ngy trong tun vit tt theo ngn ng bn a. %A Hin ra thng tin tn ngy trong tun vit y theo ngn ng bn a. %b Hin ra thng tin tn thng vit tt theo ngn ng bn a. %B Hin ra thng tin tn thng vit y theo ngn ng bn a. Trong dng lnh date cho php thit t li ngy gi cho h thng th tham s [MMDDhhmm[ [CC]YY] [.ss]] m t ngy, gi mi cn thit t, trong : MM: DD: hh: mm: CC: YY: hai s ch thng, hai s ch ngy trong thng, hai s ch gi trong ngy, hai s ch pht, hai s ch th k, hai s ch nm trong th k.

Cc dng ngay di y trnh by mt s v d s dng lnh date, mi v d c cho tng ng vi mt cp hai dng, trong dng trn m t lnh c g cn dng di l thng bo ca Linux. # date
Wed Jan 3 23:58:50 ICT 2001

# date -d='01/01/2000' 31

Linux-VN, cc lnh c bn

Sat Jan 1 00:00:00 ICT 2000

# date -iso-8601='seconds'
2000-12-01T00:36:41-0500

# date -d='01/01/2001'
Mon Jan 1 00:00:00 ICT 2001

# date 010323502001.50
Wed Jan 3 23:50:50 ICT 2001

# date +%a%A
Wed Wednesday

# date +%a%A%b%B
Wed Wednesday Jan January

# date +%D%%%j
01/05/01%005

2.4.2. Lnh xem lch Lnh cal cho php xem lch trn h thng vi c php nh sau: cal [ty-chn] [<thng> [<nm>]] nu khng c tham s, lch ca thng hin thi s c hin th. Cc tu-chn l: -m chn ngy Th hai l ngy u tin trong tun (mc nh l ngy Ch nht). -j hin th s ngy trong thng di dng s ngy trong nm (v d: ngy 1/11/2000 s c hin th di dng l ngy th 306 trong nm 2000, s ngy bt u c tnh t ngy 1/1). -y hin th lch ca nm hin thi. V d: # cal 1 2001
January 2001 Su 7 14 Mo 1 8 15 Tu 2 9 16 We 3 10 17 Th 4 11 18 Fr 5 12 19 Sa 6 13 20

32

Linux-VN, cc lnh c bn

21 28

22 29

23 30

24 31

25

26

27

Khi nhp dng lnh trn, trn mn hnh s hin th lch ca thng 1 nm 2001, mc nh chn ngy ch nht l ngy bt u ca tun. Di y l v d hin th s ngy trong thng 3 di dng s ngy trong nm 2001. # cal -j 3 2001
March 2001 Su 63 70 77 84 Mo 64 71 78 85 Tu 65 72 79 86 We 66 73 80 87 Th 60 67 74 81 88 Fr 61 68 75 82 89 Sa 62 69 76 83 90

2.5. Lnh gi ngn ng tnh ton s hc Linux cung cp mt ngn ng tnh ton vi chnh xc ty thng qua lnh bc. Khi yu cu lnh ny, ngi dng c cung cp mt ngn ng tnh ton (v cho php lp trnh tnh ton c dng ngn ng lp trnh C) hot ng theo thng dch. Trong ngn ng lp trnh c cung cp (tm thi gi l ngn ng bc), tn ti rt nhiu cng c h tr tnh ton v lp trnh tnh ton: kiu php ton s hc phong ph, php ton so snh, mt s hm chun, bin chun, cu trc iu khin, cch thc nh ngha hm, cch thc thay i chnh xc, t li ch thch ... Ch cn s dng mt phn nh tc ng ca lnh bc, chng ta c mt "my tnh s bm tay" hiu qu. C php lnh bc: bc [ty-chn] [tp-tin...] vi cc tu chn sau y: -l, --mathlib thc hin php tnh theo chun 5/5=1.00000000000000000000). -w, --warn khi thc hin php tnh khng tun theo chun POSIX (POSIX l mt chun trong Linux) th mt cnh bo xut hin. -s, --standard thc hin php tnh chnh xc theo chun ca ngn ng POSIX bc. -q, --quiet khng hin ra li gii thiu v phn mm GNU khi dng bc. Tham s tp-tin l tn tp tin cha chng trnh vit trn ngn ng bc, khi lnh bc thc 33 th vin ton hc (v d:

Linux-VN, cc lnh c bn

hin s t ng chy cc tp tin chng trnh ny (Nu c nhiu tham s th c ngha s chy nhiu chng trnh lin tip nhau). Di y l mt v d s dng lnh bc dng n gin nht. Khi g lnh ti du nhc: # bc -l mn hnh xut hin li gii thiu v GNU khi dng bc v ngn ng bc c kch hot phc v ngi dng.
bc 1.05 Copyright 1991, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 5^3 125 12+12+78*7-62/4 554.50000000000000000000 a=4 a^a 256 a*78 312 b=45 a*b 180 a/b .08888888888888888888 a%b .00000000000000000040

y * l php nhn, ^ l php tnh lu tha, / l php chia ly thng, % l chia ly phn d. Lu : Ngn ng lp trnh tnh ton bc l mt ngn ng rt mnh c ni dung ht sc phong ph cho nn trong khun kh ca cun sch ny khng th m t ht cc ni dung ca ngn ng c. Chng ta cn s dng lnh man bc nhn c thng tin y v lnh bc v ngn ng tnh ton bc. y trnh by s b mt s yu t c bn nht ca ngn ng (bt l vit tt ca biu thc, b l vit tt ca bin): 34

Linux-VN, cc lnh c bn

Cc php tnh: - bt: ly i; ++ b, --b, b ++, b --: php ton tng, gim b; cc php ton hai ngi cng +, tr -, nhn *, chia /, ly phn d %, ly tha nguyn bc ^; gn =; gn sau khi thao tc <thao tc>=; cc php ton so snh <, <=, >, >=, bng ==, khc != ... Php so snh cho 1 nu ng, cho 0 nu sai. Bn bin chun l scale s lng ch s phn thp phn; last gi tr tnh ton cui cng; ibase c s h m i vi input v obase l c s h m vi output (ngm nh hai bin ny c gi tr 10). Cc hm chun sin s (bt); cosin c (bt); arctg a (bt); lgarit t nhin l (bt); m c s t nhin e (bt); hm Bessel bc nguyn n ca bt l j (n, bt). 2.6. Xem thng tin h thng Lnh uname cho php xem thng tin h thng vi c php l: uname [ty-chn] Nu khng c tu chn th hin tn h iu hnh. Lnh c cc ty chn l: -a, --all hin tt c cc thng tin. -m, --machine kiu kin trc ca b x l (i386, i486, i586, i686...). -n, --nodename hin tn ca my. -r, --release hin nhn ca h iu hnh. -s, --sysname hin tn h iu hnh. -p, --processor hin kiu b x l ca my ch. V d, nu g lnh # uname -a th mn hnh s hin ra nh sau:
Linux linuxsrv.linuxvn.net 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686 unknown

# Thng tin hin ra c tt c 6 trng l: Tn h iu hnh: Linux 35

Linux-VN, cc lnh c bn

Tn my: linuxsrv.linuxvn.net Tn nhn ca h iu hnh: 2.2.14-5.0 Ngy sn xut: #1 Tue Mar 7 21:07:39 EST 2000 Kiu kin trc b x l: i686 Kiu b x l ca my ch: unknown V d nu g lnh: # uname -spr th mn hnh s hin ra nh sau:
Linux 2.2.14-5.0 unknown

l tn h iu hnh, tn nhn v kiu b x l ca my ch. Lu : Chng ta lm r thm ni dung lu trong mc 1.3.1 v tham s kha kt hp: Trong v d trn y khi vit tham s -spr l yu cu thc hin lnh usame vi ngha kt hp tnh hung theo c ba tham s kha -s, -p, -r. Ch rng, khng th vit -s -p -r thay cho -spr c. Nh lu mc 1.3.1 trong nhiu lnh ca Linux cho php vit kt hp cc tham s kha theo cch thc nh trn min l cc tham s khng xung khc vi nhau. 2.7. Hin dng vn bn Lnh echo hin ra dng vn bn c ghi ngay trong dng lnh c c php: echo [ty-chn]...[xu k t]... vi cc tu chn nh sau: -n hin xu k t v du nhc trn cng mt dng. -e bt kh nng thng dch c cc k t iu khin. -E tt kh nng thng dch c cc k t iu khin. --help hin h tr v thot. Mt s bn Linux khng h tr tham s ny. V d, dng lnh echo vi tham s -e # echo -e th
dng lnh echo

\n

s thy hin ra chnh dng vn bn lnh: th dng lnh echo 36

Linux-VN, cc lnh c bn

# y k t iu khin \n l k t xung dng. 2.8. Thay i ni dung du nhc shell Trong Linux c hai loi du nhc: du nhc cp mt (du nhc shell) xut hin khi nhp lnh v du nhc cp hai (du nhc nhp liu) xut hin khi lnh cn c d liu c nhp t bn phm v tng ng vi hai bin nhc tn l PS1 v PS2. PS1 l bin h thng tng ng vi du nhc cp 1: Gi tr ca PS1 chnh l ni dung hin th ca du nhc shell. nhn bit thng tin h thng hin ti, mt nhu cu t ra l cn thay i gi tr ca cc bin h thng PS1 v PS2. Linux cho php thay i gi tr ca bin h thng PS1 bng lnh gn tr mi cho n. Lnh ny c dng: # PS1='<dy k t>' Nm (5) k t u tin ca lnh gn trn y (PS1=') phi c vit lin tip nhau. Dy k t nm gia cp hai du nhy n (c th s dng cp hai du kp ") v khng c php cha du nhy. Dy k t ny bao gm cc cp k t iu khin v cc k t khc, cho php c th c du cch. Cp k t iu khin gm hai k t, k t u tin l du s xui "\" cn k t th hai nhn mt trong cc trng hp lit k trong bng di y. Bng di y gii thiu mt s cp k t iu khin c th c s dng khi mun thay i du nhc lnh: Cp k t iu ngha khin \! \# \$ \\ \d \h \n \s \t \u \W Hin th th t ca lnh trong lch s Hin th th t ca lnh Hin th du -la ($). i vi siu ngi dng (super user), th hin th du s hiu (#) Hin th du s (\) Hin th ngy hin ti Hin th tn my (hostname) K hiu xung dng Hin th tn h shell Hin th gi hin ti Hin th tn ngi dng Hin th tn thc s ca th mc hin thi (v d th mc hin thi l /mnt/hda1 th tn thc s ca n l /hda1)

37

Linux-VN, cc lnh c bn

\w

Hin th tn y ca th mc hin thi (v d /mnt/hda1)

V d, hin thi du nhc shell c dng: root@may1 /hda1]# Sau khi chng ta g lnh root@may1 /hda1]# PS1='[\h@\u \w : \d]\$' th du nhc shell c thay i l: [may1@root /mnt/hda1 : Fri Oct 27 ]# ngoi vic i th t gia tn ngi dng v my cn cho chng ta bit thm v ngy h thng qun l v tn y ca th mc hin thi. Linux cung cp cch thc hon ton tng t nh i vi bin PS1 thay i gi tr bin h thng PS2 tng ng vi du nhc cp hai.

38

Linux-VN, cc lnh c bn

Chng 3. H thng tp tin 3.1. Tng quan v h thng tp tin 3.1.1. Mt s khi nim Ngi dng tng lm vic vi h iu hnh DOS/Windows th rt quen bit vi cc khi nim: tp tin (File), th mc, th mc hin thi ... cun sch mang tnh h thng v thun tin cho ngi dng cha tng lm vic thnh tho vi mt h iu hnh no khc, chng ny vn gii thiu v cc khi nim ny mt cch s b. Mt i tng in hnh trong cc h iu hnh l tp tin. Tp tin l mt tp hp d liu c t chc c h iu hnh qun l theo yu cu ca ngi dng. Cch t chc d liu trong tp tin thuc v ch ca n l ngi dng to ra tp tin. Tp tin c th l mt vn bn (trng hp c bit l chng trnh ngun trn C, PASCAL, shell script ...), mt chng trnh ngn ng my, mt tp hp d liu ... H iu hnh t chc vic lu tr ni dung tp tin trn cc thit b nh lu di (chng hn a t) v m bo cc thao tc ln tp tin. Chnh v c h iu hnh m bo cc chc nng lin quan n tp tin nn ngi dng khng cn bit tp tin ca mnh lu vng no trn a t, bng cch no c/ghi ln cc vng ca a t m vn thc hin c yu cu tm kim, x l ln cc tp tin. H iu hnh qun l tp tin theo tn gi ca tp tin (tn tp tin) v mt s thuc tnh lin quan n tp tin. Trc khi gii thiu m t s ni dung lin quan n tn tp tin v tn th mc, chng ta gii thiu s b v khi nim th mc. lm vic c vi cc tp tin, h iu hnh khng ch qun l ni dung tp tin m cn phi qun l cc thng tin lin quan n cc tp tin. Th mc (directory) l i tng c dng cha thng tin v cc tp tin, hay ni theo mt cch khc, th mc cha cc tp tin. Cc th mc cng c h iu hnh qun l trn vt dn ngoi v v vy, theo ngha ny, th mc cng c coi l tp tin song trong mt s trng hp phn bit vi "tp tin" th mc, chng ta dng thut ng tp tin thng thng. Khc vi tp tin thng thng, h iu hnh li quan tm n ni dung ca th mc. Mt s ni dung sau y lin quan n tn tp tin (bao gm c tn th mc): Tn tp tin trong Linux c th di ti 256 k t, bao gm cc ch ci, ch s, du gch ni, gch chn, du chm. Tn th mc/tp tin trong Linux c th c nhiu hn mt du chm, v d: This_is.a.VERY_long.filename. Nu trong tn tp tin c du chm "." th xu con ca tn tp tin t du chm cui cng c gi l phn m rng ca tn tp tin (hoc tp tin). V d, tn tp tin trn y c phn m rng l .filename. Ch rng khi nim phn m rng y khng mang ngha nh mt s h iu hnh khc. Lu : Chng ta nn lu rng, khng phi k t no cng c ngha. Nu c hai tp tin ch khc nhau k t cui cng, th i vi Linux, l hai tp tin trng tn. Bi l, Linux ch ly 32 hay 64 k t u tin trong tn tp tin m thi (ty theo phin bn Linux), phn tn tp tin cn li dnh cho ch ca tp tin, Linux theo di thng tin, nhng thng khng xem cc k t ng sau k t th 33 hay 65 l quan trng i vi n. 39

Linux-VN, cc lnh c bn

Xin nhc li lu v phn bit ch hoa v ch thng i vi tn th mc/tp tin, v d hai tp tin FILENAME.tar.gz v filename.tar.gz l hai tp tin khc nhau. Nu trong tn th mc/tp tin c cha khong trng, s phi t tn th mc/tp tin vo trong cp du nhy kp s dng th mc/tp tin . V d, to th mc c tn l My document chng hn, hy nh dng lnh sau: # mkdir "My document" Mt s k t sau khng c s dng trong tn th mc/tp tin: !, *, $, &, # ... Khi s dng chng trnh mc (Midnight Commander - chng 8), cc tp tin kh thi trong Linux c du "*" c t trc tn tp tin, cc tp tin sao lu c du "~" v cc tp tin c tn bt u bi du "." l cc tp tin n, cc tp tin c du "@" l cc tp tin lin kt... Tp hp tt c cc tp tin c trong h iu hnh c gi l h thng tp tin l mt h thng thng nht. Bi chnh t cch thc s dng th mc, h thng tp tin c t chc lgic theo dng hnh cy: H thng tp tin c xut pht t mt th mc gc (c k hiu l "/") v cho php to ra th mc con trong mt th mc bt k. Thng thng, khi khi to Linux c ngay h thng tp tin ca n. Hnh 3.1. cho minh ha mt phn trong cy lgic ca h thng tp tin. /

root peng office52 sh user2 tty00 tty01

bin date who

etc X11

usr src

home bin

dev user1

xinit Xclients Xmodmap

Hnh 3.1. Mt phn cu trc lgic dng cy ca h thng File

ch mt tp tin hay mt th mc, chng ta cn a ra mt ng dn, v d ng dn xc nh tp tin Xclients trong hnh 3.1. chng ta vit nh sau:
/etc/X11/xinit/Xclients

ng dn ny cho bit Xclients nm trong xinit, xinit nm trong X11, X11 nm trong etc v etc nm trong gc /. Tn tp tin thng l tham s thc s khi g lnh v cng vic g lnh tr nn rt nng n i vi ngi dng nu nh trong lnh phi g mt ng dn di theo dng trn (c 40

Linux-VN, cc lnh c bn

bit vi tn gi l ng dn tuyt i). V vy, Linux (cng nh nhiu h iu hnh khc) s dng khi nim th mc hin thi ca mi ngi dng lm vic trong h thng. Th mc hin thi l mt th mc trong h thng tp tin m hin thi "ngi dng ang ". Qua th mc hin thi, Linux cho php ngi dng ch mt tp tin trong lnh ngn gn hn nhiu. V d, nu th mc hin thi l th mc xinit th ch tp tin ni, ngi dng ch cn vit Xclients hoc ./Xclients trong k hiu "." ch th mc hin thi. ng dn c xc nh qua th mc hin thi c gi l ng dn tng i. Khi mt ngi dng ng nhp vo h thng, Linux lun chuyn ngi dng vo th mc ring, v ti thi im th mc ring l th mc hin thi ca ngi dng. Th mc ring ca siu ngi dng l /root, th mc ring ca ngi dng c tn l user1 l /home/user1 ... Linux cho php dng lnh cd chuyn sang th mc khc (ly th mc khc lm th mc hin thi). Hai du chm ".." c dng ch th mc ngay trn th mc hin thi (cha ca th mc hin thi). Linux cn cho php ghp mt h thng tp tin trn mt thit b nh (a mm, vng a cng cha c a vo h thng tp tin) thnh mt th mc con trong h thng tp tin ca h thng bng lnh mount. Cc h thng tp tin c ghp thuc vo cc kiu khc nhau. Hai mc tip theo (3.1.2 v 3.1.3.) gii thiu nhng ni dung su hn v h thng tp tin Linux dnh cho cc bn c mun tm hiu thm v h thng tp tin ca mt h iu hnh UNIX in hnh. 3.1.2. S b kin trc ni ti ca h thng tp tin Trn a t, h thng tp tin c coi l dy tun t cc khi lgic mi khi cha hoc 512B hoc 1024B hoc bi ca 512B l c nh trong mt h thng tp tin. Trong h thng tp tin, cc khi d liu c a ch ha bng cch nh ch s lin tip, mi a ch c cha trong 4 byte (32 bit). Cu trc ni ti ca h thng tp tin bao gm 4 thnh phn k tip nhau: Boot block (dng khi ng h thng), Siu khi (Super block), Danh sch inode v Vng d liu. Di y, chng ta xem xt s lc ni dung cc thnh phn cu trc ni ti mt h thng tp tin. Siu khi Siu khi cha nhiu thng tin lin quan n trng thi ca h thng tp tin. Trong siu khi c cc trng sau y: Kch thc ca danh sch inode (khi nim inode s c gii thch trong mc sau): nh kch c vng khng gian trn H thng tp tin qun l cc inode. Kch thc ca h thng tp tin. Hai kch thc trn y tnh theo n v dung lng b nh ngoi vt l, Mt danh sch ch s cc khi ri (thng trc trn siu khi) trong h thng tp tin. 41

Linux-VN, cc lnh c bn

Ch s cc khi ri thng trc trn siu khi c dng p ng nhu cu phn phi mi. Ch rng, danh sch ch s cc khi ri c trn siu khi ch l mt b phn ca tp tt c cc khi ri c trn h thng tp tin. Ch s ca khi ri tip theo trong danh sch cc khi ri. Ch s khi ri tip theo dng h tr vic tm kim tip cc khi ri: bt u tm t khi c ch s ny tr i. iu c ngha l mi khi c ch s khng ln hn ch s ny hoc c trong danh sch cc khi ri thng trc hoc c cp pht cho mt tp tin no . Nhiu thao tc to tp tin mi, xo tp tin, thay i ni dung tp tin v.v. cp nht cc thng tin ny. Mt danh sch cc inode ri (thng trc trn siu khi) trong h thng tp tin. Danh sch ny cha ch s cc inode ri c dng phn phi ngay c cho mt tp tin mi c khi to. Thng thng, danh sch ny ch cha mt b phn cc inode ri trn h thng tp tin. Ch s inode ri tip theo trong danh sch cc inode ri. Ch s inode ri tip theo nh v vic tm kim tip thm inode ri: bt u tm t inode c ch s ny tr i. iu c ngha l mi inode c ch s khng ln hn ch s ny hoc c trong danh sch cc inode ri thng trc hoc c tng ng vi mt tp tin no . Hai tham s trn y to thnh cp xc nh c danh sch cc inode ri trn h thng tp tin cc thao tc to tp tin mi, xo tp tin cp nht thng tin ny. Cc trng kha (lock) danh sch cc khi ri v danh sch inode ri: Trong mt s trng hp, chng hn khi h thng ang lm vic thc s vi a t cp nht cc danh sch ny, h thng khng cho php cp nht ti hai danh sch ni trn. C ch dn v vic siu khi c bin i: nh k thi gian siu khi b nh trong c cp nht li vo siu khi a t v v vy cn c thng tin v vic siu khi b nh trong khc vi ni dung b nh ngoi: nu hai bn khng ging nhau th cn phi bin i chng c ng nht. C ch dn rng h thng tp tin ch c th c (cm ghi): Trong mt s trng hp, h thng ang cp nht thng tin t b nh ngoi th ch cho php c i vi h thng tp tin, S lng tng cng cc khi ri trong h thng tp tin, S lng tng cng cc inode ri trong h thng tp tin, Thng tin v thit b, Kch thc khi (n v phn phi d liu) ca h thng tp tin. Hin ti kch thc ph bin ca khi l 1KB. Trong thi gian my hot ng, theo tng giai on, nhn s a siu khi ln a nu n c bin i ph hp vi d liu trn h thng tp tin. 42

Linux-VN, cc lnh c bn

Mt trong khi nim ct li xut hin trong h thng tp tin l inode. Cc i tng lin quan n khi nim ny s c trnh by trong cc mc tip theo. Inode Mi khi mt qu trnh khi to mt tp tin mi, nhn h thng s gn cho n mt inode cha s dng. hiu r hn v inode, chng ta xem xt s lc mi quan h lin quan gia tp tin d liu v vic lu tr trn vt dn ngoi i vi Linux. Ni dung ca tp tin c cha trong vng d liu ca h thng tp tin v c phn chia cc khi d liu (ni dung tp tin) v hnh nh phn b ni dung tp tin c trong mt inode tng ng. Lin kt n tp hp cc khi d liu ny l mt inode, ch thng qua inode mi c th lm vic vi d liu ti cc khi d liu: Inode cha dng thng tin v tp hp cc khi d liu ni dung tp tin. C th quan nim rng, tp hp bao gm inode v tp cc khi d liu nh vy l mt tp tin vt l: inode c thng tin v tp tin vt l, trong c a ch cc khi d liu cha ni dung ca tp tin vt l. Thut ng inode l s kt hp ca hai t index vi node v c s dng ph dng trong Linux. Cc inode c phn bit nhau theo ch s ca inode: chnh l s th t ca inode trong danh sch inode trn h thng tp tin. H thng dng 2 bytes lu tr ch s ca inode. Vi cch lu tr ch s nh th, khng c nhiu hn 65535 inode trong mt h thng tp tin. Nh vy, mt tp tin ch c mt inode song mt tp tin li c mt hoc mt s tn tp tin. Ngi dng tc ng thng qua tn tp tin v tn tp tin li tham chiu n inode (hai ni dung v tn tp tin v ch s inode l hai trng ca mt phn t ca mt th mc). Mt inode c th tng ng vi mt hoc nhiu tn tp tin, mi tng ng nh vy c gi l mt lin kt. Cc inode c lu tr trn h thng tp tin ti vng danh sch cc inode. Trong qu trnh lm vic, Linux dng mt vng b nh, c gi l bng inode (trong mt s trng hp, n cn c gi tng minh l bng sao in-core inode) vi chc nng tng ng vi vng danh sch cc inode c trong h thng tp tin, h tr cho qu trnh truy nhp d liu trong h thng tp tin. Ni dung ca mt in-core inode khng ch cha cc thng tin trong inode tng ng m cn c b sung cc thng tin mi gip cho qu trnh x l inode. Chng ta xem xt cu trc ni ti ca mt inode thy c s trnh by ni ti ca mt tp tin. Inode bao gm cc trng thng tin sau y: Kiu tp tin. Trong Linux phn loi cc kiu tp tin: tp tin thng thng (regular), th mc, c t k t, c t khi v ng dn FIFO (pipes). Linux quy nh trng kiu tp tin c gi tr 0 tng ng l inode cha c s dng. Quyn truy nhp tp tin. Trong Linux, tp tin l mt ti nguyn chung ca h thng v vy quyn truy nhp tp tin c c bit quan tm trnh nhng trng hp truy nhp khng hp l. i vi mt inode, c 3 mc quyn truy nhp lin quan n cc i tng: mc ch nhn ca tp tin (i tng ny c k hiu l u: t ch user), mc nhm ngi dng ca ch nhn ca tp tin (i tng ny c 43

Linux-VN, cc lnh c bn

k hiu l g: t ch group), mc ngi dng khc (i tng ny c k hiu l a: t ch all). Quyn truy nhp l c, ghi, thc hin hoc mt t hp no t nhm gm 3 quyn trn. Ch rng, quyn thc hin i vi mt th mc no tng ng vi vic cho php tm mt tn tp tin no c trong th mc . S lng lin kt i vi inode: y chnh l s lng cc tn tp tin trn cc th mc c lin kt vi inode ny, nh danh ch nhn ca inode, nh danh nhm ch nhn: xc nh tn nhm ngi dng m ch tp tin l mt thnh vin ca nhm ny, di ca tp tin tnh theo byte, Thi gian truy nhp tp tin: thi gian tp tin c sa i mun nht, thi gian tp tin c truy nhp mun nht, thi gian tp tin c khi to, Bng cha cc a ch khi nh cha ni dung tp tin. Bng ny cha 13 phn t a ch, trong c 10 phn t trc tip, 1 phn t gin tip bc 1, 1 phn t gin tip bc 2 v mt phn t gin tip bc 3. Ni dung ca tp tin thay i khi c thao tc ghi ln n; ni dung ca mt inode thay i khi ni dung ca tp tin thay i hoc thay i ch hoc thay i quyn hoc thay i s lin kt. V d v ni dung mt inode nh sau: type regular perms rwxr-xr-x links 2 owner 41CT group 41CNTT size 5703 bytes accessed Sep 14 1999 7:30 AM modified Sep 10 1999 1:30 PM inode Aug 1 1995 10:15 AM Cc phn t a ch d liu Bn sao in-core inode cn b sung thm trng trng thi ca in-core inode. Trng trng thi ca in-core inode c cc thng tin sau: inode b kho, 44

Linux-VN, cc lnh c bn

mt qu trnh ang ch i khi inode tho kha, in-core inode khc vi inode do s thay i d liu trong inode, in-core inode khc vi inode do s thay i d liu trong tp tin, s lng cc tn tp tin ni vi tp tin ang c m, s hiu thit b lgic ca h thng tp tin cha tp tin ni trn ch s inode: dng lin kt vi inode trn a, cc mc ni ti cc in-core inode khc. Trong b nh trong, cc incore inode c lin kt theo mt hng bm v mt danh sch t do. Trong danh sch hng bm cc in-core inode ha hp theo s hiu thit b lgic v s hiu inode. Trong qu trnh h thng lm vic, ny sinh khi nim inode tch cc nu nh c mt qu trnh ang lm vic vi inode (nh m tp tin). Mt inode thuc vo danh sch cc inode ri khi khng c tp tin vt l no tng ng vi inode . 3.1.3. Lin kt tng trng (lnh ln) Trong Linux c hai kiu lin kt l lin kt tng trng (lin kt mm) v lin kt cng. "Lin kt cng" l mt cch gi khc i vi mt tp tin ang tn ti (khng c s phn bit gia tp tin gc v tp tin lin kt). Theo cch ni k thut, chng cng chia s mt inode v inode ny cha ng tt c cc thng tin v tp tin. Khng th to mt lin kt cng ti mt th mc. "Lin kt tng trng" l mt kiu tp tin c bit, trong , mt tp tin lin kt thc s tham chiu theo tn n mt tp tin khc. C th hiu kiu tp tin ny nh l mt con tr tr ti mt tp tin hoc mt th mc, v c s dng thay th cho tp tin hoc th mc c tr ti. Hu ht cc thao tc (nh m, c, ghi ...) c thc hin trn cc tp tin lin kt, sau , nhn h thng s t ng "tham chiu" v thc hin trn tp tin ch ca lin kt. Tuy nhin, c mt s cc thao tc nh xa tp tin, tp tin lin kt s b xa b ch khng phi tp tin ch ca n. to mt lin kt tng trng, hy s dng lnh ln vi c php nh sau: ln [ty-chn] ... <ch> [tn-ni] Lnh ny s to mt lin kt n th mc/tp tin ch vi tn tp tin lin kt l tnni. Nu tn-ni khng c, mt lin kt vi tn tp tin lin kt ging nh tn tp tin ch s c to ra trong th mc hin thi. Cc tu chn ca lnh ln: -b, --backup[=CONTROL] to lin kt quay tr li cho mi tp tin ch ang tn ti. -f, --force 45

Linux-VN, cc lnh c bn

xa b cc tp tin ch ang tn ti. -d, -F, --directory to lin kt cng n cc th mc (ty chn ny ch dnh cho ngi dng c quyn qun tr h thng). Mt s phin bn khng c ty chn ny. -n, --no-dereference mt tp tin bnh thng c xem l ch lin kt t mt th mc. -i, interactive vn to lin kt d tp tin ch b xa b. -s, --symbolic to cc lin kt tng trng. --target-directory=<tn-th-mc> xc nh th mc tn-th-mc l th mc c cha cc lin kt. -v, --verbose hin th tn cc tp tin trc khi to lin kt. --help hin th trang tr gip v thot. V d, mun to lin kt n tp tin /usr/doc/g77/DOC vi tn tp tin lin kt l g77manual.txt, th g lnh nh sau: # ln -s /usr/doc/g77/DOC g77manual.txt Khi chy chng trnh mc, cc tp tin lin kt c tn bt u bi du "@", v khi vt sng di chuyn n tp tin lin kt th tn tp tin c lin kt n s hin th bn di. 3.2. Quyn truy nhp th mc v tp tin 3.2.1. Quyn truy nhp Mi tp tin v th mc trong Linux u c mt ch s hu v mt nhm s hu, cng nh mt tp hp cc quyn truy nhp. Cho php thay i cc quyn truy nhp v quyn s hu tp tin v th mc nhm cung cp truy nhp nhiu hn hay t hn. Thng tin v mt tp tin ph bin c dng sau (c hin ra theo lnh hin danh sch tp tin ls -l): Trong , dy 10 k t u tin m t kiu tp tin v quyn truy nhp i vi tp tin . Theo mc nh, ngi dng to mt tp tin chnh l ngi ch (s hu) ca tp tin v l ngi c quyn s hu n. Ngi ch ca tp tin c c quyn thay i quyn truy nhp hay quyn s hu i vi tp tin . Tt nhin, mt khi chuyn quyn s hu ca mnh cho ngi dng khc th ngi ch c khng c php chuyn quyn s hu v quyn truy nhp c na. Tp hp mt chui c 10 k t gii thiu trn y c chia ra lm 4 phn: kiu tp 46

Linux-VN, cc lnh c bn

tin, cc quyn truy nhp n tp tin ca ch s hu, ca nhm s hu v ngi dng khc. C mt s kiu tp tin trong Linux. K t u tin trong tp hp 10 k t m t kiu tp tin v quyn truy nhp s cho bit tp tin thuc kiu no (ch ci c gi l ch ci biu din). Bng di y s lit k cc kiu tp tin trong Linux: Ch ci biu din d b c l p s Kiu tp tin Th mc (directory) Tp tin kiu khi (block-type special file) Tp tin kiu k t (character-type special file) Lin kt tng trng (symbolic link) Tp tin ng ng (pipe) Socket Tp tin bnh thng (regular file)

Chn k t tip theo trong chui quyn truy nhp c chia ra lm 3 nhm tng ng vi quyn truy nhp ca ngi s hu, nhm s hu v ngi dng khc. V d, 10 k t u tin trong dng v d ngay trc y s c phn tch thnh: d rwx r-x r-

Kiu tp tin: th mc

Quyn ca ngi ch

Quyn ca nhm

Quyn ngi khc

ca dng

hiu c chnh xc quyn truy nhp c ngha nh th no i vi h thng my tnh, phi nh rng Linux xem mi th u l tp tin. Nu ci t mt ng dng, n cng s c xem nh mi chng trnh khc, tr mt iu: h thng nhn bit rng mt ng dng l mt chng trnh kh thi, tc l n c th chy c. Mt bc th gi cho m l mt dng tp tin vn bn bnh thng, nhng nu thng bo cho h thng bit l mt chng trnh kh thi, h thng s c chy chng trnh (v tt nhin l li). C ba loi quyn truy nhp chnh i vi th mc/tp tin, l: c (read - r), ghi (write w) v thc hin (execute - x). Quyn c cho php ngi dng c th xem ni dung ca tp tin vi rt nhiu chng trnh khc nhau, nhng h s khng th thay i, sa cha hoc xa bt k thng tin no trong . Tuy nhin, h c th sao chp tp tin thnh tp tin ca h v sa cha tp tin bn sao.

47

Linux-VN, cc lnh c bn

drwxr-xr-x

12 root

root

4096

Oct 23 2000

LinuxVN.com

Tp hp S lin Ngi quyn truy kt n ch tp nhp tp tin tin (th mc)

Nhm ch tp tin

Kch thc Ngy gi Tn tp tin to tp tp tin tin (byte)

Quyn ghi l quyn truy nhp tip theo. Ngi s dng vi quyn ghi khi truy nhp vo tp tin c th thm thng tin vo tp tin. Nu c quyn ghi v quyn c i vi mt tp tin, c th son tho li tp tin - quyn c cho php xem ni dung, v quyn ghi cho php thay i ni dung tp tin. Nu ch c quyn ghi, s thm c thng tin vo tp tin, nhng li khng th xem c ni dung ca tp tin. Loi quyn truy nhp th ba l quyn thc hin, quyn ny cho php ngi dng c th chy c tp tin, nu l mt chng trnh kh thi. Quyn thc hin c lp vi cc quyn truy nhp khc, v th hon ton c th c mt chng trnh vi quyn c v quyn thc hin, nhng khng c quyn ghi. Cng c trng hp mt chng trnh ch c quyn thc hin, c ngha l ngi dng c th chy ng dng, nhng h khng th xem c cch n lm vic hay sao chp n. Bng di y gii thiu cch k hiu ca cc quyn truy nhp: Quyn truy nhp --r-r-x rwrwx ngha Khng cho php quyn truy nhp no Ch c quyn c Quyn c v thc hin (cho chng trnh v shell script) Quyn c v ghi Cho php tt c cc quyn truy nhp (cho chng trnh) Tuy nhin, i vi th mc th ch c ba loi k hiu ca cc quyn truy nhp l: ---, r-x v rwx, v ni dung ca th mc l danh sch ca cc tp tin v cc th mc c bn trong th mc . Quyn c mt th mc l c xem ni dung ca th mc v quyn thc hin i vi mt th mc l c xem ni dung ca cc tp tin v th mc con c trong th mc. Nh vy, vi v d ang c xem xt, chng ta nhn c y l mt th mc v quyn truy nhp n c gii thch nh sau:

48

Linux-VN, cc lnh c bn

d rwx r-x r-x

Kiu tp tin: th mc

Quyn ca ngi ch: c, ghi, thc hin

Quyn ca nhm ch: c, thc hin (khng

Quyn ngi dng khc: c, thc hin (khng ghi)

Gii thch: S hn ch trng hp v quyn truy nhp th mc c gii thch theo cc lp lun nh sau: Hy hnh dung, gi s ch c quyn c trn th mc, khi s xem c c nhng tp tin hay th mc no trong th mc nhng li khng th xem c th ni dung ca mt tp tin hay th mc c trn th mc . Hoc gi s c quyn thc hin - quyn ny s cho php thao tc vi cc tp tin c trn th mc - nhng li khng c quyn c i vi mt th mc, vy th lm th no bit c trong th mc c nhng tp tin no. 3.2.2. Cc lnh c bn a. Thay i quyn s hu tp tin vi lnh chown thay i quyn s hu i vi mt tp tin, hy s dng lnh chown vi c php nh sau: chown [ty-chn]... [ch][.nhm] <tp-tin ...> Lnh ny cho php thay ch s hu tp tin. Nu ch c tham s v ch, th ngi dng ch s c quyn s hu tp tin v nhm s hu khng thay i. Nu theo sau tn ngi ch l du "." v tn ca mt nhm th nhm s nhm s hu tp tin. Nu ch c du "." v nhm m khng c tn ngi ch th ch c quyn s hu nhm ca tp tin thay i, lc ny, lnh chown c tc dng ging nh lnh chgrp (lnh chgrp c trnh by di y). Cc ty chn ca lnh chown: -c, --changes hin th dng thng bo ch vi cc tp tin m lnh lm thay i s hu (s thng bo hin ra c th t hn trng hp -v, -verbosr). -f, --silent, --quiet b qua hu ht cc thng bo li. -R, --recursive thc hin i quyn s hu i vi th mc v tp tin theo quy. 49

Linux-VN, cc lnh c bn

-v, --verbose hin th dng thng bo vi mi tp tin lin quan m chown tc ng ti (c hoc khng thay i s hu). --help a ra trang tr gip v thot. V d, th mc LinuxVN.com c thng tin v cc quyn truy nhp nh sau:
drwxr-xr-x 12 thu root 4096 Oct 23 2000 LinuxVN.com

Ngi s hu hin ti th mc LinuxVN.com l ngi dng thu. ngi dng lan l ch s hu th mc trn, hy g lnh: # chown lan LinuxVN.com Khi , nu dng lnh ls th thng tin v th mc LinuxVN.com s c dng:
drwxr-xr-x 12 lan root 4096 Oct 23 2000 LinuxVN.com

vi ngi s hu th mc by gi l ngi dng lan. Khi chuyn quyn s hu tp tin cho mt ngi khc, ngi ch c mt quyn s hu tp tin . b. Thay i quyn s hu nhm vi lnh chgrp Cc tp tin (v ngi dng) cn thuc vo cc nhm, y l phng thc truy nhp tp tin thun tin cho nhiu ngi dng nhng khng phi tt c ngi dng trn h thng. Khi ng nhp, mc nh s l thnh vin ca mt nhm c thit lp khi ngi dng cao cp root to ti khon ngi dng. Cho php mt ngi dng thuc nhiu nhm khc nhau, nhng mi ln ng nhp ch l thnh vin ca mt nhm. thay i quyn s hu nhm i vi mt hoc nhiu tp tin, hy s dng lnh chgrp vi c php nh sau: chgrp [ty-chn]... {nhm|--reference=nhmR} <tp-tin...> Lnh ny cho php thay thuc tnh nhm s hu ca tp tin theo tn nhm c ch ra trc tip theo tham s nhm hoc gin tip qua thuc tnh nhm ca tp tin c tn l nhmR. Cc ty chn ca lnh l (mt s tng t nh lnh chown): -c, --changes hin th dng thng bo ch vi cc tp tin m lnh lm thay i s hu (s thng bo hin ra c th t hn trng hp -v, -verbosr). -f, --silent, --quiet b qua hu ht cc thng bo li. -R, --recursive thc hin i quyn s hu i vi th mc v tp tin theo quy. 50

Linux-VN, cc lnh c bn

-v, --verbose hin th dng thng bo vi mi tp tin lin quan m chgrp tc ng ti (c hoc khng thay i s hu). --help hin th trang tr gip v thot Tham s --reference=nhmR cho thy cch gin tip thay nhm ch ca tp tin theo nhm ch ca mt tp tin khc (tn l nhmR) l cch thc c a chung hn. Tham s ny l xung khc vi tham s nhm ca lnh. c. Thay i quyn truy cp tp tin vi lnh chmod C php lnh chmod c ba dng: chmod [ty-chn]... <mod [,mod]...> <tp-tin...> chmod [ty-chn]... <mod-h-8> <tp-tin...> chmod [ty-chn]... --reference=nhmR <tp-tin...> Lnh chmod cho php xc lp quyn truy nhp theo kiu (mode) trn tp tin. Dng u tin l dng xc lp tng i, dng th hai l dng xc lp tuyt i v dng cui cng l dng gin tip ch dn theo quyn truy nhp ca tp tin nhmR. Cc ty chn ca lnh chmod c lit k nh di y v c ngha tng t cc tu chn tng ng ca cc lnh chown, chgrp: -c, --changes -f, --silent, --quiet -v, --verbose -R, --recursive --help v tham s --reference=RFILE cng ngha gin tip nh trong lnh chgrp. Gii thch v hai cch xc lp quyn truy nhp tp tin trong lnh chmod nh sau: xc lp tuyt i (dng h thng m s vit theo h c s 8 biu din cho cc quyn truy nhp) v xc lp tng i (dng cc ch ci biu din quyn truy nhp). Cch xc lp tng i Cch xc lp tng i l d nh theo ngha ca ni dung cc mod v ch nhng thay i thc s mi c biu din trong lnh. Ba hp sau y s gii thch cc ch ci biu din mod theo cch xc lp tng i.

51

Linux-VN, cc lnh c bn

Quyn truy cp
u=user (ngi s hu) g=group (nhm s hu) o=other (ngi khc) a=all (tt c ngi dng)

Thao tc thay i
+ (thm quyn) - (g b quyn) = (xc nhn quyn)

Kiu truy cp
r=read (quyn c) w=write (quyn ghi) x=execute (quyn thc hin)

C th kt hp cc mc t hp th nht v hp th ba vi mt mc t hp th hai to ra mt mod. V d, nu mun thm quyn ghi i vi tp tin test cho tt c ngi dng trong nhm s hu, hy chn g cho nhm s hu, + cho thm quyn truy nhp, v w cho quyn ghi. Lc lnh chmod s c dng sau: chmod g+w test Cch xc lp tng i trong lnh chmod gn ging nh mt menu c nhiu mc chn khc nhau, cho php kt hp c c s la chn theo yu cu. Nu quyt nh g b quyn c v thc hin trn tp tin test cho nhng ngi khng cng nhm, hy chn o cho ngi dng khc, - g b quyn truy nhp, v r,x cho quyn c v thc hin. Lnh chmod s l: chmod o-rx test Cch xc lp tuyt i i vi ngi dng hiu s b v biu din s trong h c s 8 th cch xc lp tuyt i li c a chung hn. Phn 3.2.1. cho bit biu din quyn truy nhp tp tin thng qua dy gm 9 v tr di dng rwxrwxrwx, trong tng cm 3 v tr theo th t tng ng vi: ch s hu, nhm s hu v ngi dng khc. Nh vy thuc tnh quyn truy nhp ca mt tp tin c th biu din thnh 9 bt nh phn trong bt c gi tr 1 th quyn c xc nh, ngc li th quyn b tho b. Nh vy, ch s hu tng ng vi 3 bt u tin, nhm s hu tng ng vi 3 bt gia, ngi dng khc tng ng vi 3 bt cui. Mi cm 3 bt nh vy cho mt ch s h 8 (nhn gi tr t 0 n 7) v thuc tnh quyn truy nhp tng ng vi 3 ch s h 8. V d, cp 3 s h 8 l 755 tng ng vi dng 9 bt 111101101 vi 111 cho ch s hu, 101 cho nhm s hu, 101 cho ngi dng khc. V d lnh: chmod 753 memo1 t thuc tnh quyn truy nhp i vi tp tin memo1 l rwxr-xr-x. d xc lp 3 ch s h 8 p dng cch tnh nh sau:

52

Linux-VN, cc lnh c bn

Quyn Ch c Ch ghi Ch thc hin Khng c quyn no

Ch s h 8 4 2 1 0

Quyn Ch c v ghi Ch c v thc hin Ch ghi v thc hin c, ghi v thc hin

Ch s h 8 6 5 3 7

d. ng nhp vo mt nhm ngi dng mi vi lnh newgrp Linux cho php mt ngi dng c th l thnh vin ca mt hoc nhiu nhm ngi dng khc nhau, trong c mt nhm c gi l nhm khi ng. iu ny c m bo khi thc hin lnh adduser hoc usersdd. Tuy nhin, ti mt thi im, mt ngi dng thuc vo ch mt nhm. Khi mt ngi dng ng nhp, h thng ngm nh ngi dng l thnh vin ca nhm khi ng, v c quyn truy nhp i vi nhng tp tin thuc quyn s hu ca nhm khi ng . Nu mun s dng quyn s hu theo cc nhm khc i vi nhng tp tin th ngi dng phi chuyn i thnh thnh vin ca mt nhm nhng nhm c gn vi ngi dng. Lnh newgr cho php ngi dng chuyn sang nhm ngi dng khc gn vi mnh vi c php: newgrp [nhm] trong nhm l mt tn nhm ngi dng tn ti trong h thng. V d, mt ngi dng l thnh vin ca hai nhm user v installer, vi user l nhm khi ng. Khi ng nhp, ngi dng c t cch l thnh vin ca nhm user. Khi mong mun s dng mt s cc chng trnh thuc quyn s hu ca nhm installer, ngi dng cn g lnh sau: # newgrp installer Nu ngi dng ni trn c chuyn vo mt nhm m ngi dng khng l thnh vin, chng hn dng lnh: # newgrp hot2 th Linux s a ra mt khuyn co thn thin nh sau:
newgrp: Sorry

3.3. Thao tc vi th mc Nh c gii thiu trn y (trong mc 3.1.1.), Linux t chc h thng tp tin theo cch s dng cc th mc. Mc ny bt u bng vic gii thiu mt s th mc chnh v tc dng ca chng trong h thng Linux. Sau mt s lnh thao tc vi th mc c bn nht c trnh by. 3.3.1. Mt s th mc c bit * Th mc gc / y l th mc gc cha ng tt c cc th mc con c trong h thng. 53

Linux-VN, cc lnh c bn

* Th mc /root Nh c gii thiu th mc /root c th c coi l "th mc ring" ca siu ngi dng. Th mc ny c s dng lu tr cc tp tin tm thi, nhn Linux v nh khi ng, cc tp tin nh phn quan trng (nhng tp tin c s dng n trc khi Linux c th gn kt n phn vng /user), cc tp tin ng nhp quan trng, b m in cho vic in n, hay vng lu tm cho vic nhn v gi email. N cng c s dng cho cc vng trng tm thi khi thc hin cc thao tc quan trng, v d nh khi xy dng (build) mt gi RPM t cc tp tin RPM ngun. * Th mc /bin Trong Linux, chng trnh c coi l kh thi nu n c th thc hin c. Khi mt chng trnh c bin dch, n s c dng l tp tin nh phn. Nh vy, chng trnh ng dng trong Linux l mt tp tin nh phn kh thi. Chnh v l , nhng nh pht trin Linux quyt nh phi t chc mt th mc "binaries" lu tr cc chng trnh kh thi c trn h thng, chnh l th mc /bin. Ban u, th mc /bin (bin l vit tt ca t binary) l ni lu tr cc tp tin nh phn kh thi. Nhng theo thi gian, ngy cng c nhiu hn cc tp tin kh thi c trong Linux, do , c thm cc th mc nh /sbin, /usr/bin c s dng lu tr cc tp tin . * Th mc /dev Mt phn khng th thiu trong bt k my tnh no l cc trnh iu khin thit b. Khng c chng, s khng th c c bt k thng tin no trn mn hnh ca (cc thng tin c c do trnh iu khin thit b hin th a ra). Cng khng th nhp c thng tin (nhng thng tin do trnh iu khin thit b bn phm c v chuyn ti h thng), v cng khng th s dng a mm ca (c qun l bi trnh iu khin a mm). Tt c cc trnh iu khin thit b u c lu tr trong th mc /dev. * Th mc /etc Qun tr h thng trong Linux khng phi l n gin, chng hn nh vic qun l ti khon ngi dng, vn bo mt, trnh iu khin thit b, cu hnh phn cng, v.v.. gim bt phc tp, th mc /etc c thit k lu tr tt c cc thng tin hay cc tp tin cu hnh h thng. * Th mc /lib Linux c mt trung tm lu tr cc th vin hm v th tc, l th mc /lib. * Th mc /lost+found Mt tp tin c khi phc sau khi c bt k mt vn hoc gp mt li v ghi a trn h thng u c lu vo th mc ny. * Th mc /mnt Th mc /mnt l ni kt ni cc thit b (v d a cng, a mm...) vo h thng tp tin chnh nh lnh mount. Thng thng cc th mc con ca /mnt chnh l gc ca cc h thng tp tin c kt ni: /mnt/floppy: a mm, /mnt/hda1: vng u tin ca a 54

Linux-VN, cc lnh c bn

cng th nht (hda), /mnt/hdb3: vng th ba ca a cng th 2 (hdb) ... * Th mc /tmp Th mc /tmp c rt nhiu chng trnh trong Linux s dng nh mt ni lu tr cc tp tin tm thi. V d, nu ang son tho mt tp tin, chng trnh s to ra mt tp tin l bn sao tm thi (bn nhp) ca tp tin v lu vo trong th mc /tmp. Vic son tho thc hin trc tip trn tp tin tm thi ny v sau khi son tho xong, tp tin tm thi s c ghi ln tp tin gc. Cch thc nh vy bo m s an ton i vi tp tin cn son tho. * Th mc /usr Thng thng th th mc /usr l trung tm lu tr tt c cc lnh hng n ngi dng (user-related commands). Tuy nhin, ngy nay tht kh xc nh trong th mc ny c nhng th g, bi v hu ht cc tp tin nh phn cn cho Linux u c lu tr y, trong ng ch l th mc con /usr/src bao gm cc th mc con cha cc chng trnh ngun ca nhn Linux. * Th mc /home Th mc ny cha cc th mc c nhn ca ngi dng: mi ngi dng tng ng vi mt th mc con y, tn ngi dng c ly lm tn ca th mc con. * Th mc /var Th mc /var c s dng lu tr cc tp tin cha cc thng tin lun lun thay i, bao gm b m in, vng lu tm thi cho vic nhn v gi th (mail), cc kha tin trnh, v.v.. * Th mc /boot L th mc cha nhn ca h thng (Linux-*.*.), System.map (tp tin nh x n cc driver np cc h thng tp tin khc), nh (image) ca h thng tp tin dng cho initrd (ramdisk), trnh iu khin cho cc thit b RAID (mt thit b gm mt mng cc a cng tng tc v an ton khi ghi d liu), cc bn sao lu boot record ca cc phn vng a khc. Th mc ny cho php khi ng v np li bt k trnh iu khin no c yu cu c cc h thng tp tin khc. * Th mc /proc y l th mc dnh cho nhn (kernel) ca h iu hnh v thc t y l mt h thng tp tin c lp do nhn khi to. * Th mc /misc v th mc /opt Cho php lu tr mi i tng vo hai th mc ny. * Th mc /sbin Th mc lu gi cc tp tin h thng thng t ng chy. 3.3.2. Cc lnh c bn v th mc * Xc nh th mc hin thi vi lnh pwd 55

Linux-VN, cc lnh c bn

C php lnh: pwd Lnh ny cho bit hin ngi dng ang trong th mc no v hin ra theo dng mt ng dn tuyt i. V d, g lnh pwd ti du nhc lnh sau khi ngi dng lan va ng nhp th mn hnh hin th nh sau: # pwd
/home/lan

# * Xem thng tin v th mc vi lnh ls S dng lnh ls v mt s cc ty chn ca n l c th bit c mi thng tin v mt th mc. C php lnh nh sau: ls [ty-chn]... [tp-tin]... Lnh ny s a ra danh sch cc tp tin lin quan n tham s tp-tin trong lnh. Trng hp ph bin tham s tp-tin l mt th mc, tuy nhin trong mt s trng hp khc, tham s tp-tin xc nh nhm (khi s dng cc m t nhm *, ? v cp [ v ]); nu khng c tham s tp-tin, mc nh danh sch cc tp tin c trong th mc hin thi s c hin th. Cc ty chn ca lnh l: -a lit k tt c cc tp tin, bao gm c tp tin n. -l a ra thng tin y nht v cc tp tin v th mc. -s ch ra kch thc ca tp tin, tnh theo khi (1 khi = 1204 byte). -F xc nh kiu tp tin (/ = th mc, * = chng trnh kh thi). -m lit k cc tp tin c ngn cch nhau bi du ",". -C a ra danh sch cc tp tin v th mc theo dng ct (hai th mc gn nhau c xp vo mt ct). -1 hin th mi tp tin hoc th mc trn mt dng. 56

Linux-VN, cc lnh c bn

-t sp xp cc tp tin v th mc trong danh sch theo th t v thi gian c sa i gn y nht. -x a ra danh sch cc tp tin v th mc theo dng ct (hai th mc gn nhau c xp trn hai dng u ca hai ct k nhau). -r sp xp danh sch hin th theo th t ngc li. -R lit k ln lt cc th mc v ni dung ca cc th mc. V d, lnh
# ls -l

s hin th danh sch y nht v cc tp tin v th mc c trong th mc hin thi.


total 108 drwxr-xr-x 12 thu root 4096 Oct 23 2000 LinuxVN.com drwxr-xr-x 2 root root 4096 Oct 31 2000 bin drwxr-xr-x 2 root root 4096 Dec 11 16:54 boot drwxr-xr-x 7 root root 36864 Dec 11 16:54 dev drwxr-xr-x 43 root root 4096 Dec 11 16:55 etc drwxr-xr-x 5 root root 4096 Dec 11 16:57 home drwxr-xr-x 4 root root 4096 Oct 31 2000 lib drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x dr-xr-xr-x drwxr-xr-x drwxr-xr-x 2 root root 16384 Oct 31 2000 lost+found 2 root root 0 Dec 11 16:54 misc 5 root root 4096 Oct 31 2000 mnt 2 root root 4096 Aug 23 12:03 opt 56 root root 0 Dec 11 11:54 proc

drwxr-x--- 12 root root 4096 Dec 11 16:55 root 3 root root 4096 Oct 31 2000 sbin 3 root root 4096 Oct 31 2000 tftpboot

drwxrwxrwx 8 root root 4096 Dec 11 16:58 tmp drwxr-xr-x 22 root root 4096 Oct 31 2000 usr drwxr-xr-x 22 root root 4096 Oct 31 2000 var

Dng u tin "total 108" cho bit tng s khi (1024 byte) trn a lu tr cc tp tin trong danh sch (14*4+36+16=108). Mi dng tip theo trnh by thng tin v mi tp tin hay th mc con. Cc thng tin ny 57

Linux-VN, cc lnh c bn

c gii thiu trc y. Chng hn, drwxr-xr-x 22 root root 4096 Oct 31 2000 var

Kiu tp tin S lin kt Ngi ch tp v quyn n tp tin truy nhp tin (th mc)

Nhm ch tp tin

Kch thc Ngy gi Tn tp tin to tp tp tin tin (byte)

ngha ca mi trng trn y c gii thch trong mc 3.2.1. Khi g lnh: # ls [is]* cho danh sch cc tp tin v th mc con c tn bt u bng hoc ch ci i hoc ch ci s c trong th mc hin thi:
info-dir shadow sysctl.conf initlog.conf shadowsyslog.conf inittab shells services smb.conf

* Lnh to th mc mkdir Lnh mkdir to mt th mc vi c php nh sau: mkdir [ty-chn] <th-mc> Lnh ny cho php to mt th mc mi nu th mc cha thc s tn ti. to mt th mc, cn c t tn v v tr ca n trn h thng tp tin (v tr mc nh l th mc hin thi). Nu th mc tn ti, h thng s thng bo cho bit. Cc ty chn nh sau: -m, --mode=Mod thit lp quyn truy nhp Mod nh trong lnh chmod nhng khng cho quyn rwxrwxrwx. -p, --parents to cc th mc cn thit m khng thng bo li khi n tn ti. --verbose hin th cc thng bo cho mi th mc c to. --help a ra trang tr gip v thot. 58

Linux-VN, cc lnh c bn

V d, nu mun to th mc test trong th mc home, hy g lnh sau: # mkdir /home/test * Lnh xa b th mc rmdir Nh bit, lnh mkdir to ra mt th mc mi, v v i ngu th lnh rmdir c dng xa b mt th mc. C php lnh: rmdir [ty-chn]... <th-mc> C th xa b bt k th mc no nu c quyn . Lu rng, th mc ch b xa khi n "rng", tc l khng tn ti tp tin hay th mc con no trong . Khng c cch g khi phc li cc th mc b xa, v th hy suy ngh cn thn trc khi quyt nh xa mt th mc. Cc ty chn ca lnh: --ignore-fail-on-non-empty b qua cc li nu xa mt th mc khng rng. -p, --parents xa b mt th mc, sau ln lt xa b tip cc th mc c trn ng dn cha th mc va xa. V d, dng lnh rmdir -p /a/b/c s tng ng vi ba dng lnh rmdir /a/b/c, rmdir /a/b, rmdir /a (vi iu kin cc th mc l rng). --verbose a ra thng bo khi xa mt th mc. --help hin th trang tr gip v thot. V d: # rmdir -p /test/test1/test2
rmdir: /: No such file or directory

# Dng lnh trn s ln lt xa ba th mc test2, test1, test v hin th thng bo trn mn hnh kt qu ca lnh. * Lnh i tn th mc mv C php lnh: mv <tn-c> <tn-mi> Lnh ny cho php i tn mt th mc t tn-c thnh tn-mi. V d, lnh 59

Linux-VN, cc lnh c bn

# mv LinuxVN.com LinuxVN s i tn th mc LinuxVN.com thnh LinuxVN. Nu s dng lnh mv i tn mt th mc vi mt ci tn c t cho mt tp tin th lnh s gp li. Nu tn mi trng vi tn mt th mc ang tn ti th ni dung ca th mc c i tn s ghi ln ni dung ca th mc trng tn. 3.4. Cc lnh lm vic vi tp tin 3.4.1. Cc kiu tp tin c trong Linux Mc 3.1.2. trnh by s lc v kiu ca cc tp tin. Nh c gii thiu, c rt nhiu tp tin khc nhau trong Linux, nhng bao gi cng tn ti mt s kiu tp tin cn thit cho h iu hnh v ngi dng, di y gii thiu li mt s cc kiu tp tin c bn. Tp tin ngi dng (user data file): l cc tp tin to ra do hot ng ca ngi dng khi kch hot cc chng trnh ng dng tng ng. V d nh cc tp tin thun vn bn, cc tp tin c s d liu hay cc tp tin bng tnh. Tp tin h thng (system data file): l cc tp tin lu tr thng tin ca h thng nh: cu hnh cho khi ng, ti khon ca ngi dng, thng tin thit b ... thng c ct trong cc tp dng vn bn ngi dng c th can thip, sa i theo mnh. Tp tin thc hin (executable file): l cc tp tin cha m lnh hay ch th cho my tnh thc hin. Tp tin thc hin lu tr di dng m my m ta kh c th tm hiu c ngha ca n, nhng tn ti mt s cng c "hiu" c cc tp tin . Khi dng trnh ng dng mc (Midnight Commander, chng 8), tp tin thc hin c bt u bi du (*) v thng c mu xanh lc. Th mc hay cn gi l tp tin bao hm (directory): l tp tin bao hm cc tp tin khc v c cu to hon ton tng t nh tp tin thng thng khc nn c th gi l tp tin. Trong mc, tp tin bao hm thng c mu trng v bt u bng du ng (~) hoc du chia (/). V d: /, /home, /bin, /usr, /usr/man, /dev ... Tp tin thit b (device file): l tp tin m t thit b, dng nh l nh danh ch ra thit b cn thao tc. Theo quy c, tp tin thit b c lu tr trong th mc /dev. Cc tp tin thit b hay gp trong th mc ny l tty (teletype - thit b truyn thng), ttyS (teletype serial - thit b truyn thng ni tip), fd0, fd1, ... (floppy disk- thit b a mm), hda1, hda2, ... hdb1, hdb2, ... (hardisk - thit b cng theo chun IDE; a, b,... nh s a vt l; 1, 2, 3... nh s logic). Trong mc, tp tin thit b c mu tm v bt u bng du cng (+). Tp tin lin kt (linked file): l nhng tp tin cha tham chiu n cc tp tin khc trong h thng tp tin ca Linux. Tham chiu ny cho php ngi dng tm nhanh ti tp tin thay v ti v tr nguyn thy ca n. Hn na, ngi ta c th gn vo cc thng tin ph tr lm cho tp tin ny c tnh nng tri hn so vi tnh nng nguyn thy ca n. Ta thy loi tp tin ny ging nh khi nim shortcut 60

Linux-VN, cc lnh c bn

trong MS-Windows98. Khng ging mt s h iu hnh khc (nh MS-DOS chng hn), Linux qun l thi gian ca tp tin qua cc thng s thi gian truy nhp (accesed time), thi gian kin to (created time) v thi gian sa i (modified time). 3.4.2. Cc lnh to tp tin Trong Linux c rt nhiu cch to tp tin, sau y l cc cch hay c dng. * To tp tin vi lnh touch Lnh touch c nhiu chc nng, trong mt chc nng l gip to tp tin mi trn h thng: touch rt hu ch cho vic t chc mt tp hp cc tp tin mi. C php lnh: touch <tp-tin> Thc cht lnh ny c tc dng dng cp nht thi gian truy nhp v sa cha ln cui ca mt tp tin. V l do ny, cc tp tin c to bng lnh touch u c sp xp theo thi gian sa i. Nu s dng lnh touch i vi mt tp tin cha tn ti, chng trnh s to ra tp tin . S dng bt k trnh son tho no son tho tp tin mi. V d, dng lnh touch to tp tin newfile:
# touch newfile

* To tp tin bng cch i hng u ra ca lnh (>) Cch ny rt hu ch nu mun lu kt qu ca mt lnh thc hin. gi kt qu ca mt lnh vo mt tp tin, dng du ">" theo ngha chuyn hng li ra chun. V d, a kt qu ca lnh ls -l /bin vo tp tin /home/thu/lenhls bng cch g:
# ls -l /bin > /home/thu/lenhls

Linux t ng to nu tp tin lenhls cha c, trong trng hp ngc li, ni dung tp tin c s b th ch bi kt qu ca lnh. # ls -l /bin >/home/thu/lenhls Nu mun b sung kt qu vo cui tp tin thay v thay th ni dung tp tin, hy s dng du ">>". V d, lnh # ls -l /bin >> /home/thu/lenhls a cc dng danh sch tp tin trong th mc /bin vo cui ni dung ca tp tin /home/thu/lenhls. * To tp tin vi lnh cat Lnh cat tuy n gin nhng rt hu dng trong Linux. Chng ta c th s dng lnh ny ly thng tin t u vo (bn phm...) ri kt xut ra tp tin hoc cc ngun khc (mn hnh ...), hay xem ni dung ca mt tp tin ... Phn ny trnh by tc dng ca 61

Linux-VN, cc lnh c bn

lnh cat i vi vic to tp tin. C php lnh: cat > <tp-tin> Theo ngm nh, lnh ny cho php ly thng tin u vo t bn phm ri xut ra mn hnh. Son tho ni dung ca mt tp tin bng lnh cat tc l i hng u ra ca lnh t mn hnh vo mt tp tin. Ngi dng g ni dung ca tp tin ngay ti du nhc mn hnh v g CTRL+d kt thc vic son tho. Nhc im ca cch to tp tin ny l n khng cho php sa li, v d nu mun sa mt li chnh t trn mt dng, ch c cch l xa n v tr ca li v g li ni dung va b xa. V d: to tp tin newfile trong th mc /home/vd bng lnh cat. # cat > /home/vd/newfile
This is a example of cat command

# Sau khi son tho xong, g Enter v CTRL+d tr v du nhc lnh, nu khng g Enter th phi g CTRL+d hai ln. C th s dng lun lnh cat xem ni dung ca tp tin va son tho: # cat /home/vd/newfile
This is a example of cat command

# 3.4.3. Cc lnh thao tc trn tp tin * Sao chp tp tin vi lnh cp Lnh cp c hai dng nh sau: cp [ty-chn]... <tp-tin-ngun> ... <tp-tin-ch> cp [ty-chn]... --target-directory=<th-mc> <tp-tinngun>... Lnh ny cho php sao tp-tin-ngun thnh tp-tin-ch hoc sao chp t nhiu tp-tinngun vo mt th mc ch (tham s <tp-tin-ch> hay <th-mc>). Dng th hai l mt cch vit khc i th t hai tham s v tr. Cc ty chn ca lnh: -a, --archive ging nh -dpR (t hp ba tham s -d, -p, -R, nh di y). -b, --backup[=CONTROL] to tp tin lu cho mi tp tin ch nu nh n ang tn ti. -d, --no-dereference 62

Linux-VN, cc lnh c bn

duy tr cc lin kt. -f, --force ghi tp tin ch ang tn ti m khng nhc nh. -i, --interactive c thng bo nhc nh trc khi ghi . -l, --link ch to lin kt gia tp-tin-ch t tp-tin-ngun m khng sao chp. -p, --preserve duy tr cc thuc tnh ca tp-tin-ngun sang tp-tin-ch. -r cho php sao chp mt cch quy tp tin thng thng. -R cho php sao chp mt cch quy th mc. -s, --symbolic-link to lin kt tng trng thay cho vic sao chp cc tp tin. -S, --suffix=<hu-t> b qua cc hu t thng thng (hoc c ch ra). -u, --update ch sao chp khi tp tin ngun mi hn tp tin ch hoc khi tp tin ch cha c. -v, --verbose a ra thng bo v qu trnh sao chp. --help hin th trang tr gip v thot. Tp tin ch c to ra c cng kch thc v cc quyn truy nhp nh tp tin ngun, tuy nhin tp tin ch c thi gian to lp l thi im thc hin lnh nn cc thuc tnh thi gian s khc. V d, lnh # cp /home/ftp/vd /home/test/vd1 Nu v tr ch, m t y tn tp tin ch th ni dung tp tin ngun s c sao chp sang tp tin ch. Trong trng hp ch a ra v tr tp tin ch c t trong th mc no th tn ca tp tin ngun s l tn ca tp tin ch. # cp /home/ftp/vd /home/test/ 63

Linux-VN, cc lnh c bn

Trong v d ny, tn tp tin ch s l vd ngha l to mt tp tin mi /home/test/vd. Nu s dng lnh ny sao mt th mc, s c mt thng bo c a ra cho bit ngun l mt th mc v v vy khng th dng lnh cp sao chp. # cp . newdir
cp: .: omitting directory

V d v vic lnh cp cho php sao nhiu tp tin cng mt lc vo mt th mc. # cp vd vd1 newdir # pwd
/newdir

# ls -l total 8
-rw-r--r-- 1 root ftp 15 Nov 14 11:00 vd -rw-r--r-- 1 root ftp 12 Nov 14 11:00 vd1

Lu : i vi nhiu lnh lm vic vi tp tin, khi g lnh c th s dng k hiu m t nhm xc nh mt nhm tp tin lm cho tng hiu lc ca cc lnh . V d, lnh: # cp * bak thc hin vic sao chp mi tp tin c trong th mc hin thi sang th mc con ca n c tn l bak. Dng lnh # cp /usr/src/linux-2.2.14/include/linux/*.h bak cho php sao chp mi tp tin vi tn c hai k hiu cui cng l ".h" sang th mc con bak. Chnh v l do ni trn, d trong nhiu lnh tuy khng ni n vic s dng k hiu m t nhm tp tin nhng chng ta c th p dng chng nu iu khng tri vi suy lun thng thng. Do nhng tnh hung nh th l qu phong ph cho nn khng th gii thiu ht trong cun sch. Chng ta ch mt gii php l mi khi s dng mt lnh no , nn th nghim cch thc hiu qu ny. * i tn tp tin vi lnh mv C php lnh i tn tp tin: mv <tn-c> <tn-mi> Lnh ny cho php i tn tp tin t tn c thnh tn mi. V d: 64

Linux-VN, cc lnh c bn

# mv vd newfile Lnh ny s i tn tp tin vd thnh newfile. Trong trng hp tp tin newfile tn ti, ni dung ca tp tin vd s ghi ln ni dung ca tp tin newfile. * Xa tp tin vi lnh rm Lnh rm l lnh rt "nguy him" v trong Linux khng c lnh khi phc li nhng g xa, v th hy cn trng khi s dng lnh ny. C php lnh nh sau: rm [ty-chn]... <tp-tin> ... Lnh rm cho php xa b mt tp tin hoc nhiu tp tin. Cc ty chn ca lnh: -d, --directory loi b lin kt ca th mc, k c th mc khng rng. Ch c siu ngi dng mi c php dng ty chn ny. -f, --force b qua cc tp tin (xc nh qua tham s tp-tin) khng tn ti m khng cn nhc nh. -i, --interactive nhc nh trc khi xa b mt tp tin. -r, -R, --recursive xa b ni dung ca th mc mt cch quy. -v, --verbose a ra cc thng bo v qu trnh xa tp tin. --help hin th trang tr gip v thot. Lnh rm cho php xa nhiu tp tin cng mt lc bng cch ch ra tn ca cc tp tin cn xa trong dng lnh (hoc dng k kiu m t nhm). V d, dng lnh ls xem danh sch cc tp tin trong th mc hin thi: # ls

65

Linux-VN, cc lnh c bn

ld-Linux.so.1 ld-Linux.so.1.9.5 ld-Linux.so.2 ld.so ld.so.1.9.5 libBrokenLocale2.1.3.so libBrokenLocale.so.1 libNoVersion-2.1.3.so vd2.txt S dng lnh xa tp tin vd2.txt sau y: # rm vd2.txt telex.o

libnss_dns-2.1.3.so libnss_dns.so.1 libnss_dns.so.2 libnss_files-2.1.3.so libnss_files.so.1 libnss_files.so.2 libnss_hesiod-1.3.so telex.o

v sau dng lnh ls xem li danh sch tp tin: # ls ld-Linux.so.1 ld-Linux.so.1.9.5 ld-Linux.so.2 ld.so ld.so.1.9.5 libBrokenLocale2.1.3.so libBrokenLocale.so.1 libNoVersion-2.1.3.so Dng lnh # rm bak/*.h xa mi tp tin vi tn c hai k hiu cui cng l ".h" trong th mc con bak. * Lnh m t v dng trong tp tin wc Linux c lnh wc dng m s k t, s t, hay s dng trong mt tp tin. C php lnh nh sau: wc [ty-chn]... [tp-tin]... Lnh hin ra s lng dng, s lng t, s lng k t c trong mi tp tin, v mt dng 66 libnss_dns-2.1.3.so libnss_dns.so.1 libnss_dns.so.2 libnss_files-2.1.3.so libnss_files.so.1 libnss_files.so.2 libnss_hesiod-1.3.so telex.o

Linux-VN, cc lnh c bn

tnh tng nu c nhiu hn mt tp tin c ch ra. Nu khng c ty chn no th mc nh a ra c s dng, s t v s k t. Ngm nh khi khng c tn tp tin trong lnh th s c v m trn thit b vo chun. Cc tu chn: -c, --byte, --chars a ra s k t trong tp tin. -l, --lines a ra s dng trong tp tin. -L, --max-line-length a ra chiu di ca dng di nht trong tp tin. -w, --words a ra s t trong tp tin. --help hin th trang tr gip v thot. V d, sau khi g lnh: # wc /home/lan/mau/mau1 xut hin dng thng bo:
11 64 293 /home/lan/mau/mau1

Dng thng bo trn cho bit tp tin mau1 c 293 k t, c 64 t v c 11 dng. V d sau khi g lnh: # wc ngi dng g tip cc dng nh sau:
This is a example of wc command without [namefile]

sau ngi dng g cp phm Ctrl-d kt thc th thy dng thng bo hin ra: 2 9 49 Khi g lnh wc m khng c mt tham s no, mc nh s son tho trc tip ni dung trn thit b vo chun. Dng CTRL+d kt thc vic son tho, kt qu s hin th ln mn hnh nh v d trn. # wc /home/lan/vd/vdcalj /home/lan/vd/vdwc
8 24 32 41 209 250 192 1473 1665 /home/lan/vd/vdcalj /home/lan/vd/vdwc total

Lnh trn m s k t, s t, s dng trn mi tp tin c ch ra, v dng cui cng 67

Linux-VN, cc lnh c bn

hin th tng s dng, s t, s k t m c. Bng cch kt hp lnh wc vi mt s lnh khc, c th c nhiu cch bit c nhng thng tin cn thit. Chng hn: kt hp vi lnh ls xc nh s tp tin c trong mt th mc: # ls | wc -l
37

dng lnh trn cho bit trong th mc ch ca c 36 tp tin (do dng u tin kt qu thng bo ca lnh ls khng xc nh mt tp tin). kt hp vi lnh cat bit s ti khon c nhn c trn my ca ngi dng: # cat /etc/passwd | wc -l
324

* Lnh loi b nhng dng khng quan trng uniq Trong mt s trng hp khi xem ni dung mt tp tin, chng ta thy c mt s cc thng tin b trng lp, v d cc dng trng hoc cc dng cha ni dung ging nhau. ng thi lm gn v thu nh kch thc ca tp tin, c th s dng lnh uniq lit k ra ni dung tp tin sau khi loi b cc dng trng lp. C php lnh: uniq [ty-chn]... [input] [output] Lnh uniq s loi b cc dng trng lp k nhau t input (thit b vo chun) v ch gi li mt dng duy nht trong s cc dng trng lp ri a ra output (thit b ra chun). Cc tu chn ca lnh: -c, --count m v hin th s ln xut hin ca cc dng trong tp tin. -d hin th ln mn hnh dng b trng lp. -u hin th ni dung tp tin sau khi xa b ton b cc dng b trng lp khng gi li mt dng no. -i hin th ni dung tp tin sau khi xa b cc dng trng lp v ch gi li duy nht mt dng c ni dung b trng lp. -D hin th tt c cc dng trng lp trn mn hnh. Nu s dng lnh uniq trn mt tp tin khng c cc dng trng lp th lnh khng c tc dng. 68

Linux-VN, cc lnh c bn

V d, ngi dng s dng lnh cat xem ni dung tp tin vduniq # cat vduniq Gnome c hai phng php thot ra ngoi. Gnome c hai phng php thot ra ngoi. thot bng cch s dng menu chnh, hy m menu chnh, chn mc Logout y menu. Chn YES/ NO kt thc phin lm vic vi Gnome. Chn YES/ NO kt thc phin lm vic vi Gnome. Nu mun thot bng cch s dng nt Logout trn Panel, trc ht phi thm nt ny vo Panel. Chn YES/ NO kt thc phin lm vic vi Gnome. Trong tp tin vduniq c hai dng b trng lp v k nhau l dng th 1 v 2. Gnome c hai phng php thot ra ngoi. Gnome c hai phng php thot ra ngoi. v dng th 5 v 6 Chn YES/ NO kt thc phin lm vic vi Gnome. Chn YES/ NO kt thc phin lm vic vi Gnome. Dng lnh uniq loi b dng trng lp: # uniq vduniq Gnome c hai phng php thot ra ngoi. thot bng cch s dng menu chnh, hy m menu chnh, chn mc Logout y menu. Chn YES/ NO kt thc phin lm vic vi Gnome. Nu mun thot bng cch s dng nt Logout trn Panel, trc ht phi thm nt ny vo Panel. Chn YES/ NO kt thc phin lm vic vi Gnome. Dng cui cng trong tp tin vduniq c ni dung trng vi dng th 5, nhng sau lnh uniq, n khng b xa v khng k vi dng c ni dung trng lp. * Sp xp ni dung tp tin vi lnh sort sort l lnh c cc thng tin v sp xp chng theo th t trong bng ch ci hoc theo th t c quy nh theo cc ty chn ca lnh. 69

Linux-VN, cc lnh c bn

C php lnh: sort [ty-chn] ... [tp-tin] ... Hin th ni dung sau khi sp xp ca mt hoc nhiu tp tin ra thit b ra chun l tc dng ca lnh sort. Ngm nh sp xp theo th t t in ca cc dng c trong cc tp tin (tng ch ci theo bng ch h thng (chng hn ASCII) v k t v tr u tin trong cc dng). Cc ty chon: +<s1> [-<s2>] Hai gi tr s1 v s2 xc nh "kha" sp xp ca cc dng, thc cht ly xu con t v tr s1 ti v tr s2 ca cc dng so snh ly th t sp xp cc dng. Nu s2 khng c th coi l ht cc dng; nu s2 nh hn s1 th b qua la chn ny. Ch , nu c s2 th phi cch s1 t nht mt du cch. -b b qua cc du cch ng trc trong phm vi sp xp. -c kim tra nu tp tin sp xp th thi khng sp xp na. -d xem nh ch c cc k t [a-zA-Z0-9] trong kha sp xp, cc dng c cc k t c bit (du cch, ? ...) c a ln u. -f sp xp khng phn bit ch hoa ch thng. -n sp xp theo kch thc ca tp tin. -r chuyn i th t sp xp hin thi. V d, mun sp xp tp tin vdsort # cat vdsort trc ht phi thm nt ny vo Panel. 21434 bn xc nhn l c thc s mun thot hay khng. menu chnh, chn mc Logout y menu. Bn c th s dng mc Logout t menu chnh 70

Linux-VN, cc lnh c bn

Gnome c hai phng php thot ra ngoi. hoc nt Logout trn Panel chnh thot ra ngoi. Khi mt hp thoi Logout s xut hin yu cu 57879 La chn YES hoc NO kt thc phin lm vic vi Gnome. N khng cung cp chc nng hot ng no khc ngoi chc nng ny. N khng cung cp chc nng hot ng no khc ngoi chc nng ny. Nu mun thot bng cch s dng nt Logout trn Panel, # sort -f vdsort 21434 57879 Bn c th s dng mc Logout t menu chnh bn xc nhn l c thc s mun thot hay khng. Gnome c hai phng php thot ra ngoi. hoc nt Logout trn Panel chnh thot ra ngoi. Khi mt hp thoi Logout s xut hin yu cu La chn YES hoc NO kt thc phin lm vic vi Gnome. menu chnh, chn mc Logout y menu. Nu mun thot bng cch s dng nt Logout trn Panel, N khng cung cp chc nng hot ng no khc ngoi chc nng ny. N khng cung cp chc nng hot ng no khc ngoi chc nng ny. trc ht phi thm nt ny vo Panel. C th kt hp lnh sort vi cc lnh khc, v d: # ls -s | sort -n
total 127

71

Linux-VN, cc lnh c bn

1 1 13 46 64

Archive/ infoWorld/ keylime.pie drop.text.hqx bitnet.mailing-lists.Z

Lnh trn s cho th t sp xp ca cc tp tin theo kch thc trong th mc hin thi. 3.4.4. Cc lnh thao tc theo ni dung tp tin * S dng lnh file xc nh kiu tp tin C php lnh file:
file [ty-chn] [-f tp-tin] [-m <tp-tin-nh>...] <tp-tin>...

Lnh file cho php xc nh v in ra kiu thng tin cha trong tp tin. Lnh file s ln lt kim tra t kiu tp tin h thng, kiu tp tin magic (v d tp tin m t thit b) ri n kiu tp tin vn bn thng thng. Nu tp tin c kim tra tha mn mt trong ba kiu tp tin trn th kiu tp tin s c in ra theo cc dng c bn sau: text: dng tp tin vn bn thng thng, ch cha cc m k t ASCII. executable: dng tp tin nh phn kh thi. data: thng l dng tp tin cha m nh phn v khng th in ra c. Mt s tu chn sau y: -b cho php ch a ra kiu tp tin m khng a km theo tn tp tin. -f tn-tp-tin cho php hin th kiu ca cc tp tin c tn trng vi ni dung trn mi dng trong tp tin tn-tp-tin. kim tra trn thit b vo chun, s dng du "-". -z xem kiu ca tp tin nn. V d: # file file.c file /dev/hda
file.c: C program text file: ELF 32-bit LSB executable, Intel 80386,version 1,dynamically linked, not stripped /dev/hda: block special

Lnh trn cho xem kiu ca hai tp tin file.c, file v th mc /dev/hda. Cn nh rng kt qu ca lnh file khng phi lc no cng chnh xc. 72

Linux-VN, cc lnh c bn

* Xem ni dung tp tin vi lnh cat on trc, chng ta c dp lm quen vi lnh cat thng qua tc dng to tp tin ca lnh. Phn ny gii thiu tc dng ch yu ca lnh cat: l tc dng xem ni dung ca mt tp tin. C php lnh: cat [ty-chn] <tn tp tin> Cc ty chn nh sau: -A, --show-all ging nh ty chn -vET. -b, --number-nonblank hin th thm s th t trn mi dng (b qua dng trng). -e ging nh ty chn -vE. -E, --show-ends hin th du "$" ti cui mi dng. -n, --number hin th s th t ca mi dng (k c dng trng). -s nu trong ni dung tp tin c nhiu dng trng th s loi b bt ch hin th mt dng trng. -t ging nh -vT. -T, --show-tabs hin th du TAB di dng ^I. -v, --show-nonprinting hin th cc k t khng in ra c ngoi tr LFD v TAB. --help hin th trang tr gip v thot. V d: # cat vdcat chng ta thy xut hin cc dng sau y:
Gnome c hai phng php thot ra ngoi. c th s dng mc Logout t menu chnh

73

Linux-VN, cc lnh c bn

hoc nt Logout trn Panel chnh thot ra ngoi. thot bng cch s dng menu chnh, hy m menu chnh, chn mc Logout y menu.

Khi mt hp thoi Logout s xut hin yu cu xc nhn l c thc s mun thot hay khng.

hoc nt Logout trn Panel chnh thot ra ngoi. thot bng cch s dng menu chnh, hy m menu chnh, chn mc Logout y menu.

# cat -bEs vdcat th ni dung tp tin hin ra nh sau:


1 Gnome c hai phng php thot ra ngoi. $ 2 c th s dng mc Logout t menu chnh $ 3 hoc nt Logout trn Panel chnh thot ra ngoi.$ 4 thot bng cch s dng menu chnh, hy m $ 5 menu chnh, chn mc Logout y menu. $ $ 6 Khi mt hp thoi Logout s xut hin yu cu $ 7 xc nhn l c thc s mun thot hay khng.$ $ 8 hoc nt Logout trn Panel chnh thot ra ngoi.$ 9 thot bng cch s dng menu chnh, hy m $ 10 menu chnh, chn mc Logout y menu.

* Xem ni dung cc tp tin ln vi lnh more Lnh cat cho php xem ni dung ca mt tp tin, nhng nu tp tin qu ln, ni dung tp tin s tri trn mn hnh v ch c th nhn thy phn cui ca tp tin. Linux c mt lnh cho php c th xem ni dung ca mt tp tin ln, l lnh more. C php lnh: more [-dlfpcsu] [-s] [+/xumu] [+dng-s] [tp-tin ...] Lnh more hin th ni dung ca tp tin theo tng trang mn hnh. Cc la chn nh sau: -s 74

Linux-VN, cc lnh c bn

xc nh s dng ni dung ca tp tin c hin th (s). -d trn mn hnh s hin th cc thng bo gip ngi dng cch s dng i vi lnh more, v nh [ Press space to continue, "q" to quit .], hay hin th [Press "h" for instructions .] thay th cho ting chung cnh bo khi bm sai mt phm. -l more thng xem ^L l mt k t c bit, nu khng c ty chn ny, lnh s dng ti dng u tin c cha ^L v hin th % ni dung xem c (^L khng b mt), nhn phm space (hoc enter) tip tc. Nu c ty chn -l, ni dung ca tp tin s c hin th nh bnh thng nhng mt khun dng khc, tc l du ^L s mt v trc dng c cha ^L s c thm mt dng trng. -p khng cun mn hnh, thay vo l xa nhng g c trn mn hnh v hin th tip ni dung tp tin. -c khng cun mn hnh, thay vo xa mn hnh v hin th ni dung tp tin bt u t nh mn hnh. -s xa bt cc dng trng lin nhau trong ni dung tp tin ch gi li mt dng. -u b qua du gch chn. +/xumu ty chn +/xumu ch ra mt chui s c tm kim trc khi hin th mi tp tin. +dng-s bt u hin th t dng th dng-s. V d: # more -d vdmore
total 1424 drwxr-xr-x 6 root root 4096 Oct 31 2000 AfterStep-1.8.0 drwxr-xr-x 2 root root 4096 Oct 31 2000 AnotherLevel drwxr-xr-x 2 root root 4096 Oct 31 2000 ElectricFence drwxr-xr-x 2 root root 4096 Oct 31 2000 GXedit-1.23

75

Linux-VN, cc lnh c bn

drwxr-xr-x 3 root root 4096 Oct 31 2000 HTML drwxr-xr-x 3 root root 4096 Oct 31 2000 ImageMagick drwxr-xr-x 6 root root 4096 Oct 31 2000 LDP drwxr-xr-x 3 root root 4096 Oct 31 2000 ORBit-0.5.0 drwxr-xr-x 2 root root 4096 Oct 31 2000 SVGATextMode drwxr-xr-x 2 root root 4096 Oct 31 2000 SysVinit-2.78 drwxr-xr-x 2 root root 4096 Oct 31 2000 WindowMaker --More--(9%) [ Press space to continue, "q" to quit .]

i vi lnh more, c th s dng mt s cc phm tt thc hin mt s cc thao tc n gin trong khi ang thc hin lnh. Bng di y s lit k cc phm tt : Phm tt [Space] n [Enter] h d hoc CTRL+D q hoc CTRL+Q s f b hoc CTRL+B = :n :p v CTRL+L :f . Hin th dng tip theo Hin th danh sch cc phm tt Cun mn hnh (mc nh l 11 dng) Thot khi lnh more B qua n dng (mc nh l 1) B qua k mn hnh tip theo (mc nh l 1) Tr li k mn hnh trc (mc nh l 1) Hin th s dng hin thi xem k tp tin tip theo Tr li k tp tin trc Chy chng trnh son tho vi ti dng hin thi V li mn hnh Hin th tn tp tin hin thi v s dng Lp li lnh trc * Thm s th t ca cc dng trong tp tin vi lnh nl Nh bit lnh cat vi tham s -n s nh s th t ca cc dng trong tp tin, tuy nhin Linux cn cho php dng lnh nl thc hin cng vic nh vy. C php lnh: 76 Chc nng Nhn phm space hin th mn hnh tip theo Hin th n dng tip theo

Linux-VN, cc lnh c bn

nl [ty-chn] ... <tp-tin> Lnh ny s a ni dung tp tin ra thit b ra chun, vi s th t ca dng c thm vo. Nu khng c tp-tin (tn tp tin), hoc khi tp-tin l du "-", th c ni dung t thit b vo chun. Cc tu chn lnh: -b, --body-numbering=STYLE s dng kiu STYLE cho vic nh th t cc dng trong ni dung tp tin. C cc kiu STYLE sau: a: nh s tt c cc dng k c dng trng; t: ch nh s cc dng khng trng; n: khng nh s dng. -d, --section-delimiter=CC s dng CC nh s trang logic (CC l hai k t xc nh phm vi cho vic phn trang logic). -f, --footer-numbering=STYLE s dng kiu STYLE nh s cc dng trong ni dung tp tin (mt cu c th c hai dng ...). -h, --header-numbering=STYLE s dng kiu STYLE nh s cc dng trong ni dung tp tin. -i, --page-increment=s nh s th t ca dng theo cp s cng c cng sai l s. -l, --join-blank-lines=s nhm s dng trng vo thnh mt dng trng. -n, --number-format=khun chn s dng theo khun (khun: ln - cn tri, khng c s 0 u; rn - cn phi, khng c s 0 u; rz - cn phi v c s 0 u) -p, --no-renumber khng thit lp li s dng ti mi trang logic. -s, --number-separator=xu thm chui xu vo sau s th t ca dng. -v, --first-page=s s dng u tin trn mi trang logic. -w, --number-width=s 77

Linux-VN, cc lnh c bn

hin th s th t ca dng trn ct th s. --help hin th trang tr gip v thot. V d: # nl --body-numbering=a --number-format=rz vdnl
000001 1) New configuration mode 000002 000003 000004 1-1) Directories 000005 000006 Now, everything goes to ~/GNUstep/Library/AfterStep or 000007 /usr/local/share/afterstep ! 000008 000009 You can use your old .steprc config file with afterstep -f myoldsteprc, 000010 however, this isn't recommended at all. 000011 000012 New versions of asapps will also put their config. file here in a near 000013 future, like modules currently do. 000014

Lnh trong v d trn cho thm s th t ca cc cu trong tp tin vdnl theo dng: nh s th t tt c cc dng, k c dng trng, cc s th t c cn phi v c s 0 u (lu rng c dng trong tp tin c hin ra thnh hai dng trn giy). * Xem qua ni dung tp tin vi lnh head Cc on trc cho bit cch thc xem ni dung ca mt tp tin nh lnh cat hay more. Trong Linux cng c cc lnh khc cho nhiu cch thc xem ni dung ca mt tp tin. Trc ht, chng ta hy lm quen vi lnh head. C php lnh head [ty-chn]... [tp-tin]... Lnh ny mc nh s a ra mn hnh 10 dng u tin ca mi tp tin. Nu c nhiu hn mt tp tin, th ln lt tn ca tp tin v 10 dng ni dung u tin s c hin th. Nu khng c tham s tp-tin, hoc tp-tin l du "-", th ngm nh s c t thit b vo chun. Cc tu chn: -c, --bytes=c hin th c (s nguyn) k t u tin trong ni dung tp tin (c c th nhn 78

Linux-VN, cc lnh c bn

gi tr l b cho 512, k cho 1K, m cho 1 Meg) -n, --lines=n hin th n (s nguyn) dng thay cho 10 dng ngm nh. -q, --quiet, --silent khng a ra tn tp tin dng u. -v, --verbose lun a ra tn tp tin dng u. --help hin th trang tr gip v thot. V d: # head -6 vdhead1 vdhead2
==> vdhead1 <== 1) New configuration mode 1-1) Directories Now, everything goes to ~/GNUstep/Library/AfterStep or ==> vdhead2 <== 1.7.164 patch 3 $HOME/GNUstep/Library/AfterStep/start/Desktop/Theme/.include changed from shell script call to perl script call

Lnh ny cho xem qua 6 dng u tin trong ni dung hai tp tin vdhead1 v vdhead2. * Xem qua ni dung tp tin vi lnh tail Lnh th hai cho php xem qua ni dung ca tp tin l lnh tail vi c php: tail [ty-chn]... [tp-tin]... Lnh tail ngm nh a ra mn hnh 10 dng cui trong ni dung ca cc tp-tin. Nu c nhiu hn mt tp tin, th ln lt tn ca tp tin v 10 dng cui s c hin th. Nu khng c tham s tp-tin, hoc tp-tin l du "-" th ngm nh s c t thit b vo chun. Cc ty chn nh sau: 79

Linux-VN, cc lnh c bn

--retry c gng m mt tp tin kh truy nhp khi bt u thc hin lnh tail. -c, --bytes=n hin th n (s) k t sau cng. -f, --follow[={name | descritptor}] sau khi hin ni dung tp tin s hin thng tin v tp tin: -f, --follow, v -follow=descriptor l nh nhau. -n, --lines=n hin th n (s) dng cui cng ca tp tin thay cho 10 dng ngm nh. --max-unchanged-stats=n hin th ti liu v tp tin (ngm nh n l 5). --max-consecutive-size-changes=n hin th ti liu v tp tin (ngm nh n l 200). --pid=PID kt hp vi ty chn -f, chm dt sau khi tin trnh c ch s = PID li. -q, --quiet, --silent khng a ra tn tp tin dng u trong ni dung c hin th. -s, --sleep-interval=k kt hp vi ty chn -f, dng k giy gia cc hot ng. -v, --verbose lun hin th tn ca tp tin. --help hin th trang tr gip v thot. V d: # tail -2 vdtail1 vdtail2
==> vdtail1 <== Now, everything goes to ~/GNUstep/Library/AfterStep or /usr/local/share/afterstep ! ==> vdtail2 <== changed from shell script call to perl script call

80

Linux-VN, cc lnh c bn

Lnh trn cho xem hai dng cui ca hai tp tin vdtail1 v vdtail2. * Tm s khc nhau gia hai tp tin (lnh diff) Vic tm ra s khc nhau gia hai tp tin i khi l rt cn thit. Linux c mt lnh c tc dng nh vy, l lnh diff vi c php: diff [tu-chn] <tp-tin1> <tp-tin2> Trong trng hp n gin, lnh diff s so snh ni dung ca hai tp tin. Nu tptin1 l mt th mc cn tp-tin2 l mt tp tin bnh thng, diff s so snh tp tin c tn trng vi tp-tin2 trong th mc tp-tin1 vi tp-tin2. Nu c tp-tin1 v tp-tin2 u l th mc, diff s thc hin s so snh ln lt cc tp tin trong c hai th mc theo th t t a-z (s so snh ny s khng qui nu tu chn -r hoc --recursive khng c a ra). Tt nhin so snh gia hai th mc khng th chnh xc nh khi so snh hai tp tin. Cc tu chn: -a xem tt c cc tp tin dng vn bn v so snh theo tng dng. -b b qua s thay i v s lng ca k t trng. -B b qua mi s thay i m ch chn hoc xo cc dng trng. --brief ch thng bo khi c s khc nhau m khng a ra chi tit ni dung khc nhau. -d tm ra s khc bit nh (tu chn ny c th lm chm tc lm vic ca lnh diff). --exclude-from=tp-tin khi so snh th mc, b qua cc tp tin v cc th mc con c tn ph hp vi mu c trong tp-tin. -i so snh khng bit ch hoa ch thng. -r thc hin so snh qui trn th mc. -s thng bo khi hai tp tin l ging nhau. 81

Linux-VN, cc lnh c bn

-y hin th hai tp tin cnh nhau d phn bit s khc nhau. 3.4.5. Cc lnh tm tp tin * Tm theo ni dung tp tin bng lnh grep Lnh grep cng nh lnh ls l hai lnh rt quan trng trong Linux. Lnh ny c hai tc dng c bn nh sau: tc dng th nht l lc u ra ca mt lnh khc vi c php l <lnh> | grep <mu lc> tc dng th hai, v cng l tc dng c bn c gii thiu trong phn ny, l tm dng cha mu nh trong tp tin c ch ra. C php lnh grep: grep [ty-chn] ... <mu-lc> [tp-tin] Lnh grep hin th tt c cc dng c cha mu-lc trong tp-tin c ch ra (hoc t thit b vo chun nu khng c tp-tin hoc tp-tin c dng l du "-") Cc ty chn l: -G, --basic-regexp xem mu lc nh mt biu thc thng thng. iu ny l ngm nh. -E, --extended-regexp xem mu lc nh mt biu thc m rng. -F, --fixed-strings xem mu nh mt danh sch cc xu c nh, c phn ra bi cc dng mi. Ngoi lnh grep cn c hai lnh l egrep v fgrep. egrep tng t nh lnh grep -E, fgrep tng t vi lnh grep -F . Lnh grep cn c cc ty chn sau: -A NUM, --after-context=NUM a ra NUM dng ni dung tip theo sau dng c cha mu. -B NUM, --before-context=NUM a ra NUM dng ni dung trc dng c cha mu. -C [NUM], --context[=NUM] hin th NUM dng (mc nh l 2 dng) ni dung. -NUM ging --context=NUM a ra cc dng ni dung trc v sau dng c cha mu. Tuy nhin, grep s khng a ra dng no nhiu hn mt ln. 82

Linux-VN, cc lnh c bn

-b, --byte-offset hin th a ch tng i trong tp tin u vo trc mi dng c a ra -c, --count m s dng tng ng cha mu trong tp tin u vo thay cho vic hin th cc dng cha mu. -d ACTION, --directories=ACTION nu u vo l mt th mc, s dng ACTION x l n. Mc nh, ACTION l read, tc l s c ni dung th mc nh mt tp tin thng thng. Nu ACTION l skip, th mc s b b qua. Nu ACTION l recurse, grep s c ni dung ca tt c cc tp tin bn trong th mc ( quy); ty chn ny tng ng vi ty chn -r. -f tp-tin, --file=tp-tin ly cc mu t tp-tin, mt mu trn mt dng. Tp tin trng cha ng cc mu rng, v cc dng a ra cng l cc dng trng. -H, --with-tp-tin a ra tn tp tin trn mi dng cha mu tng ng. -h, --no-filename khng hin th tn tp tin km theo dng cha mu trong trng hp tm nhiu tp tin. -i hin th cc dng cha mu khng phn bit ch hoa ch thng. -l a ra tn cc tp tin trng vi mu lc. -n, --line-number thm s th t ca dng cha mu trong tp tin. -r, --recursive c tt c cc tp tin c trong th mc ( quy). -s, --no-messages b qua cc thng bo li tp tin khng c c hoc khng tn ti. -v, --invert-match hin th cc dng khng cha mu. -w, --word-regexp ch hin th nhng dng c cha mu lc l mt t trn vn. -x, --line-regexp 83

Linux-VN, cc lnh c bn

ch hin th nhng dng m ni dung trng hon ton vi mu lc. V d, ngi dng g lnh cat xem ni dung tp tin text: # cat -n text th hin ra ni dung tp tin nh sau:
1 $ file file.c file /dev/hda 2 file.c: C program text 3 file:ELF 32-bit LSB executable, Intel 80386, version 1, 4 dynamically linked, not stripped 5 /dev/hda: block special 6 7 $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10} 8 /dev/hda: x86 boot sector 9 /dev/hda1: Linux/i386 ext2 filesystem 10 11 12 13 14 15 16 17 18 /dev/hda2: x86 boot sector /dev/hda3: x86 boot sector, extended partition table /dev/hda4: Linux/i386 ext2 filesystem /dev/hda5: Linux/i386 swap file /dev/hda6: Linux/i386 swap file /dev/hda7: Linux/i386 swap file /dev/hda8: Linux/i386 swap file thutest toithutest

Sau , dng lnh grep lc cc dng c cm filesystem # grep -n filesystem text


9: /dev/hda1: Linux/i386 ext2 filesystem 12: /dev/hda4: Linux/i386 ext2 filesystem

Cng c th s dng cc k hiu biu din thng thng (regular - expression) trong mu lc a ra c nhiu cch tm kim tp tin khc nhau. Bng di y s lit k mt s cc k hiu hay dng:

84

Linux-VN, cc lnh c bn

K hiu c \c ^ $ . [xy] [^xy] c*

ngha - thay th cho k t c - hin th c nh l mt k t bnh thng nu c l mt k t iu khin - bt u mt dng - kt thc dng - thay cho mt k t n - chn mt k t trong tp hp cc k t c a ra - chn mt k t khng thuc tp hp cc k t c a ra - thay cho mt mu c hoc khng cha k t c

# grep - H thutest text


text: thutest text: toithutest

# grep -H "^thutest" text


text: thutest

Ngoi cc ty chn khc nhau, lnh grep cn c hai dng na trn Linux. Hai dng l egrep - s dng vi cc mu lc phc tp, v fgrep - s dng tm nhiu mu lc cng mt lc. Thnh thong mt biu thc n gin khng th xc nh c th cn tm, v d, nh ang cn tm cc dng c mt hoc hai mu lc. Nhng lc , lnh egrep t ra rt c ch. egrep - expression grep - c rt nhiu cc k hiu biu din mnh hn grep. Di y l cc k hiu hay dng:

85

Linux-VN, cc lnh c bn

K hiu c \c ^ $ . [xy] [^xy] c* c+ c? a|b (a)

ngha - thay th cho k t c - hin th c nh l mt k t bnh thng nu c l mt k t iu khin - bt u mt dng - kt thc dng - thay cho mt k t n - chn mt k t trong tp hp cc k t c a ra - chn mt k t khng thuc tp hp cc k t c a ra - thay cho mt mu c hoc khng cha k t c - thay cho mt mu c cha mt hoc nhiu hn k t c - thay cho mt mu khng c hoc ch c cha duy nht mt k t c - hoc l a hoc l b - a mt biu thc

V d, gi s by gi mun tm cc dng c cha mt hoc nhiu hn k t b trn tp tin passwk vi lnh egrep. # egrep 'b+' /etc/passwd | head cho ra cc dng kt qu sau:
root : x : 0 : 0 : root : /root : /bin/bash bin : x : 1 : 1 : bin : /bin : daemon : x : 2 : 2 : daemon : /sbin : sync : x : 5 : 0 : sync : /sbin : /bin/sync shutdown : x : 6 : 0 : shutdown : /sbin : /sbin/shutdown halt : x : 7 : 0 : halt : /sbin : /sbin/halt gopher : x : 13 : 30 : gopher : /usr/lib/gopher-data : nobody : x : 99 : 99 : Nobody : / : xfs : x : 43 : 43 : X Font Server : /etc/X11/fs : /bin/false named : x : 25 : 25 : Named : /var/named : /bin/false

Ngi dng g lnh: # egrep '(^[a-zA-Z] | :wi)' /etc/printcap | head th nhn c thng bo kt qu: 86

Linux-VN, cc lnh c bn

aglw:\ :wi=AG 23 : wk=multiple Apple LaserWrite IINT: aglw1:\ :wi=AG 23 : wk=Apple LaserWrite IINT: aglw2:\ :wi=AG 23 : wk=Apple LaserWrite IINT: aglw3:\ :wi=AG 23 : wk=Apple LaserWrite IINT:

Lnh trn cho php tm cc dng c bt u bi (^) mt ch ci khng phn bit ch hoa ch thng ([a-zA-Z]) hoc ( | ) dng c cha mu :wi. Bt k lc no mun tm cc dng c cha nhiu hn mt mu lc, egrep l lnh tt nht s dng. C nhng lc cn phi tm nhiu mu lc trong mt lc. V d, c mt tp tin cha rt nhiu mu lc v mun s dng mt lnh trong Linux tm cc dng c cha cc mu . Lnh fgrep s lm c iu ny. V d: tp tin thu c ni dung nh sau: # cat thu
/dev/hda4: Linux/i386 ext2 filesystem /dev/hda5: Linux/i386 swap file /dev/hda8: Linux/i386 swap file /dev/hda9: empty /dev/hda10: empty thutest toithutest

v tp tin mauloc c ni dung l: # cat mauloc


empty test

By gi mun s dng ni dung tp tin mauloc lm mu lc tm cc cu trong tp tin thu, hy g lnh: # fgrep -i -f mauloc thu
/dev/hda9: empty /dev/hda10: empty thutest toithutest

87

Linux-VN, cc lnh c bn

* Tm theo cc c tnh ca tp tin vi lnh find Cc on trn y gii thiu cch thc tm tp tin theo ni dung vi cc lnh grep, egrep v fgrep. Linux cn cho php ngi dng s dng mt cch thc khc y nng lc, l s dng lnh find, lnh tm tp tin theo cc thuc tnh ca tp tin. Lnh ny c mt s khc bit so vi cc lnh khc, l cc ty chn ca lnh l mt t ch khng phi mt k t. iu kin cn i vi lnh ny l ch ra c im bt u ca vic tm kim trong h thng tp tin v nhng quy tc cn tun theo ca vic tm kim. C php ca lnh find: find [ng-dn] [biu-thc] Lnh find thc hin vic tm kim tp tin trn cy th mc theo biu thc c a ra. Mc nh ng dn l th mc hin thi, biu thc l -print. Biu thc c th c nhng dng sau: Cc ton t:
( EXPR ); ! EXPR hoc -not EXPR; EXPR1 -a EXPR2 hoc EXPR1 -and EXPR2; EXPR1 -o EXPR2 hoc EXPR1 -or EXPR2; v EXPR1, EXPR2

Cc ty chn lnh: tt c cc ty chn ny lun tr v gi tr true v c t u biu thc -daystart o thi gian (-amin, -atime, -cmin, -ctime, -mmin, -mtime). -depth thc hin tm kim t ni dung bn trong th mc trc (mc nh vic tm kim c thc hin bt u ti gc cy th mc c cha tp tin cn tm). -follow (ty chn ny ch p dng cho th mc) nu c ty chn ny th cc lin kt tng trng c trong mt th mc lin kt s c ch ra. -help, --help hin th kt qu ca lnh find v thot. cc test -amin n tm tp tin c truy nhp n pht trc. -atime n tm tp tin c truy nhp n*24 gi trc. -cmin n trng thi ca tp tin c thay i n pht trc y. -ctime n 88

Linux-VN, cc lnh c bn

trng thi ca tp tin c thay i n*24 gi trc y. -empty tp tin rng v hoc l th mc hoc l tp tin bnh thng. -fstype kiu tp tin thuc h thng tp tin vi kiu. -gid n ch s nhm ca tp tin l n. -group nhm tp tin thuc quyn s hu ca nhm. -links n tp tin c n lin kt. -mmin n d liu ca tp tin c sa ln cui vo n pht trc y. -mtime n d liu ca tp tin c sa vo n*24 gi trc y. -name mu tm kim tp tin c tn l mu. Trong tn tp tin c th cha c cc k t i din nh du "*", "?"... -type kiu tm cc tp tin thuc kiu vi kiu nhn cc gi tr: b: c t theo khi c: c t theo k t d: th mc p: pipe f: tp tin bnh thng l: lin kt tng trng s: socket -uid n ch s ngi s hu tp tin l n. -user tn-ngi tp tin c s hu bi ngi dng tn-ngi. cc hnh ng 89

Linux-VN, cc lnh c bn

-exec lnh ty chn ny cho php kt hp lnh find vi mt lnh khc c c thng tin nhiu hn v cc th mc c cha tp tin cn tm. Ty chn exec phi s dng du {} - n s thay th cho tn tp tin tng ng, v du '\' ti cui dng lnh, (phi c khong trng gia {} v '\'). Kt thc lnh l du ';' -fprint tp-tin hin th y tn tp tin vo trong tp-tin. Nu tp-tin khng tn ti th s c to ra, nu tn ti th s b thay th ni dung. -print hin th y tn tp tin trn thit b ra chun. -ls hin th tp tin hin thi theo khun dng: lit k danh sch y km c s th mc, ch s ca mi tp tin, vi kch thc tp tin c tnh theo khi (block). V d: # find -name 'what*'
./usr/bin/whatis ./usr/bin/whatnow ./usr/doc/AfterStep-1.8.0/TODO/1.0_to_1.5/whatsnew ./usr/doc/gnome-libs-devel-1.0.55/devel-docs/gnome-dev-info/gnome-devinfo/what.html ./usr/doc/gnome-libs-devel-1.0.55/devel-docs/gnome-dev-info/gnome-devinfo/whatis.html

# find . -type f -exec grep -l -i mapping {} \ ;


./OWL/WordMap/msw-to-txt.c ./.elm/aliases.text ./Mail/mark ./News/usenet.alt ./bin/my.new.cmd: Permission denied ./src/fixit.c ./temp/attach.msg

3.5. Nn v sao lu cc tp tin 3.5.1. Sao lu cc tp tin (lnh tar) D liu rt c gi tr, s mt nhiu thi gian v cng sc nu phi to li, thm ch c lc cng khng th no to li c. V vy, Linux a ra cc cch thc ngi dng bo 90

Linux-VN, cc lnh c bn

v d liu ca mnh. C bn nguyn nhn c bn sau khin d liu c th b mt: li phn cng, li phn mm, li do con ngi hoc do thin tai. Sao lu l cch bo v d liu mt cch kinh t nht. Bng cch sao lu d liu, s khng c vn g xy ra nu d liu trn h thng b mt. Mt vn rt quan trng trong vic sao lu l la chn phng tin sao lu. cn phi quan tm n gi c, tin cy, tc , ch li cng nh tnh kh dng ca cc phng tin sao lu. C rt nhiu cc cng c c th c s dng sao lu. Cc cng c truyn thng l tar, cpio v dump (cng c chng ti mun gii thiu trong cun sch ny l tar). Ngoi ra cn rt nhiu cc cng c khc c th la chn ty theo phng tin sao lu c trong h thng. C hai kiu sao lu l sao lu theo kiu ton b (full backup) v sao lu theo kiu tng dn (incremental backup). Sao lu ton b thc hin vic sao mi th trn h thng tp tin, bao gm tt c cc tp tin. Sao lu tng dn ch sao lu nhng tp tin c thay i hoc c to ra k t t sao lu cui cng. Vic sao lu ton b c th c thc hin d dng vi lnh tar vi c php: tar [ty-chn] [<tp-tin>, ...] [<th-mc>, ...] Lnh (chng trnh) tar c thit k to lp mt tp tin lu tr duy nht. Vi tar, c th kt hp nhiu tp tin thnh mt tp tin duy nht c kch thc ln hn, iu ny s gip cho vic di chuyn tp tin hoc sao lu bng t tr nn d dng hn nhiu. Lnh tar c cc la chn sau y: -c, --create to tp tin lu tr mi. -d, --diff, --compare tm ra s khc nhau gia tp tin lu tr v tp tin h thng c lu tr. --delete xa t tp tin lu tr (khng s dng cho bng t). -r, --append chn thm tp tin vo cui tp tin lu tr. -t, --list lit k ni dung ca mt tp tin lu tr. -u, --update ch thm vo tp tin lu tr cc tp tin mi hn cc tp tin c. -x, --extract, --get tch cc tp tin ra khi tp tin lu tr. 91

Linux-VN, cc lnh c bn

-C, --directory tn-th-mc thay i n th mc c tn l tn-th-mc. --checkpoint a ra tn th mc khi c tp tin lu tr. -f, --file [HOSTNAME:]tp-tin ty chn ny xc nh tn tp tin lu tr hoc thit b lu tr l tp-tin (nu khng c ty chn ny, mc nh ni lu tr l /dev/rmt0). -h, --dereference khng hin cc tp tin lin kt m hin cc tp tin m chng tr ti. -k, --keep-old-files gi nguyn cc tp tin lu tr ang tn ti m khng ghi tp tin lu tr mi ln chng. -K, --starting-file tp-tin bt u ti tp-tin trong tp tin lu tr. -l, --one-file-system to tp tin lu tr trn h thng tp tin cc b. -M, --multi-volume ty chn ny c s dng khi dung lng ca tp tin cn sao lu l ln v khng cha ht trong mt n v lu tr vt l. -N, --after-date DATE, --newer DATE ch lu tr cc tp tin mi hn cc tp tin c lu tr trong ngy DATE. --remove-files xa tp tin gc sau khi sao lu chng vo trong tp tin lu tr. --totals a ra tng s byte c to bi ty chn --create. -v, --verbose hin th danh sch cc tp tin c x l. V d: # tar --create --file /dev/ftape /usr/src
tar: Removing leading / from absolute path names in the archive

# Lnh trn s to mt tp tin sao lu ca th mc /usr/src trong th mc /dev/ftape, (dng thng bo trn cho bit rng tar s chuyn c du / vo trong tp tin sao lu). 92

Linux-VN, cc lnh c bn

Nu vic sao lu khng th thc hin gn vo trong mt bng t, lc hy s dng ty chn -M:
# tar -cMf /dev/fd0H1440 /usr/src tar: Removing leading / from absolute path names in the archive Prepare volume #2 for /dev/fd0H1440 and hit return: #

Ch rng phi nh dng a mm trc khi thc hin vic sao lu, c th s dng mt thit b u cui khc thc hin vic nh dng a khi tar yu cu mt a mm mi. Sau khi thc hin vic sao lu, c th kim tra kt qu ca cng vic bng ty chn -compare:
# tar --compare --verbose -f /dev/ftape usr/src/ usr/src/Linux usr/src/Linux-1.2.10-includes/ ... #

s dng kiu sao lu tng dn, hy s dng ty chn -N:


# tar --create --newer '8 Sep 1995' --file /dev/ftape /usr/src --verbose tar: Removing leading / from absolute path names in the archive usr/src/ usr/src/Linux-1.2.10-includes/ usr/src/Linux-1.2.10-includes/include/ usr/src/Linux-1.2.10-includes/include/Linux/ usr/src/Linux-1.2.10-includes/include/Linux/modules/ usr/src/Linux-1.2.10-includes/include/asm-generic/ usr/src/Linux-1.2.10-includes/include/asm-i386/ usr/src/Linux-1.2.10-includes/include/asm-mips/ usr/src/Linux-1.2.10-includes/include/asm-alpha/ usr/src/Linux-1.2.10-includes/include/asm-m68k/ usr/src/Linux-1.2.10-includes/include/asm-sparc/ usr/src/patch-1.2.11.gz

# Lu rng, tar khng th thng bo c khi cc thng tin trong inode ca mt tp tin b thay i, v d nh thay i quyn truy nhp ca tp tin, hay thay i tn tp tin chng hn. bit c nhng thng tin thay i s cn dng n lnh find v so snh vi trng thi hin thi ca tp tin h thng vi danh sch cc tp tin c sao lu t trc. 93

Linux-VN, cc lnh c bn

3.5.2. Nn d liu Vic sao lu rt c ch nhng ng thi n cng chim rt nhiu khng gian cn thit sao lu. gim khng gian lu tr cn thit, c th thc hin vic nn d liu trc khi sao lu, sau thc hin vic gii nn (dn) nhn li ni dung trc khi nn. Trong Linux c kh nhiu cch nn d liu, nhng trong cun sch ny chng ti gii thiu hai phng cch ph bin l gzip v compress. * Nn, gii nn v xem ni dung cc tp tin vi lnh gzip, gunzip v zcat C php cc lnh ny nh sau: gzip [ty-chn] [ -S suffix ] [ < tp-tin> ] gunzip [ty-chn] [ -S suffix ] [ <tp-tin> ] zcat [ty-chn] [ <tp-tin> ] Lnh gzip s lm gim kch thc ca tp tin v khi s dng lnh ny, tp tin gc s b thay th bi tp tin nn vi phn m rng l .gz, cc thng tin khc lin quan n tp tin khng thay i. Nu khng c tn tp tin no c ch ra th thng tin t thit b vo chun s c nn v gi ra thit b ra chun. Trong mt vi trng hp, lnh ny s b qua lin kt tng trng. Nu tn tp tin nn qu di so vi tn tp tin gc, gzip s ct b bt. gzip s ch ct phn tn tp tin vt qu 3 k t (cc phn c ngn cch vi nhau bi du chm). Nu tn tp tin gm nhiu phn nh th phn di nht s b ct b. V d, tn tp tin l gzip.msdos.exe, khi c nn s c tn l gzip.msd.exe.gz. Tp tin c nn c th c khi phc tr li dng nguyn th vi lnh gzip -d hoc gunzip. Vi lnh gzip c th gii nn mt hoc nhiu tp tin c phn m rng l .gz, -gz, .z, -z, _z hoc .Z ... gunzip dng gii nn cc tp tin nn bng lnh gzip, zip, compress, compress -H. Lnh zcat c s dng khi mun xem ni dung mt tp tin nn trn thit b ra chun. Cc ty chn nh sau: -c, --stdout --to-stdout a ra trn thit b ra chun; gi nguyn tp tin gc khng c s thay i. Nu c nhiu hn mt tp tin u vo, u ra s tun t l cc tp tin c nn mt cch c lp. -d, --decompress --uncompress gii nn. -f, --force thc hin nn hoc gii nn thm ch tp tin c nhiu lin kt hoc tp tin tng ng thc s tn ti, hay d liu nn c c hoc ghi trn thit b u cui. 94

Linux-VN, cc lnh c bn

-h, --help hin th mn hnh tr gip v thot. -l, --list hin th nhng thng tin sau i vi mt tp tin c nn: compressed size: kch thc ca tp tin nn uncompressed size: kch thc ca tp tin c gii nn ratio: t l nn (0.0% nu khng bit) uncompressed_name: tn ca tp tin c gii nn Nu kt hp vi ty chn --verbose, cc thng tin sau s c hin th: method: phng thc nn crc: CRC 32-bit cho d liu c gii nn date & time: thi gian cc tp tin c gii nn Nu kt hp vi ty chn --name, tn tp tin c gii nn, thi gian gii nn c lu tr trong tp tin nn Nu kt hp vi ty chn --verbose, tng kch thc v t l nn ca tt c cc tp tin s c hin th Nu kt hp vi ty chn --quiet, tiu v tng s dng ca cc tp tin nn khng c hin th. -n, --no-name khi nn, ty chn ny s khng lu tr tn tp tin gc v thi gian nn, (tn tp tin gc s lun c lu nu khi nn tn ca n b ct b). Khi gii nn, ty chn ny s khng khi phc li tn tp tin gc cng nh thi gian thc hin vic nn. Ty chn ny c ngm nh. -N, --name ty chn ny ngc vi ty chn trn (-n), n hu ch trn h thng c s gii hn v di tn tp tin hay khi thi gian nn b mt sau khi chuyn i tp tin. -q, --quiet b qua mi cnh bo. -r, --recursive nn th mc. -S .suf, --suffix .suf s dng phn m rng .suf thay cho .gz. Bt k phn m rng no cng c th c a ra, nhng cc phn m rng khc .z v .gz s b ngn chn trnh s ln xn khi cc tp tin c chuyn n h thng khc. 95

Linux-VN, cc lnh c bn

-t, --test ty chn ny c s dng kim tra tnh ton vn ca tp tin c nn -v, --verbose hin th phn trm thu gn i vi mi tp tin c nn hoc gii nn -#, --fast, --best iu chnh tc ca vic nn bng cch s dng du #, nu -# l -1 hoc --fast th s dng phng thc nn nhanh nht (less compression), nu l -9 hoc --best th s dng phng thc nn chm nht (best compression). Ngm nh mc nn l -6 (y l phng thc nn theo tc nn cao). V d: # ls /home/test
Desktop data dictionary newt-0.50.8 rpm save vd1

# gzip /home/test/vd1 # ls /home/test


Desktop data dictionary newt-0.50.8 rpm save vd1.gz

# zcat /home/test/vd1
PID TTY TIME CMD 973 pts/0 00:00:00 bash 996 pts/0 00:00:00 man 1008 pts/0 00:00:00 sh 1010 pts/0 00:00:00 less 1142 pts/0 00:00:00 cat 1152 pts/0 00:00:00 cat 1181 pts/0 00:00:00 man 1183 pts/0 00:00:00 sh 1185 pts/0 00:00:00 less

# * Nn, gii nn v xem tp tin vi cc lnh compress, uncompress, zcat C php cc lnh nh sau: compress [ty-chn] [<tp-tin>] uncompress [ty-chn] [<tp-tin>] 96

Linux-VN, cc lnh c bn

zcat [ty-chn] [<tp-tin>] Lnh compress s lm gim kch thc ca tp tin v khi s dng lnh ny, tp tin gc s b thay th bi tp tin nn vi phn m rng l .Z, cc thng tin khc lin quan n tp tin khng thay i. Nu khng c tn tp tin no c ch ra, thng tin t thit b vo chun s c nn v gi ra thit b ra chun. Lnh compress ch s dng cho cc tp tin thng thng. Trong mt vi trng hp, n s b qua lin kt tng trng. Nu mt tp tin c nhiu lin kt cng, compress s b qua vic nn tp tin tr khi c ty chn -f. Cc ty chn l: -f nu ty chn ny khng c a ra v compress chy trong ch nn trc, ngi dng s c nhc khi cc tp tin thc s tn ti v c th b ghi . Cc tp tin c nn c th c khi phc li nh vic s dng lnh uncompress. -c ty chn ny s thc hin vic nn hoc gii nn ri a ra thit b ra chun, khng c tp tin no b thay i. Lnh zcat tng ng vi uncompress -c. zcat thc hin vic gii nn hoc l cc tp tin c lit k trong dng lnh hoc t thit b vo chun a ra d liu c gii nn trn thit b ra chun. -r nu ty chn ny c a ra, compress s thc hin vic nn cc th mc. -v hin th t l gim kch thc cho mi tp tin c nn. 3.6. S dng rpm 3.6.1. Gii thiu chung v rpm rpm l tn vit tt ca RedHat Package Manager, l mt chng trnh cho php ngi dng qun l cc phn mm c ci t trn Linux mt cch mm do v hu dng. Vi rpm, ngi dng c th n gin ha cc thao tc bng tay. Dng rpm ci t cc gi phn mm mt cch t ng, c th g b cc phn mm c ci mt cch an ton, c th kim tra tnh ton vn ca cc chng trnh. Khi cc chng trnh c ng gi bng rpm th c th mang t ni ny qua ni khc m khng s b sai lc. c bit RPM c sn kh nng bo mt t xc thc chnh n bng ch k s. Vi c tnh ny c th ti mt phn mm no trn Internet m khng s b by v do mt ngi trung gian no thay i phn mm ny. Nu mt gi t chng thc c ni xut x th chng ta c th yn tm s dng gi . Vi rpm, ngi dng c th t ng gi phn mm ring cho mnh. Vic ng gi c th theo hai dng l ng gi t source, hay ti to li gi nh phn t gi c. Mt khc, rpm cng cung cp cc th vin hm API (Application Programming Interface) 97

Linux-VN, cc lnh c bn

gip cho mi ngi d dng to gi rpm t cc chng trnh C, python... khc nhau. Mt trong nhng phng thc (mode) sau y ca rpm bt buc phi c chn s dng: duy tr c s d liu gi, dng gi, t yu cu, duy tr gi c khi to, nh du gi, trn gi ... Hnh thi s dng rpm l ht sc phong ph v vy, cc on di y ch hn ch gii thiu nhng ni dung c bn nht v rpm. 3.6.2. RPM vi ngi dng * Ci t gi: C php y l: rpm {-i|--install} [tu-chn]... <tp-tin-rpm>... Khi mt gi c ci t, chng trnh rpm thc hin cc cng vic sau: Kim tra tnh ph thuc ca gi. Kim tra tnh trng xung t gia cc tp tin. Thc hin cc script trc lc ci t. Sa li cc tp tin cu hnh ang c trong h thng. Bung nn cc tp tin t gi ci t vo cc v tr thch hp. Thc hin cc script sau ci t. Lu li tt c cc thng tin trn vo c s d liu. * Xa mt gi ra khi h thng xa mt gi ra khi h thng, dng lnh: rpm {-e|--erase} [ty-chn] <danh-sch-cc-gi> Khi mt gi c xa khi h thng, rpm thc hin cc cng vic sau: Kim tra xem c mt gi no trong h thng ph thuc vo gi s b xa khng. Thc hin script pre-uninstall nu c. Kim tra cc tp tin cu hnh c b thay i khng, nu c s lu li mt bn sao. Tra cu c s d liu rpm xa cc tp tin ca gi . Thc hin cc script post-uninstall nu c. Xa cc thng tin lin quan n cc gi trong c s d liu. * Nng cp mt gi Cch thc nng cp mt gi cng tng t nh ci t gi. Ch khc l tham s khng phi -i m l -U. Mt iu ch y l nu cn phi ci li mt gi c hn gi ang c trn h thng th cn thm tham s --oldpackage. * Ly thng tin v cc gi phn mm (package) 98

Linux-VN, cc lnh c bn

Mt trong nhng im th v nht v rpm l rpm lun sn sng cung cp nhng thng tin cn thit v ton b cc gi c trong h thng. C php y nh sau: rpm {-q |--query} [ty-chn-q] Ty-chn-q c hai loi l ty chn b v ty chn thng tin. Ty chn b xc nh cc gi cn cung cp thng tin v c cc dng nh sau: pkg1 pkg2 .. pkgN l mt danh sch tn cc gi ci ). -p <tp-tin-rpm> Hi thng tin v b (mt tp-tin-rpm) c th cha c ci. -f tp-tin Hi thng tin v gi cha tp-tin. -a Hi thng tin v tt c cc gi c ci t. --whatprovides <x> Hi thng tin v gi cung cp <x>. -g <nhm> Hi thng tin v gi thuc nhm <nhm>. --whatrequires <x> Hi thng tin v gi cn n <x>. * Dng RPM kim tra cc gi ci t kim tra mt gi ci t trn h thng ta c th dng lnh rpm -V. C php y l: rpm {-V|--verify |-y} [ty-chn-v] Nh ni cc phn trn, ton b thng tin v cc gi u c lu tr trong c s d liu ca rpm. K c l ni dung ca tng tp tin (rpm s dng thut ton m ha hm bm MD5 kim tra tnh ton vn ni dung ca mt tp tin). Do , mi s thay i ca cc gi rpm u c lu li. Lnh rpm -V s kim tra li tt c cc thng tin xem c khp vi ban u hay khng. Khi c mt li no xy ra, rpm -V s cung cp cc thng tin v li pht hin c.

99

Linux-VN, cc lnh c bn

Chng 4. Cc lnh qun l ti khon Ngi dng Chng ny cung cp mt s cng c hu ch trong Linux qun l cc ti khon ngi dng trn h thng. 4.1. Ti khon ngi dng Khi mt my tnh c nhiu ngi dng s dng, n rt cn phi c c s phn bit gia cc ngi dng khc nhau, v d, mi ngi dng li c nhng tp tin ca ring h. iu ny vn rt quan trng thm ch c khi my tnh ch c mt ngi s dng ti mt thi im. Mi truy cp h thng Linux u thng qua ti khon ngi dng. V th, mi ngi s dng s c mt ci tn duy nht v tn c s dng ng nhp. Tuy nhin mt ngi dng thc s c th c nhiu tn ng nhp khc nhau. Ti khon ngi dng c th hiu l tt c cc tp tin, cc ti nguyn, v cc thng tin thuc v ngi dng . Khi ci t h iu hnh Linux, ng nhp chnh s c t ng to ra. ng nhp ny, gi l root, c xem l thuc v siu ngi dng (ngi dng cp cao, siu ngi dng), v khi ng nhp vi t cch ngi dng root, c th lm bt c iu g mun trn h thng. Tt nht ch nn ng nhp root khi thc s cn thit, v hy ng nhp vo h thng vi t cch l mt ngi dng bnh thng. Vy nu mun to mt ngi dng mi th s lm nh th no? Cc phn sau s gii thiu cc lnh to mt ngi dng mi, thay i thuc tnh ca mt ngi dng cng nh xa b mt ngi dng. Lu , ch c th thc hin c cc lnh trn nu c quyn ca mt siu ngi dng. 4.2. Cc lnh c bn qun l ngi dng Ngi dng c qun l thng qua tn ngi dng hoc ch s ngi dng. Thng thng, nhn h thng qun l ngi dng theo ch s, v vic qun l theo ch s s d dng v nhanh hn so vi qun l theo tn, v c mt c s d liu lu tr cc thng tin v ngi dng. Vic thm mt ngi dng mi ch c th thc hin c nu ng nhp vi t cch l ngi dng cp cao. to mt ngi dng mi, cn phi thm thng tin v ngi dng vo trong c s d liu ngi dng, v to mt th mc c nhn cho ring ngi dng . iu ny rt cn thit thit lp cc bin mi trng ph hp cho ngi dng. Lnh chnh thm ngi dng trong h thng Linux l useradd (hoc adduser). 4.2.1. Tp tin /etc/passwd Danh sch ngi dng cng nh cc thng tin tng ng c lu tr trong tp tin /etc/passwd. V d di y l ni dung ca tp tin /etc/passwd:
mail:x:8:12:mail:/var/spool/mail: games:x:12:100:games:/usr/games: gopher:x:13:30:gopher:/usr/lib/gopher-data: bien:x:500:0:Nguyen Thanh Bien:/home/bien:/bin/bash

100

Linux-VN, cc lnh c bn

sangnm:x:17:100:Nguyen Minh Sang:/home/sangnm:/bin/bash lan:x:501:0:Lan GNU:/home/lan:/bin/bash

Mi dng trong tp tin tng ng vi by trng thng tin ca mt ngi dng, v cc trng ny c ngn cch nhau bi du ':'. ngha ca cc trng thng tin ln lt nh sau: Tn ngi dng (username) Mt khu ngi dng (passwd - c m ha) Ch s ngi dng (user id) Cc ch s nhm ngi dng (group id) Tn y hoc cc thng tin khc v ti khon ngi dng (comment) Th mc ngi dng ng nhp Shell ng nhp (chng trnh chy lc ng nhp) Bt k ngi dng no trn h thng u c th c c ni dung tp tin /etc/passwd, v c th ng nhp vi t cch ngi dng khc nu h bit c mt khu, y chnh l l do v sao mt khu ng nhp ca ngi dng khng hin th trong ni dung tp tin. 4.2.2. Thm ngi dng vi lnh useradd Siu ngi dng s dng lnh useradd to mt ngi dng mi hoc cp nht ngm nh cc thng tin v ngi dng. C php lnh: useradd [ty-chn] <tn-ngi-dng> useradd -D [ty-chn] Nu khng c ty chn -D, lnh useradd s to mt ti khon ngi dng mi s dng cc gi tr c ch ra trn dng lnh v cc gi tr mc nh ca h thng. Ti khon ngi dng mi s c nhp vo trong cc tp tin h thng, th mc c nhn s c to, hay cc tp tin khi to c sao chp, iu ny ty thuc vo cc ty chn c a ra. Cc ty chn nh sau: -c, comment son tho trng thng tin v ngi dng. -d, home_dir to th mc ng nhp cho ngi dng. -e, expire_date thit t thi gian (YYYY-MM-DD) ti khon ngi dng s b hy b. -f, inactive_days ty chn ny xc nh s ngy trc khi mt khu ca ngi dng ht hiu lc 101

Linux-VN, cc lnh c bn

khi ti khon b hy b. Nu =0 th hy b ti khon ngi dng ngay sau khi mt khu ht hiu lc, =-1 th ngc li (mc nh l -1). -g, initial_group ty chn ny xc nh tn hoc s khi to ng nhp nhm ngi dng. Tn nhm phi tn ti, v s ca nhm phi tham chiu n mt nhm tn ti. S nhm ngm nh l 1. -G, group danh sch cc nhm ph m ngi dng cng l thnh vin thuc cc nhm . Mi nhm s c ngn cch vi nhm khc bi du ',', mc nh ngi dng s thuc vo nhm khi to. -m vi ty chn ny, th mc c nhn ca ngi dng s c to nu n cha tn ti. -M khng to th mc ngi dng. -n ngm nh khi thm ngi dng, mt nhm cng tn vi ngi dng s c to. Ty chn ny s loi b s ngm nh trn. -p, passwd to mt khu ng nhp cho ngi dng. -s, shell thit lp shell ng nhp cho ngi dng. -u, uid thit t ch s ngi dng, gi tr ny phi l duy nht. Thay i cc gi tr ngm nh Khi ty chn -D c s dng, lnh useradd s b qua cc gi tr ngm nh v cp nht cc gi tr mi. -b, default_home thm tn ngi dng vo cui th mc c nhn to tn th mc c nhn mi. -e, default_expire_date thay i thi hn ht gi tr ca ti khon ngi dng. -f, default_inactive xc nh thi im ht hiu lc ca mt khu ng nhp khi ti khon ngi dng b xa b. 102

Linux-VN, cc lnh c bn

-g, default_group thay i ch s nhm ngi dng. -s, default_shell thay i shell ng nhp. Ngoi lnh useradd, c th to ngi dng mi bng cch sau: Son tho tp tin /etc/passwd bng vipw. Lnh vipw m trnh son tho trn h thng v hiu chnh bn sao tm ca tp tin /etc/passwd. Vic s dng tp tin tm v kha tp tin s c tc dng nh mt c ch kha ngn vic hai ngi dng cng son tho tp tin mt lc. Lc s thm dng thng tin mi v ngi dng cn to. Hy cn thn trong vic son tho trnh nhm ln. Ring trng mt khu nn trng v to mt khu sau. Khi tp tin ny c lu, vipw s kim tra s ng nht trn tp tin b thay i. Nu tt c mi th dng nh thch hp th c ngha l tp tin /etc/passwd c cp nht. V d: thm ngi dng c tn l new, ch s ngi dng 503, ch s nhm l 100, th mc c nhn l /home/new v shell ng nhp l shell bash: # vipw
mail:x:8:12:mail:/var/spool/mail: games:x:12:100:games:/usr/games: gopher:x:13:30:gopher:/usr/lib/gopher-data: bien:x:500:0:Nguyen Thanh Bien:/home/bien:/bin/bash sang:x:17:100:Nguyen Minh Sang:/home/sangnm:/bin/bash lan:x:501:0:Lan GNU:/home/lan:/bin/bash new::503:100:them mot nguoi moi:/home/new:/bin/bash

To th mc c nhn ca ngi dng mi vi lnh mkdir # mkdir /home/new Sao chp cc tp tin t th mc /etc/skel/ (y l th mc lu tr cc tp tin cn thit cho ngi dng) vo tp tin c nhn va to Thay i quyn s hu v cc quyn truy nhp tp tin /home/new vi cc lnh chown v chmod # chown new /home/new # chmod go=u,go-w /home/new Thit lp mt khu ca ngi dng vi lnh passwd # passwd new
passwd:

Sau khi thit lp mt khu cho ngi dng bc cui cng, ti khon ngi dng s lm vic. Nn thit lp mt khu ngi dng bc cui cng, nu khng h c th v tnh 103

Linux-VN, cc lnh c bn

ng nhp trong khi ang sao chp cc tp tin. 4.2.3. Thay i thuc tnh ngi dng Trong Linux c rt nhiu lnh cho php thay i mt s cc thuc tnh ca ti khon ngi dng nh: chfn: thay i thng tin c nhn ca ngi dng. chsh: thay i shell ng nhp. passwd: thay i mt khu. Mt s cc thuc tnh khc s phi thay i bng tay. V d, thay i tn ngi dng, cn son tho li trc tip trn tp tin /etc/passwd (vi lnh vipw). Nhng c mt lnh tng qut cho php c th thay i bt k thng tin no v ti khon ngi dng, l lnh usermod. C php lnh: usermod [ty-chn] <tn-ng-nhp> Lnh usermod sa i cc tp tin ti khon h thng theo cc thuc tnh c xc nh trn dng lnh. Cc ty chn ca lnh: -c, comment thay i thng tin c nhn ca ti khon ngi dng. -d, home_dir thay i th mc c nhn ca ti khon ngi dng. -e, expire_date thay i thi im ht hn ca ti khon ngi dng (YYYY-MM-DD). -f, inactive_days thit t s ngy ht hiu lc ca mt khu trc khi ti khon ngi dng ht hn s dng. -g, initial_group ty chn ny thay i tn hoc s khi to ng nhp nhm ngi dng. Tn nhm phi tn ti, v s ca nhm phi tham chiu n mt nhm tn ti. S nhm ngm nh l 1. -G, group thay i danh sch cc nhm ph m ngi dng cng l thnh vin thuc cc nhm . Mi nhm s c ngn cch vi nhm khc bi du ',' mc nh ngi dng s thuc vo nhm khi to. -l, login_name thay i tn ng nhp ca ngi dng. Trong mt s trng hp, tn th mc 104

Linux-VN, cc lnh c bn

c nhn ca ngi dng c th s thay i tham chiu n tn ng nhp mi. -p, passwd thay i mt khu ng nhp ca ti khon ngi dng. -s, shell thay i shell ng nhp. -u, uid thay i ch s ngi dng. Lnh usermod khng cho php thay i tn ca ngi dng ang ng nhp. Phi m bo rng ngi dng khng thc hin bt k tin trnh no trong khi lnh usermod ang thc hin thay i cc thuc tnh ca ngi dng . V d mun thay i tn ngi dng new thnh tn mi l newuser, hy g lnh sau: # usermod -l new newuser 4.2.4. Xa b mt ngi dng (lnh userdel) xa b mt ngi dng, trc ht phi xa b mi th c lin quan n ngi dng . Lnh hay c dng xa b mt ti khon ngi dng l lnh userdel vi c php: userdel [-r] <tn-ngi-dng> Lnh ny s thay i ni dung ca cc tp tin ti khon h thng bng cch xa b cc thng tin v ngi dng c a ra trn dng lnh. Ngi dng ny phi thc s tn ti. Tu chn -r c ngha: -r cc tp tin tn ti trong th mc c nhn ca ngi dng cng nh cc tp tin nm trong cc th mc khc c lin quan n ngi dng s b xa b cng lc vi th mc ngi dng. Lnh userdel s khng cho php xa b ngi dng khi h ang ng nhp vo h thng. Phi hy b mi tin trnh c lin quan n ngi dng trc khi xo b ngi dng . Ngoi ra cng c th xa b ti khon ca mt ngi dng bng cch hiu chnh li tp tin /etc/passwd. 4.3. Cc lnh c bn lin quan n nhm ngi dng Mi ngi dng trong h thng Linux u thuc vo mt nhm ngi dng c th. Tt c nhng ngi dng trong cng mt nhm c th cng truy nhp mt trnh tin ch, hoc u cn truy cp mt thit b no nh my in chng hn. Mt ngi dng cng lc c th l thnh vin ca nhiu nhm khc nhau, tuy nhin ti mt thi im, ngi dng ch thuc vo mt nhm c th. 105

Linux-VN, cc lnh c bn

Nhm c th thit lp cc quyn truy nhp cc thnh vin ca nhm c th truy cp thit b, tp tin, h thng tp tin hoc ton b my tnh m nhng ngi dng khc khng thuc nhm khng th truy cp c. 4.3.1. Nhm ngi dng v tp tin /etc/group Thng tin v nhm ngi dng c lu trong tp tin /etc/group, tp tin ny c cch b tr tng t nh tp tin /etc/passwd. V d ni dung ca tp tin /etc/group c th nh sau:
root:x:0:root bin:x:1:root,bin,daemon daemon:x:2:root,bin,daemon sys:x:3:root,bin,adm adm:x:4:root,adm,daemon disk:x:6:root lp:x:7:daemon,lp mail:x:12:mail huyen:x:500: langnu:x:501:

Mi dng trong tp tin c bn trng c phn cch bi du ':'. ngha ca cc trng theo th t xut hin nh sau: Tn nhm ngi dng (groupname) Mt khu nhm ngi dng (passwd - c m ha), nu trng ny rng, tc l nhm khng yu cu mt khu Ch s nhm ngi dng (group id) Danh sch cc ngi dng thuc nhm (users) 4.3.2. Thm nhm ngi dng Cho php hiu chnh thng tin trong tp tin /etc/group bng bt k trnh son tho vn bn no c trn h thng ca thm nhm ngi dng, nhng cch nhanh nht l s dng lnh groupadd. C php lnh : groupadd [ty-chn] <tn-nhm> Cc tu chn l: -g, gid ty chn ny xc nh ch s nhm ngi dng, ch s ny phi l duy nht. Ch s mi phi c gi tr ln hn 500 v ln hn cc ch s nhm c trn h thng. Gi tr t 0 n 499 ch dng cho cc nhm h thng. -r 106

Linux-VN, cc lnh c bn

ty chn ny c dng khi mun thm mt ti khon h thng. -f ty chn ny s b qua vic nhc nh, nu nhm ngi dng tn ti, n s b ghi . V d: Thm nhm ngi dng bng cch son tho tp tin /etc/group:
installer:x:102:hieu, huy, sang tiengviet:x:103:minh, long, dung

Hai dng trn s b sung hai nhm ngi dng mi cng danh sch cc thnh vin trong nhm: nhm installer vi ch s nhm l 102 v cc thnh vin l cc ngi dng c tn hieu, huy, sang. Tng t l nhm tiengviet vi ch s nhm l 103 v danh sch cc thnh vin l minh, long, dung. y l hai nhm (102, 103) ngi dng h thng. Thm nhm ngi dng mi vi lnh groupadd: # groupadd -r installer Lnh trn s cho php to mt nhm ngi dng mi c tn l installer, tuy nhin cc thnh vin trong nhm s phi b sung bng cch son tho tp tin /etc/group. 4.3.3. Sa i cc thuc tnh ca mt nhm ngi dng (lnh groupmod) Trong mt s trng hp cn phi thay i mt s thng tin v nhm ngi dng bng lnh groupmod vi c php nh sau: groupmod [ty-chn] <tn-nhm> Thng tin v cc nhm xc nh qua tham s tn-nhm c iu chnh. Cc ty chn ca lnh: -g, gid thay i gi tr ch s ca nhm ngi dng. -n, group_name thay i tn nhm ngi dng. 4.3.4. Xa mt nhm ngi dng (lnh groupdel) Nu khng mun mt nhm no tn ti na th ch vic xa tn nhm trong tp tin /etc/group. Nhng phi lu rng, ch xa c mt nhm khi khng c ngi dng no thuc nhm na. Ngoi ra c th s dng lnh groupdel xa mt nhm ngi dng. C php lnh: groupdel <tn-nhm> Lnh ny s sa i cc tp tin ti khon h thng, xa tt c cc thc th lin quan n 107

Linux-VN, cc lnh c bn

nhm. Tn nhm phi thc s tn ti. 4.4. Cc lnh c bn khc c lin quan n ngi dng Ngoi cc lnh nh thm ngi dng, xa ngi dng ..., cn c mt s lnh khc c th gip ch rt nhiu nu ang lm vic trn mt h thng a ngi dng. 4.4.1. ng nhp vi t cch mt ngi dng khc khi dng lnh su i lc mun thc hin lnh nh mt ngi dng khc v s dng cc tp tin hay thit b thuc quyn s hu ca ngi dng . Lnh su cho php thay i tn ngi dng mt cch hiu qu v cp cho cc quyn truy nhp ca ngi dng . C php lnh: su <ngi-dng> Nu ng nhp vi t cch ngi dng bnh thng v mun tr thnh siu ngi dng (root) dng lnh sau: # su root Khi h thng s yu cu nhp mt khu ca siu ngi dng. Nu cung cp ng mt m, th s l ngi dng root cho ti khi dng lnh exit hoc CTRL+d ng xut ra khi ti khon ny v tr v ng nhp ban u. Tng t, nu ng nhp vi t cch root v mun tr thnh ngi dng bnh thng c tn l newer th hy g lnh sau: # su newer s khng b hi v mt khu khi thay i t siu ngi dng sang mt ngi dng khc. Tuy nhin nu ng nhp vi t cch ngi dng bnh thng v mun chuyn i sang mt ng nhp ngi dng khc th phi cung cp mt khu ca ngi dng . 4.4.2. Xc nh ngi dng ang ng nhp (lnh who) * Lnh who l mt lnh n gin, cho bit c hin ti c nhng ai ang ng nhp trn h thng vi c php nh sau: who [ty-chn] Cc tu chn l: -H, --heading hin th tiu ca cc ct trong ni dung lnh. -m hin th tn my v tn ngi dng vi thit b vo chun. -q, --count hin th tn cc ngi dng ng nhp v s ngi dng ng nhp. V d: # who
root tty1 Nov 15 03:54

108

Linux-VN, cc lnh c bn

lan pts/0 Nov 15 06:07

# Lnh who hin th ba ct thng tin cho tng ngi dng trn h thng. Ct u l tn ca ngi dng, ct th hai l tn thit b u cui m ngi dng ang s dng, ct th ba hin th ngy gi ngi dng ng nhp. Ngoi who, c th s dng thm lnh users xc nh c nhng ngi ng nhp trn h thng. V d: # users
lan root

# * Trong trng hp ngi dng khng nh ni tn ng nhp trong mt phin lm vic (iu ny nghe c v nh hi v l nhng l tnh hung i lc gp phi), hy s dng lnh whoami v who am i. C php lnh: whoami hoc who am i V d: # whoami
lan

# # who am i
may9!lan pts/0 Nov 15 06:07

# Lnh who am i s hin kt qu y hn vi tn my ng nhp, tn ngi dng ang ng nhp, tn thit b v ngy gi ng nhp. * C mt cch khc xc nh thng tin ngi dng vi lnh id C php lnh: id [ty-chn] [ngi-dng] Lnh ny s a ra thng tin v ngi dng c xc nh trn dng lnh hoc thng tin v ngi dng hin thi. Cc tu chn l: -g, --group 109

Linux-VN, cc lnh c bn

ch hin th ch s nhm ngi dng. -u, --user ch hin th ch s ca ngi dng. --help hin th trang tr gip v thot. V d: # id
uid=506(lan) gid=503(lan) groups=503(lan)

# # id -g
503

# # id -u
506

# # id root
uid=0(root)gid=0(root)groups=0(root),1(bin),2(daemon),

3(sys),4(adm),6(disk),10(wheel) # 4.4.3. Xc nh cc tin trnh ang c tin hnh (lnh w) Lnh w cho php xc nh c thng tin v cc tin trnh ang c thc hin trn h thng v nhng ngi dng tin hnh tin trnh . C php lnh: w [ngi-dng] Lnh w a ra thng tin v ngi dng hin thi trn h thng v tin trnh h ang thc hin. Nu ch ra ngi dng trong lnh th ch hin ra cc tin trnh lin quan n ngi dng . V d: # w
root tty2 - 2:14pm 13:03 9.30s 9.10s /usr/bin/mc -P lan pts/1 192.168.2.213 3:20pm 0.00s 0.69s 0.10s w root pts/2 :0 3:33pm 9:32 0.41s 0.29s /usr/bin/mc -P

110

Linux-VN, cc lnh c bn

Chng 5. Cc lnh qun l thit b ngoi vi 5.1. Gii thiu v cch thc Linux qun l thit b ngoi vi Trong mt h thng my tnh, CPU l thit b trung tm nhng khng phi l thit b iu khin duy nht, mi thit b vt l u c b iu khin ring. Bn phm, chut, cc cng tun t c iu khin bi mt SuperIO chip. Nhng a IDE, SCSI c iu khin bi b iu khin IDE, SCSI tng ng, v..v. Mi b iu khin phn cng u c nhng thanh ghi trng thi (CSRs) ring v chng khc nhau cho cc thit b khc nhau. Cc CSR dng khi ng, dng v khi sinh thit b, ngoi vic c nhng vo cc ng dng chng cn c lu tr trong nhn Linux. Trong phn ny, chng ta s xem xt vic Linux iu khin cc thit b phn cng nh th no. Linux cho php chng ta c quyn iu khin phn cng ca h thng (Tng t nh Contronl Panel ca Windows). Tuy nhin, vic truy cp v iu khin cc thit b phn cng khng d nh trong Windows, mc d n t ra kh c ng v khng phi bo tr nhiu mt khi xc lp. Trong mt s trng hp phi bin dch li nhn nu mun b sung phn cng mi vo h thng. Cc CD-ROM, sound card bt buc phi lm vy. Nhng modem, thit b chut hoc cc a cng th c th khng cn thit. Mi thit b ngoi vi mun c dng th cn phi c nhng trnh iu khin thit b i km. Phn mm dng iu khin thit b gi l device driver. Trong Linux, cc device driver ca nhn Linux thc cht l th vin dng chung, thng tr trong b nh hoc l cc trnh iu khin phn cng mc thp. Tt c cc thit b phn cng u c xem nh l cc tp tin thng thng, chng c th c m, ng, c, ghi bng cch s dng cc li gi h thng ging nh cc li gi h thng qun l tp tin. Mi thit b c biu din nh l mt thit b tp c bit (device special file). V d: nh thit b a IDE th nht trong h thng c biu din bi /dev/hda. i vi cc thit b khi (disk) v thit b k t (character device) th cc thit b tp c bit ca chng c khi to bi lnh mknod v chng m t thit b bng cch s dng cc s hiu chnh (major device number) v s hiu nh (minor device number). Thit b mng cng c biu din nh l mt tp tin thit b c bit, nhng chng c Linux khi to khi khi sinh b iu khin mng trong h thng. Cc thit b c iu khin bi mt b iu khin chung (driver) s c gn mt s (nh danh) chung gi l s hiu chnh. Cc thit b c phn bit thng qua mt s gi l s hiu nh. V d, mi phn vng (partition) trn mt a cng c mt s hiu nh ca mnh, vy /dev/hda2 (partition th hai trn a cng IDE th nht) c s hiu chnh cho c thit b l 3 v s hiu nh phn bit l 2. Linux nh x mt tp tin thit b ln mt driver thit b nh s dng s hiu chnh ca thit b v s hiu ca bng h thng. Linux h tr 3 loi thit b: Thit b k t, thit b khi v thit b mng. Thit b k t, tng ng vi cc tp tin c bit trong ch k t (Character Mode): Cc tp tin ny tng ng vi cc thit b ngoi vi khng c cu trc, chng hn nh cc cng song song hoc ni tip m trn d liu c th c c v ghi theo tng byte hoc dng byte. Thit b kiu khi, tng ng vi cc tp tin c bit trong ch khi (Block Mode): Cc tp tin ny tng ng vi cc thit b ngoi vi c cu trc dng khi 111

Linux-VN, cc lnh c bn

nh a, c kiu truy cp bng cch cung cp mt s khi c hoc ghi. Cc thao tc nhp/xut ny c thc hin thng qua mt vng m (Buffer Cache) v c th truy nhp trc tip ti tng khi (Block) trn thit b. Thit b mng c th truy cp thng qua giao din socket BSD. Mi tp tin c bit s c Linux m t theo ba thuc tnh sau: Kiu tp tin (khi hoc k t). S hiu chnh ca tp tin, i din cho trnh iu khin ang iu khin thit b. S hiu th cp ca tp tin, cho php trnh iu khin nhn bit thit b vt l m n s hot ng trn . Thng thng cc tp tin thit b c nh v trong th mc /dev. Cc thao tc nhp/xut vo thit b c thc hin thng qua nhng li gi h thng nh nhng thao tc nhp/xut tp tin thng thng. Mi thit b ngoi vi c m bi li gi open bng cch ch nh tn tp tin c bit tng ng. Nhn s tr v mt trnh m t nhp/ xut tng ng vi thit b, v tin trnh gi c th truy cp n bng cc lnh h thng read, write. Sau khi hon thnh cng vic th li gi close s c s dng tt thit b. Linux thng s dng hai bng lu tr danh sch cc thit b h tr, l: blkdevs cha cc chng trnh m t hay cc thit b trong ch khi, chrdevs dnh cho cc thit b c th truy cp trong ch k t. Tp tin ngun fs./devices.c cha cc hm qun l cc thit b h tr. Cc hm register_blkdevs v register_chrdevs cho php ng k cc trnh iu khin thit b vo cc bng tng ng. Cc hm unregister_blkdev v unregister_chrdevs c nhim v xo mt ng k c trong cc bng tng ng. Cc hm blkdev_open v chrdev_open s m nhim vic m mt thit b c ng k. Cc hm get_blkfops v get_chrfops tr v mt con tr tr vo cc thao tc tp tin kt hp vi mt thit b nh get_blkfops, sau gi li gi release. ... Chng ny s ln lt gii thiu n cc tng loi cc thit b: cng, cc cng ni tip cng modem, cc cng song song cng my in v mt t v thit b mng, card sound ... Vi mc ch l hng dn ph dng nht, cc ni dung di y ch dng li mc s dng v cha i su vo nghin cu cc can thip thit b m mc nhn. 5.2. Cc cch qun l thit b lu tr trong Linux Linux c cch iu khin cc thit b rt khc bit so vi cc h iu hnh khc. S khng c cc tn thit b lu tr vt l nh A hay C ..., m lc , cc thit b lu tr ny s tr thnh mt phn ca h thng tp tin cc b thng qua mt thao tc c gi l "kt gn - mounting". Khi ang s dng thit b lu tr , mun tho b phi "tho b kt gn - umount" thit b. 112

Linux-VN, cc lnh c bn

5.2.1. Lnh mount v lnh umount * Lnh mount * Lnh mount c dng thng bo cho nhn h thng bit l tn ti mt h thng tp tin no (ang nm ring r v khng th truy cp c) mun kt ni vo h thng tp tin chnh ti mt im gn no (mount-point). im gn thng l mt th mc ca h thng tp tin chnh v c th truy cp d dng. s dng bt k mt thit b lu tr vt l no trn Linux, u cn n lnh mount. im gn kt l th mc /mnt. V d, nu mun s dng a mm v a CD, hy gn chng vo hai th mc /mnt/floppy v /mnt/cdrom bng hai lnh sau: # mount -t msdos /dev/fd0 /mnt/floppy # mount /dev/cdrom /mnt/cdrom C php lnh mount: mount [ty-chn] <tp-tin-thit-b> <th-mc> Lnh ny thng bo cho nhn h thng thc hin vic kt gn h thng tp tin c trn tp-tin-thit-b (thit b ny c kiu no ) vo th mc (im kt gn) l th-mc. Cc tu chn ca lnh mount: -t <kiu> xc nh kiu ca thit b (chng hn msdos nh v d trn): kiu cng c s dng xc nh kiu h thng tp tin. Cc kiu h thng tp tin hin thi c h tr c trong tp tin Linux/fs/filesystems.c -h a ra trang tr gip. -a gn kt tt c cc tp tin h thng (thuc kiu c a ra) c trong tp tin fstab (y l tp tin lu tr thng tin v trng thi ca cc tp tin h thng). -n gn kt h thng tp tin m khng ghi vo tp tin /etc/mtab (y l tp tin lu tr thng tin v cc tp tin h thng hin c trn h thng). Ty chn ny cn thit khi h thng tp tin /etc ch cung cp quyn c. -r kt gn h thng tp tin ch c quyn c. -w kt gn h thng tp tin c quyn c ghi. 113

Linux-VN, cc lnh c bn

-L nhn kt gn phn vng c ch ra bi nhn. -U uuid kt gn phn vng c xc nh bi uuid. Hai ty chn ny ch thc hin c khi tp tin /proc/partitions tn ti (y l tp tin lu tr thng tin v cc phn vng trn h thng) Trn y l cch chnh thc kt gn cc thit b lu tr vt l, nhng c cch thun tin hn. Bnh thng ch c ngi dng root mi c quyn gn kt cc thit b, mi ngi dng khc c th kt gn a mm hoc cdrom chng hn, hy thc hin nh sau: - vi t cch ngi dng root, hy g cc lnh cp cho mi ngi dng cc quyn truy nhp ti hai th mc l im kt gn vi hai thit b a mm v cdrom # chmod a+rwx /mnt/floppy ; /mnt/cdrom cp cho mi ngi dng quyn c v ghi i vi hai th mc lu tr thit b trn h thng # chmod a+rw /dev/fd0 ; /dev/cdrom - thm cc dng sau vo tp tin /etc/fstab /dev/cdrom /mnt/cdrom iso9660 ro, user, noauto 0 0 /dev/fd0 /mnt/floppy vfat user, noauto 0 0 - by gi mi ngi dng u c th kt gn n a mm v cdrom # mount /mnt/floppy # mount /mnt/cdrom Cn ghi nh rng, vic cho php mi ngi dng c th mount c thit b a ca mnh l iu rt nguy him, v iu c lin quan n vn bo mt. Lnh umount Lnh umount cho php tho b kt gn ca mt h thng tp tin trn h thng tp tin chnh bng lnh umount vi tham s i km l tn ca thit b lu tr h thng tp tin . C php lnh: umount <thit-b> Lnh ny s tho b kt gn ca h thng tp tin c trn thit-b ra khi h thng tp tin chnh. Ch rng, khng th tho b kt gn ca mt h thng tp tin khi n bn tc l khi c mt tin trnh ang hot ng truy cp n cc tp tin trn h thng tp tin . 114

Linux-VN, cc lnh c bn

Cc tu chn lnh: -h hin th thng bo tr gip v thot. -n loi b cc gn kt m khng ghi vo th mc /etc/mtab. -v hin cc ch lin quan. -r trong trng hp loi b gn kt b li, ty chn ny s gip to li gn kt vi ch ch c. -a tt c cc tp tin h thng c hin th trong /etc/mtab c loi b cc gn kt. -t kiu ty chn ny cho php xc nh kiu h thng tp tin c tho b kt gn. C th kt hp nhiu kiu h thng tp tin cng lc bng cch ngn chng bi du ",". -f bt buc phi tho b cc gn kt. V d khi khng dng n a mm na, c th dng lnh sau: # umount /mnt/fd0 Khi mt h thng tp tin c gn kt (dng lnh mount), nhng thng tin quan trng v s cc tp tin trn h thng tp tin c lu trong nhn. Nu loi b thit b vt l cha h thng tp tin m khng tho b kt gn (dng lnh umount) c th dn ti thng tin lu v h thng tp tin b tht lc. Mc ch ca lnh umount l xa b mi thng tin ra khi b nh khi khng dng n na. 5.2.2. Cc lnh nh dng a v to h thng tp tin trong Linux nh dng vt l mt thit b a l mt chuyn, to mt tp tin h thng trn n li l mt chuyn khc. Nu nh trong DOS, lnh FORMAT A: thc hin c hai cng vic trn th trong Linux, l hai lnh ring bit. Sau y l mt s lnh gip nh dng thit b lu tr vt l ca mnh. * a cng a cng phi c phn hoch trc khi c th nh dng v s dng n. Tng t nh DOS, trong Linux c fdisk. Trong Linux c th to cc kiu phn hoch khc nhau, mi phn hoch c gn vi mt ch s (index: ID) thng bo cho h iu hnh bit kiu phn hoch ca n. Dng cc lnh sau thc hnh: 115

Linux-VN, cc lnh c bn

# su
passwd:

# fdisk /dev/hda
Command (m for help):

Lnh trn bo cho fdisk bit s lm vic vi loi a no. Nu dng a kiu SCSI th hda s c thay bng sda. xem cc lnh ca fdisk, hy nh "m. # fdisk /dev/hda
Command (m for help):m

Hnh ng lnh
a b c d l m n o p q s t u v w x bt/tt c c th boot c hiu chnh loi thit b lu tr bsd bt c tng thch vi thit b kiu DOS xo mt phn vng danh sch cc kiu phn vng sn c hin th trang tr gip ny thm mt phn vng mi to mt bng phn vng DOS trng hin th bng phn vng trn h thng thot v khng ghi mi s thay i to mt phn vng cho loi thit b lu tr SUN thay i ch s phn vng h thng thay i cc n v hin th kim tra bng phn vng ghi s thay i trn bng phn vng v thot cc tnh nng m rng (ch dnh cho cc chuyn gia)

Command (m for help):p Disk /dev/hda: 64 heads, 63 sectors, 847 cylinders Units = cylinders of 4032 * 512 bytes Device /dev/hda1 /dev/hda2 Boot * Start 1 818 End 817 847 Bloocks 1647040+ 60480 Id 83 82 System Linux Linux swap

Command (m for help):q

116

Linux-VN, cc lnh c bn

# Cc ct thng bo trn y c ngha nh sau: Ct Device c mc thit b dnh cho phn vng trong /dev, chng hn /dev/hda1. Ct Boot ch xem phn vng c kh nng khi ng hay khng, nu c kh nng khi ng th c du '*. Ct Start, End ch ra ch s tr (cylinder) u v cui ca phn vng. Ct Bloocks ch ra dung lng ca phn vng (l s lng tnh theo khi 1KB). Ct Id v System ch s ID v ngha ca ID , v d ID = 82 c ngha l Linux swap. Lnh l a ra danh sch cc kiu phn vng sn c vi thng tin chi tit hn. Sau khi thc hin lnh fdisk, hy s dng lnh mkfs vi t cch root ri nh dng phn vng theo mt h thng tp tin c th (file system). * Xy dng mt h thng tp tin trn Linux vi lnh mkfs C php lnh: mkfs [ty-chn] <h-thng-tp-tin> [khi] Lnh mkfs thng c s dng xy dng mt h thng tp tin trn thit b, thng l phn vng a cng. h-thng-tp-tin hoc l tn thit b (v d /dev/hda1, /dev/sdb2) hoc l im kt ni tp tin h thng (v d /, /usr, /home); khi l s khi c s dng cho h thng tp tin. -t kiu ty chn ny xc nh kiu tp tin h thng c xy dng. Nu khng c ty chn ny, kiu tp tin h thng mc nh s c s dng (hin ti l kiu ext2). -c kim tra thit b tm ra cc khi hng trc khi xy dng h thng tp tin. Gi y sau khi xc lp xong phn hoch, v h tp tin dng trn , c th rp ni v bt u dng h tp tin. Hy ng nhp vi t cch qun tr (ngi dng root) v dng lnh mount. Sau khi s dng xong c th tin hnh tho kt ni vi lnh umount. * nh dng mc thp mt a mm (lnh fdformat) C php lnh nh dng mc thp mt a mm: fdformat [-n] thit-b Lnh fdformat thc hin vic nh dng mt a mm mc thp. Tham s thit-b 117

Linux-VN, cc lnh c bn

thng l mt trong cc loi sau (ch nh dng vi a mm, vi ch s thit b l major=2 - y l ch s xc nh kiu ca thit b, v minor - ch s xc nh s ca thit b trong trng hp c nhiu thit b cng loi):
/dev/fd0d360 (minor = 4) /dev/fd0h1200 (minor = 8) /dev/fd0D360 (minor = 12) /dev/fd0H360 (minor = 12) /dev/fd0D720 (minor = 16) /dev/fd0H720 (minor = 16) /dev/fd0h360 (minor = 20) /dev/fd0h720 (minor = 24) /dev/fd0H1440 (minor = 28) /dev/fd1d360 (minor = 5) /dev/fd1h1200 (minor = 9) /dev/fd1D360 (minor = 13) /dev/fd1H360 (minor = 13) /dev/fd1D720 (minor = 17) /dev/fd1D720 (minor = 17) /dev/fd0H720 (minor = 16) /dev/fd1h360 (minor = 21) /dev/fd1h720 (minor = 25) /dev/fd1H1440 (minor = 29)

Cc ty chn lnh: -n cho php b qua cc kim tra c thc hin sau khi nh dng a. Cc a mm, /dev/fd0 v /dev/fd1, s gp li nu dng lnh format khi kiu nh dng l khng chun. * Thm h thng tp tin vo a mm c nh dng vi lnh mformat Lnh mformat c s dng thm mt h thng tp tin MS-DOS vo mt a mm nh dng cp thp vi c php l: mformat <cc-ty-chn> <-a>: mformat thm mt h thng tp tin MS-DOS ti thiu (boot sector, FAT, v th mc gc) ln mt a nh dng bng mt nh dng cp thp. Cc ty chn sau c h tr (Tu chn -S, -2, -1 v -M c th khng c nu bn mtools c bin dch khng c tu chn USE_2M): 118

Linux-VN, cc lnh c bn

-t s-tr s lng cc tr (cylinders). -h s-mt s lng cc mt a (heads). -s s-sector s lng cc sectors trn mi rnh (track). Nu tu chn 2m c t trc, l s lng sector 512 byte tng ng vi cc track cng loi (tc l khng c head 0, track 0). Nu tu chn 2m khng c t, l s lng cc sector vt l trn mi rnh (sector c th ln hn 512 byte). -l tn-nhn-a tu chn tn nhn a. -S m-kch-thc Kch thc ca sector l 2^ (m-kch-thc +7). -2 sector-00 nh dng 2m. Tham s ca tu chn ny (sector-00) miu t s lng cc sector trn rnh 0, mt 0. Tu chn ny thng dng cho cc sector ln hn thng thng. -1 khng s dng nh dng 2m, thm ch khi kiu a (geometry) hin thi l kiu nh dng 2m. -M c-mm kch thc sector phn mm l c-mm. Tham s ny m t kch thc sector trong cc byte c s dng bi h thng tp tin MS-DOS. Trong ch ngm nh th y l kch thc vt l ca sector. -X nh dng a nh mt a XDF (1 loi nh dng a dung lng ln c s dng bi OS/2). Cc a c nh dng cp thp s dng tin ch xdfcopy nm trong gi (package) fdutils. -C to tp tin nh a ci t h thng tp tin MS-DOS trn . R rng, iu ny v dng trn cc thit b vt l chng hn cc a mm v cc phn vng cng. -H lng-b-che s lng cc sector n l lng-b-che. Tham s ny rt hu ch cho vic nh dng cc phn vng cng, vi cc ng bin rnh khng c sp 119

Linux-VN, cc lnh c bn

thng hng. (Chng hn, mt u tin ca rnh u tin khng thuc phn vng nhng li cha mt bng phn vng). Trong trng hp ny, s lng ca cc sector n chung vi s lng cc sector trn tr. iu ny ang c kim chng. -n s serial. -F nh dng phn vng nh FAT32 (thc nghim). -I phin-bn t phin-bn (fsVersion ID) khi nh dng mt a FAT32. nhn bit c iu ny, chy minfo trn mt a FAT32 ang tn ti. -c di-clustor t kch thc ca mt cluster (theo sector) l di-clustor. Nu kch thc cluster ny to ra mt bng FAT qu ln vi s lng cc bit ca n, mtools s t ng tng kch thc cluster, cho n khi bng FAT nh xung ph hp. -r c-gc t kch thc ca th mc gc l c-gc (theo sector). Ch thch hp cho bng FAT 12 bit v 16 bit. -B boot-sector s dng boot sector c lu trong tp tin hay device cho trc (theo tham s boot-sector), thay v s dng boot sector ca n. Ch c cc trng nh dng c cp nht ph hp vi cc tham s a ch. -k gi cc boot sector ang tn ti cng nhiu cng tt. Ch c cc trng nh dng c cp nht ph hp cc tham s a ch. -0 t-l-0 t t l chuyn d liu trn rnh 0 l t-l-0. -A t-l t t l chuyn d liu trn cc rnh khc rnh 0 l t-l. nh dng mt a c mt khc ngm nh, phi cung cp (t nht) cc tham s dng lnh khc vi ngm nh trn y. 5.2.3. Lnh qun l a * Xem dung lng a s dng vi lnh du: Linux cho php ngi dng xem thng tin v dung lng a c s dng bng lnh 120

Linux-VN, cc lnh c bn

du vi c php: du [ty-chn] ... [tp-tin] ... Lnh du lit k kch thc (tnh theo kilobytes) ca mi tp tin thuc vo h thng tp tin c cha tp-tin c ch trong lnh. Cc tu chn l: -a lit k kch thc ca tt c cc tp tin c trong h thng tp tin lu tr tptin. -b, --bytes hin th kch thc theo byte. -c, --total hin th c tng dung lng c s dng trong h thng tp tin. -D, --dereference-args khng tnh kch thc cc tp tin c lin kt n nu chng nm trn cc th mc khc. -h, --human-readable hin th kch thc cc tp tin km theo n v tnh (v d: 1K, 234M, 2G ... ). -k, --kilobytes hin th kch thc tnh theo kilobytes. -L, --dereference tnh c kch thc ca cc tp tin c lin kt ti. -l, --count-links tnh kch thc cc tp tin nhiu ln nu c lin kt cng. -m, --megabytes tnh kch thc theo megabytes. -S, --separate-dirs khng hin th kch thc ca th mc con. -s a ra kch thc ca h thng tp tin c lu tr tp-tin. -x, --one-file system b qua cc th mc trn cc h thng tp tin khc. --help 121

Linux-VN, cc lnh c bn

hin th trang tr gip v thot. Cn lu rng, lnh du khng cho php c nhiu ty chn trn cng mt dng lnh. V d: lnh sau cho bit kch c ca cc tp tin trong th mc /usr/doc/test: # du /usr/doc/test
28 24 16 12 144 44 160 56 532 ./TODO/1.0_to_1.5 ./TODO/lib++ ./TODO/unreleased ./TODO/unstable ./TODO ./code ./languages ./licences .

Nhn vo mn hnh c th bit c kch thc ca tp tin ./TODO/1.0_to_1.5 l 28 KB, tp tin ./TODO/lib++ l 24 KB, ..., v kch thc ca th mc hin thi l 532 KB. * Kim tra dung lng a trng vi lnh df: C php lnh: df [ty-chn]... [tp-tin]... Lnh ny hin th dung lng a cn trng trn h thng tp tin cha tp-tin. Nu khng c tham s tp-tin th lnh ny hin th dung lng a cn trng trn tt c cc h thng tp tin c kt ni. Cc ty chn l: -a, --all bao gm c cc tp tin h thng c dung lng l 0 block. --block-size=c thit lp li ln ca khi l c byte. -k, --kilobytes hin th dung lng tnh theo kilobytes. -l, --local gii hn danh sch cc tp tin cc b trong h thng. -m, --megabytes hin th dung lng tnh theo megabytes. -t, --type=kiu 122

Linux-VN, cc lnh c bn

gii hn danh sch cc tp tin h thng thuc kiu. -T, --print-type hin th cc kiu ca tp tin h thng. --help a ra trang tr gip v thot. ch ra c dung lng a cn trng trong Linux khng phi l iu d lm. Ngi dng c th s dng lnh df lm c iu ny, tuy nhin kt qu ca lnh ny ch cho bit dung lng a c s dng v dung lng a cn trng ca tng h thng tp tin. Nu mun bit tng dung lng a cn trng l bao nhiu, s phi cng dn dung lng a cn trng ca tng h thng tp tin. V d, lnh # df /mnt/floppy s cho kt qu nh sau trn mn hnh (dng u tin l tn ct):
Filesystem /dev/hda2 none none automount(pid411) /dev/fd0 1k-blocks Used 2174808 1378228 0 0 0 1423 0 0 0 249 Available Use% Mounted on 686104 0 0 0 1174 67% 18% / /proc /dev/pts /misc /mnt/floppy

c th xc nh c, a mm c s dng 18%, nh vy l cn 82% (tc l cn 1174 KB) dung lng a cha c s dng. Ct Filesystem cha tn ca thit b a, ct 1k-blocks cha dung lng ca thit b, ct Used cha dung lng a c s dng, ct Available cha dung lng a cn trng, ct Use% cha % dung lng a s dng v ct Mounted on cha im kt gn ca thit b. Cch nhanh nht bit c dung lng a cn trng bao nhiu l phi xc nh c tn ca mt th mc bt k c trong a , s dng lnh df vi tham s tp-tin l tn ca th mc. Sau c ni dung ct Available trn mn hnh hin th bit dung lng a cn trng. Chng hn, trn a cng ang s dng c th mc /etc, khi g lnh: # df /etc kt qu hin th ln mn hnh nh sau:
Filesystem /dev/hda1 1k-blocks 1984240 Used 1417192 Available 466252 Use% 75% Mounted on /

cho bit a cn c 466252 khi ri.

123

Linux-VN, cc lnh c bn

5.3. Cc cng ni tip v modem Cc cng ni tip, v d COM1 trong DOS hoc Window, c Linux xem l /dev/ttyS0 v /dev/ttyS dnh cho d liu n v /dev/cua dnh cho d liu i. xc lp trong nhn kiu Modem hin c, s dng chng trnh setserial. Trong qu trnh khi ng bnh thng th cc cng ni tip s s dng nhng a ch cng vo/ra v cc IRQ mc nh. Tuy nhin thay i nhng gi tr ny ta c th s dng setserial. Chng trnh /etc/rc.d/rc.serial t ng xc lp hu ht cc modem mi khi khi ng. V d: # setserial b/dev/cua0 irq 15 autoconfig Lnh trn s t li ngt dng cho d liu i ca COM1 l IRQ15. Sau khi xc lp modem, c th s dng mt s tin ch quay s nh minicom, seyon ... 5.4. Cc cng song song v my in s dng my in, phi m bo c phn h tr my in trong nhn v m bo IRQ my in (7) bnh thng cha c thit b khc s dng. Nu my in nm trn cng song song u tin, vi t cch siu ngi dng, c th nhp lnh di y m bo phn mm my in v cc tuyn giao kt lm vic tt. 5.4.1. Khi to v thit lp my in trong lpd Vic s dng my in c th gy rc ri cho ngi dng. Tuy nhin nu quan tm thm mt s hiu bit v phn cng, ngi dng cng c th thit lp cu hnh cho my in mt cch d dng. Hu ht cc my in trn h thng Linux u c iu khin bi mt chng trnh chy ngm c gi l daemon lpd: chng trnh ny c khi ng cng vi h thng. Trong sut qu trnh khi ng, daemon lpd s c tp tin /etc/printcap (tp tin ny lu tr thng tin v my in c thit lp trn h thng) nhn dng cc phn c p dng cho bt k my in no gn vo h thng. Ni chung, khng cn thay i daemon lpd, tuy nhin i lc cn phi np li n. Lnh np daemon ny l lpd. C php lnh: lpd [-l] [port#] Cc tham s: -l Tu chn cho php kch hot h thng ghi nht k lu n mi yu cu ca my in. Tu chn ny s hu ch khi ang g ri h thng my in. port# xc nh s cng Internet c s dng kim tra thng tin cu hnh ca h thng c b ghi khng. 124

Linux-VN, cc lnh c bn

Vic ci t lpd kh n gin, n cho php c th gi li cc tp tin trong hng i in v t t in chng. Tuy nhin khi gp rc ri, lpd s khng gi thng bo no cho ngi dng, v iu c th gy kh khn cho ngi dng, nhng y l bc khi u tm hiu v cng vic in n. V c bn, thm mt my in vo h thng lpd, phi thm mt u vo my in vo trong tp tin /etc/printcap, v to mt th mc hng i nh: /var/spool/lpd. Mt u vo trong tp tin /etc/printcap c dng sau (du hng ro # ti dng u tin gii thch cho u vo, khng phi l du nhc shell): # LOCAL djet500
lp|dj|deskjet:\ :sd=/var/spool/lpd/dj:\ :mx#0:\ :lp=/dev/lp0:\ :sh:

Cc dng trn nh ngha mt hng i in gi l lp, dj hoc deskjet, th mc hng i l: /var/spool/lpd/dj v khng gii hn kch thc ln nht i vi mi cng vic in n, s dng thit b my in /dev/lp0, v khng c l v khng thm tn ca ngi in vo trc mi trang in. hiu thm chi tit v cc u vo cn c trang man v tp tin printcap. nh ngha trn nhn c v rt n gin, nhng s c mt vng mc kh chu (tr khi gi mt tp tin m my DeskJet 500 c th hiu c) l DeskJet 500 s in nhng dng rt l. V d, khi gi mt tp tin vn bn thng thng ca Linux ti DeskJet 500, kt qu l n in ra nhng dng mi nh sau:
This is line one. This is line two. This is line three.

Khi gi mt tp tin PostScript ti hng i in th hng i s tip nhn c mt danh sch lnh PostScript. Hng i c in ra vi hiu ng bc thang (t lnh PostScript) tuy nhin li khng c xy ra iu g i vi cc trang in i vi my in Postscript (nh DeskJet 500, chng hn). Nh vy, cn phi thm vo mt b phn vi chc nng lc. Khi c trang man v tp tin printcap, cn lu n hai thuc tnh if v of. if (input filter) chnh l b phn cn c b sung trong trng hp ni trn. Trong trng hp vit mt on chng trnh lc nh bng shell script th on chng trnh ny s iu khin vic tr v mt dng mi khi in v lc hiu ng bc thang s c loi b. Do vy, phi thm vo dng if trong u vo printcap trn nh di y:
lp|dj|deskjet:\

125

Linux-VN, cc lnh c bn

:sd=/var/spool/lpd/dj:\ :mx#0:\ :lp=/dev/lp0:\ :if=/var/spool/lpd/dj/filter:\ :sh:

Sau y l v d v mt on chng trnh lc n gin:


#!perl # The above line should really have the whole path to perl # This script must be executable: chmod 755 filter while(<STDIN>){chop $_; print "$_\r\n";}; # You might also want to end with a form feed: print "\f";

Khi hon thin cc vic nh trn, chng ta c mt hng i in cho php in cc tp tin vn bn thng thng theo ng ngha ca n. Ch cn mt vn l khi in n vn bn thun ty th khng nhanh bng khi in PostScript v cc kiu ha hay nh dng khc. Vn ny rt d gii quyt bng phng thc n gin l m rng vo b lc trn. Nu vit mt b lc c th chp nhn cc loi tp tin l u vo v a ra u ra cho mi trng hp, khi s c mt hng i in thng minh hn. Nhng b lc nh vy gi l magic filter. Khng nn v c vit cc b lc ny tr khi my in in ra nhng du hiu l. C rt nhiu cc b lc c vit sn trn mng. ASP l mt trong s nhng b lc tt nht, hoc h thng Linux ang sr dng c sn cng c ci t my in s t ng to ra cc b lc nh vy. C mt iu lu i vi cc b lc: mt vi phin bn c ca lpd khng chy cc b lc if i vi cc my in mng. 5.4.2. Cc lnh in n c bn Phn ny trnh by cc cch thc lm vic vi my in, v nh, lm nh th no bit c my in no kt ni trn h thng, lm th no a d liu cn in ra my in, lm th no kim tra hay xa b cc d liu trong hng i in v.v. thng qua vic gii thiu mt s lnh c bn lm vic vi my in. * In mt tp tin vi lnh lpr Phng php n gin nht in trn h thng Linux l gi cc tp tin cn in trc tip ti thit b in n (my in). Vi t cch ngi s dng root, c th dng lnh cat thc hin c phng pho : # cat thesis.txt > /dev/lp Trong lnh ni trn, /dev/lp l mt lin kt tnh n mt my in thc s nh: my in ma trn im, my in laser .v.v. Do vn bo mt, ch ngi s dng root v nhng ngi s dng cng nhm mi c quyn a thng tin trc tip ti my in. 126

Linux-VN, cc lnh c bn

Linux cho php s dng cc lnh lpr, lprm, lpq in n vn bn m khng i hi vn bo mt qu cht ch. Cng do chnh vn bo mt, ngi s dng thng thng phi dng lnh lpr in cc tp tin. Khi lnh lpr c chy, u tin lnh sao chp mt bn ca tp tin cn in vo th mc hng i in, ti y tp tin ny s c lu gi n khi chng c a ra my in. Khi mt tp tin trn hng i c lt in, lpd s sao chp mt bn sao ca tp tin v chnh bn sao mi c in ra trong khi bn chnh thc vn nm trong hng i in. Chnh cch thc nh vy to ra tnh hung c th c rt nhiu cng vic in n c i ti mt thi im. C php lnh: lpr [ty-chn] [tp-tin] Nu tp-tin khng c trong lnh, lpr s in ra mi th ti u vo chun (thng thng l bn phm hoc u ra ca chng trnh khc). Vic ny cho php ngi s dng iu hng cc u ra ca lnh ti hng i in. V d: # cat thesis.txt | lpr hoc # lpr -160 thesis.txt Lnh lpr chp nhn mt vi lp tu chn cho php ngi s dng iu khin cng vic in n v di y l mt s ty chn thng dng: Cc ty chn c s dng in cc tp tin khng thuc dng vn bn thng thng: -c in cc tp tin cha d liu c to t cifplot(l). -d in cc tp tin d liu c to t tex(l) (mt kiu vn bn latex, dng DVI t Stanford). -l s dng mt b lc cho php cc k t iu khin s c in ra v ngn chn s ngt trang. -p s dng pr(1) nh dng tp tin (ging nh print). Cc ty chn iu khin vic in n: -P 127

Linux-VN, cc lnh c bn

xc nh my in in. Bnh thng, my in thit lp mc nh, hoc my in c tn l ni dung ca bin mi trng PRINTER c s dng. -m sau khi in xong s gi mt thng bo hon thnh. -r loi b tp tin trn b m khi in xong. Khng s dng kt hp vi tu chn -s v lin quan n vn bo mt. -s to mt lin kt thay v sao chp mt tp tin ti hng i in. Bnh thng khi mt tp tin c in, n s c sao vo b m, nu dng tu chn -s th n s to ra mt lin kt ti tp tin cn in. Khi in, thng qua mi lin kt ny ly d liu. V th, tp tin s khng b thay i hoc b xa b cho n khi n c in xong. Cc ty chn lin quan n vic sao chp, hin th trang in ...: -P my-in xc nh my in s dng l my-in. -#s xc nh s lng bn in l s. V d: # lpr -#2 -sP dj thesis.txt Lnh ny s to ra mt lin kt ca tp tin thesis.txt ti th mc hng i in ca my in dj v s in ra lm 2 bn. -[1234]font ch ra mt font ch c a ln ti mt v tr trong danh sch cc font. Daemon s xy dng mt tp tin .railmag ch ra ng dn ca font . -T tiu- tn tiu trong pr(l) c thay th cho tn tp tin. -i [s-ct] thit lp khong cch gia cc dng, c biu th bng s-ct cc k t trng. -w s thit lp khong cch gia hai t lin tip l s k t rng. * nh dng tp tin trc khi in vi lnh pr S dng lnh lpr th kt qu in ra ni chung l tt, tuy nhin, kt qu c v n iu. Nu 128

Linux-VN, cc lnh c bn

mun c tiu l tn tp tin v s trang trn mi trang in, hay mun nh dng trang in theo mt s c tnh no , cn s dng lnh pr. Khng h tr trc tip cho vic in n, pr l mt lnh gip cho vic nh dng v ngt trang, thng c s dng hin th thng tin trn mn hnh. C php lnh: pr [ty-chn] ... [tp-tin] ... Lnh ny c tc dng chuyn nh dng cc tp tin vn bn sang nh dng ca my in. Cc tu chn thng dng nht: -<s-ct>, --columns=<s-ct> phn ni dung ca tp tin thnh s-ct ct, s hng trong mi ct l nh nhau, ni dung tp tin c bt u theo chiu dc t ct 1 cho n ht, tr khi s dng ty chn -a. -a, --across ty chn ny c s dng kt hp vi -<s-ct>, n c tc dng phn ni dung ca tp tin thnh s-ct ct nhng ni dung tp tin c bt u theo chiu ngang t ct 1, ct 2, ... ri tr v ct 1. -d, --double-space khong cch gia cc dng s tng gp i. -F, -f, --form-feed s dng lnh cng bc in y trang hin ti ra v bt u mt trang mi. -h tiu-, --head=tiu- s dng tiu- t gia thay cho tn tp tin trong u ca mi trang. In mt dng trng khng s dng -h. -l s-dng, --length=s-dng thit lp s dng trong trang (s-dng), ngm nh trong vn bn l 56 dng, vi -F l 63. -t, --omit-header b qua nhng u mc v cc du phn cch trang. V d, gi s c tp tin test c ni dung nh sau: # cat test
PID TTY TIME CMD 1? 2? 3? 00:00:04 init 00:00:00 kflushd 00:00:00 kupdate

129

Linux-VN, cc lnh c bn

4? 5? 6? 330 ? 345 ? 346 ? 355 ? 369 ? 396 ? 449 ?

00:00:00 kpiod 00:00:03 kswapd 00:00:00 mdrecoveryd 00:00:00 portmap 00:00:00 lockd 00:00:00 rpciod 00:00:00 rpc.statd 00:00:00 apmd 00:00:00 automount 00:00:00 syslogd

# pr -2 test
PID TTY TIME CMD 1? 2? 3? 4? 5? 6? 330 ? 00:00:04 init 00:00:00 kflushd 00:00:00 kupdate 00:00:00 kpiod 00:00:03 kswapd 00:00:00 mdrecoveryd 00:00:00 portmap 345 ? 00:00:00 lockd 346 ? 00:00:00 rpciod 355 ? 00:00:00 rpc.statd 369 ? 00:00:00 apmd 396 ? 00:00:00 automount 449 ? 00:00:00 syslogd 458 ? 00:00:00 klogd

2000-11-25 14:21 vd2 Page 1

Lnh trn chia ni dung tp tin test ra lm hai ct ni dung. * Lm vic vi hng i in thng qua lnh lpq Trn mt my tnh c nhn, c th s dng trc tip my in kt ni vo h thng thng qua cc lnh hoc tin ch. Nhng Linux khng cho php iu khin trc tip my in ca ring mi ngi dng. Thay vo , Linux iu khin cc yu cu in thng qua mt hng i, y lu tr danh sch cc tp tin cn in. Khi dng lnh lpr in mt tp tin, yu cu in c b sung vo hng i cc tp tin ang ch in. Yu cu in mi lun c t vo cui ca hng i. hin th danh sch cc n bn nm trong hng i in, s dng lnh lpq, nu khng c tham s my in th lnh a ra danh sch cc n bn trong hng i in ca my in ngm nh. C php lnh: lpq [-l] [-P my-in] [s-hiu-in...] [ngi-dng...] Gii thch v cc tham s: -l 130

Linux-VN, cc lnh c bn

hin th thm thng tin v mi mc nhp trong hng i. Thng th ch c mt thng tin hin th. -P my-in xc nh tn my in mun s dng. V d: # lpq
Rank Owner Job File Total Size 1st root 9 (standard input) 97 bytes 2nd taylor 10 (standard input) 4142 bytes

Mi mt yu cu in u c gn mt s cc thng tin cn thit, sau y l ngha ca chng: Rank V tr ca yu cu in trong hng i Owner Tn ngi dng a ra yu cu in Job S hiu ca cng vic in File Kiu file cn in Total Size Kch thc ca file cn in

gii hn ch a ra cc yu cu in ca mt ngi dng c th, hy xc nh tn ngi dng: # lpq taylor


Rank 1st Owner Job taylor 10 File Total Size standard input 4142 bytes

* Xa b hng i in vi lnh lprm Linux cho php qun l tt h thng in n lpd bao gm c kh nng hu b cc cng vic in n khi chng cn nm trong hng i in bng lnh lprm vi c php: lprm [-P my-in] [-] [s-hiu-in...] [ngi-dng...] Lnh lprm xa b mt hoc nhiu yu cu trn hng i in. Cc tham s c gii thch nh sau: -P my-in Hy vic in cc ti liu trn hng i in ca my-in c ch ra. nu ch mt du tr '- c a ra, lnh lprm hy vic in tt c cc ti liu i in ca ngi dng g lnh ny (Khi ngi dng ng nhp vi t cch root th hy b vic in mi ti liu ang i in). s-hiu-in 131

Linux-VN, cc lnh c bn

cho php hy b mt cng vic in ring bit bng cch ch ra s hiu ca shiu-in (lnh lpq cho bit s hiu ). ngi-dng loi b bt k cng vic no trong hng i in thuc v ngi dng . V d, lnh # lprm -P HPLaserJetIII s xo b tt c ti liu trong hng i ca my in HPLaserJetIII. V d, c dng lnh: # lpq -l
Rank 1st Owner Job taylor 10 File Total Size standard input 4142 bytes

# # lprm -10 Lnh ny hu b cng vic in n c s hiu 10 (yu cu in ca taylor). * Lnh lpc Lnh lpc c s dng iu khin my in v cc dch v lpd. Lnh lpc cho php v hiu ho hoc lm cho c hiu lc i vi my in hay hng i no , sp xp li cc cng vic trong hng i in v gim st trng thi ca cc my in hay hng i ca chng. C php: lpc [ty-chn][lnh [i-s ...] ] Lnh ny khi ng chng trnh lpc. Ngm nh, c th s dng lnh ny ch tng tc v c th bt u cc lnh lm vic vi lpc. Cc la chn khc c s dng vi lnh lpc trong chng trnh lpc cng nh trong ch tng tc. Tham s ca lnh lpc rt phong ph (tham kho trang man ca lnh lpc c c ni dung y ), y gii thiu nhng ni dung thng dng nht. Cc lnh trong lpc: ?[command...] hoc help[command...] cho mt s m t ngn gn v mi lnh c ch ra trong danh sch cc i s hoc cc i s khng c a ra th danh sch cc lnh c b qua. abort {all | printer} lnh ny gn ging lnh stop, iu khc y l n khng cho php bt k ti liu no hin ang c in dng li trc khi my in ngng. Bt k ti liu no chm dt bt thng bi lnh abort u xp hng li khi khi ng li 132

Linux-VN, cc lnh c bn

my in. clean {all | printer} loi b mi ti liu ang trong b m ca my in, k c cc ti liu ang c in d. Thng thng, ti liu in hin hnh s tin hnh bnh thng v ti liu ny s c chuyn n daemon in hoc n b m ca my in. Nhng y tt c cc ti liu khc s b xo i. Nu s dng i s all th nhng my in no c hng i in s b xo i. disable {all | printer} b qua cc cng vic in n mi. down {all | printer} v hiu ho ton b cng vic in n trn my in. enable {all | printer} cho php cng vic chuyn ti my in. exit thot khi lpc. quit thot khi lpc (ging lnh exit). restart {all | printer} khi ng li lpd cho my in status {all | printer} hin th trng thi my in. up {all | printer} lm cho c hiu lc cng vic in n v khi ng lpd mi. stop {all | printer} lnh ny ngng my in. Mc d cc yu cu in c th lu tm nhng n vn khng c in cho n khi my in khi ng. Nu ti liu ang in trong khi lnh stop thc hin th ti liu in s c in hon chnh ri mi ngng li. 5.5. Sound card Hu ht cc sound card chnh u c Linux h tr. Thng th phn h tr c ci sn trong nhn. Linux cho php dng lnh cat lm vic vi cc dng tp tin audio. Dng tp tin c bit ca n l: /dev/audio, /dev/mide, /dev/dsp (Digital signal processor). V d: # cat /dev/audio > file.au 133

Linux-VN, cc lnh c bn

s nhp d liu t sound card theo hng thc .au vo tp tin ch nh. pht li d liu c th dng: # cat file.au >/dev/audio

134

Linux-VN, cc lnh c bn

Chng 6. Trnh son tho vim UNIX c hai b son tho l ed v vi trong vi c a chung hn c. vi l mt b son tho c pht trin t b son tho dng lnh ed. Trong ch vn bn (text), Linux cho php ngi dng s dng trnh son tho vim. vim chnh l b son tho tng thch vi vi trong ch vn bn. vim c phn ln ngi dng s dng son tho cc tp tin vn bn dng ASCII, c bit l to cc vn bn chng trnh ngun. vim c su ch c bn: Ch thng (Normal mode): trong ch thng c th nhp tt c cc lnh son tho thng thng. Bnh thng nu khng thit lp tu chn insertmode, ngm nh trong ch thng khi khi ng vim. Ch ny cn c gi l ch lnh. Ch o (Visual mode): ch ny cng gn ging nh ch thng, ch khc ch cc lnh di chuyn c thc hin trong ch ny c tc dng nh du vn bn. Khi thc hin cc lnh khc n s c tc dng trn nhng on vn bn c nh du. Ch chn la (Select mode): ch ny cng ging nh ch la chn ca MS-Windows. Ngi dng c th nhp mt k t c th in c xo mt s la chn v chy ch chn. Ch chn (Insert mode): Trong ch ny, c th son tho vn bn bnh thng nh cc b son tho quen bit khc. Vn bn s c chn vo trong b m. Ch dng lnh (Command-line mode hay cmdline mode): Trong ch ny, mt dng lnh s c nhp ti y ca s son tho. c th l cc lnh Ex (:), cc lnh tm kim (/ hay ?), v cc lnh lc (!). Ch Ex (Ex mode): ging nh ch dng lnh, nhng sau khi nhp mt lnh, vn trong ch Ex. Tuy nhin cc lnh trong ch ny cn nhiu hn ch. Ngoi ra cn c nm ch ph sau: Ch ch thc hin (Operator-pending mode): ch ny ging ch thng, nhng sau khi gi mt lnh, vim s ch cho n khi on vn bn chu tc ng ca lnh c a ra. Ch thay th (Replace mode): ch thay th l mt trng hp c bit ca ch chn. Ngi dng c th nhp mi k t nh trong ch chn, ch khc ch: mi k t nhp s thay th cho mt k t tn ti. Ch chn-lnh (Insert Normal mode): g CTRL-O trong ch chn chuyn sang ch ny. Ch ny cng ging nh ch thng, nhng sau khi thc hin mt lnh, vim s tr li ch chn. Ch chn-o (Insert Visual mode): ch ny c sinh ra khi trong ch chn thc hin mt s la chn o. vim s tr v ch chn sau khi s la 135

Linux-VN, cc lnh c bn

chn o kt thc. Ch chn-la chn (Insert Select mode): ch ny c khi to khi chy ch la chn trong ch chn. Khi ch la chn kt thc, vim s tr v ch chn. Vic chuyn i gia cc ch trong vim c thc hin nh cc lnh ca vim v c tp hp trong bng di y. Trong bng ny, ct u tin l ch ngun, hng u tin l ch ch, giao hng v ct cha cc phm chuyn ch (k hiu *i thay th mt danh sch di c gii thch sau): Chuyn T sang ch Thng o La chn Chn Thay th Dng lnh Ex *2 *5 <Esc> <Esc> *3 :vi ^O, ^G --------<Insert> :start ----v, ^V V, *4 ^G *1 c, C *6 R --:, /, ?, ! Q : : ------Thng o La chn Chn Thay th Dng lnh Ex

<Insert> --

Gii thch cc lnh vit tt: *1 chuyn sang ch chn t ch thng dng mt trong cc phm: i, I, a, A, o, O, c, C, s, S'. *2 chuyn sang ch thng t ch o: ngoi <Esc>, ' v ', ' V ', 'CTRL-V' c th a ra mt lnh thng thng (ngoi tr lnh di chuyn du tr). *3 chuyn sang ch thng t ch dng lnh: thc hin lnh (<Enter>) G CTRL-C hoc <Esc> *4 chuyn sang ch la chn t ch thng: s dng chut la chn vn bn s dng cc phm khng in c di chuyn du nhc tr trong khi nhn phm SHIFT *5 chuyn sang ch thng t ch la chn: s dng cc phm khng in c di chuyn du nhc tr m khng nhn phm SHIFT. *6 chuyn sang ch chn t ch la chn: nhp mt k t c th in 136

Linux-VN, cc lnh c bn

c. Di y s l mt s cc lnh c bn trong vim. 6.1. Khi ng Vim 6.1.1. M chng trnh son tho Vim Thng thng bt u dng Vim son tho mt tp tin vn bn, cch n gin nht l g mt trong ba lnh sau: vim [tu chn] bt u son tho hay hiu chnh mt tp tin

vim [tu chn] <danh sch cc tp bt u son tho mt hoc nhiu tp tin tin> vim [tu chn]son tho mt tp tin t thit b vo chun Nu nh danh sch cc tp tin khng c ch ra th b son tho s thao tc vi mt tp tin mi (vng m son tho rng). Ngc li, tp tin u tin trong danh sch s tr thnh tp tin hin hnh v c c vo trong vng son tho. Con tr s xut hin u dng u tin ca vng ny. nhy n tp tin k tip, ta nh lnh ":next ch lnh. son tho mt tp tin c tn bt u bng "- th phi in vo tn tp tin du "-" V d: # vim vdvim
~ ~ ~ ~ ~ ~ ~ "vdvim"[New File] 0,0-1 All

Lnh trn m mt ca s cho son tho mt tp tin mi c tn l "vdvim" Mt s cc tu chn c bn: + [n] + <lnh> t du nhc tr ti dng th n (mc nh l dng cui) thc hin lnh sau khi np tp tin

+/<mu> <tp tin> t du nhc tr ti dng u tin c cha mu trong tp tin -o[n] --help m n ca s (mc nh mt ca s cho mt tp tin) hin th danh sch cc tham s v thot 137

Linux-VN, cc lnh c bn

6.1.2. Tnh nng m nhiu ca s Trong Vim, c th chia ca s son tho hin thi thnh nhiu phn hay m nhiu ca s cng lc son tho cc tp tin khc nhau. V d lnh sau s m hai tp tin vd1 v vd2 trn hai ca s son tho: # vim -o2 vd1 vd2
~ ~ ~ vd1 0,0-1 All ~ ~ ~ vd2 0,0-1 All "vd2" [New File]

Sau y l mt s cc lnh hay dng: CTRL-W :split <tp tin> :sf <tp tin> chia ca s hin ti thnh hai phn chia ca s v son tho <tp tin> trn mt phn chia ca ca s chia ca s, tm tp tin trn ng dn v son tho n

CTRL-W CTRL- chia ca s v edit alternate file ^ CTRL-W n CTRL-W q CTRL-W o CTRL-W j CTRL-W k CTRL-W t CTRL-W b CTRL-W p CTRL-W x CTRL-W = CTRL-W CTRL-W + to mt ca s trng mi (ging :new) dng vic son tho v ng ca s (ging :q) phng to ca s hin hnh trn ton mn hnh di chuyn tr son tho xung ca s di di chuyn tr son tho ln ca s trn di chuyn tr son tho ln nh ca s di chuyn tr son tho xung y ca s di chuyn tr son tho n ca s c kch hot lc trc di chuyn tr son tho n ca s tip theo to tt c cc ca s c chiu cao nh nhau gim chiu cao ca ca s hin thi tng chiu cao ca ca s hin thi 138

Linux-VN, cc lnh c bn

CTRL-W _

thit t chiu cao ca ca s hin thi

6.1.3. Ghi v thot trong Vim Sau khi son tho xong ni dung ca tp tin, bit cch ghi ni dung v thot khi Vim nh th no cha? :[n,m] w [!] :[n,m] w <tp tin> :[n,m] w! <tp tin> ghi tp tin hin thi ghi ni dung ra <tp tin>, tr khi tp tin thc s tn ti ghi ni dung ra <tp tin>, nu tp tin tn ti th ghi ln ni dung c

:[n,m] w[!] >> [<tp chn thm vo <tp tin>, nu khng c tp tin, mc tin>] nh l tp tin hin thi :[n,m] w !<lnh> :[n,m] up [thi gian] [!] :q [!] :wq [!] [<tp tin>] :x [!] <tp tin> :st [!] thc hin <lnh> trn cc dng t dng th n n dng th m nh thit b vo chun ghi tp tin hin thi nu n c sa i thot khi Vim ghi ni dung <tp tin> (mc nh l tp tin hin thi) v thot khi Vim ging :wq nhng ch ghi khi thc s c s thay i trong ni dung tp tin (ging ZZ) dng Vim v khi to mt shell (ging CTRL-Z)

6.2. Di chuyn tr son tho trong Vim 6.2.1. Di chuyn trong vn bn Di chuyn tr son tho trong vn bn l mt tnh nng rt quan trng trong mt trnh son tho vn bn. Di y l mt s cc lnh thc hin vic trn: n n n n l h k j 0 ^ $ di chuyn tr son tho v bn phi n k t di chuyn tr son tho v bn tri n k t di chuyn tr son tho ln n dng di chuyn tr son tho xung n dng di chuyn v u dng di chuyn n t u tin ca dng hin ti di chuyn n cui dng

139

Linux-VN, cc lnh c bn

<Enter> n n n + _ G n G H M n n n gg gk gj

di chuyn n u dng tip theo di chuyn n u dng trc dng hin ti n dng di chuyn n u dng sau dng hin ti n dng di chuyn n u dng sau dng hin ti n-1 dng di chuyn n dng cui cng trong tp tin di chuyn n dng th n trong tp tin (ging :n) di chuyn n dng u tin trn mn hnh di chuyn n dng gia mn hnh di chuyn n u dng th n (mc nh l dng u tin) di chuyn ln n dng mn hnh di chuyn xung n dng mn hnh

6.2.2. Di chuyn theo cc i tng vn bn Nhiu lc mun xo b hay thay i mt t, mt cu m c phi s dng mt s cc phm hay lnh n gin th qu tht khng tin cht no. Cc lnh di y s phn no gip thc hin c nh ca mnh nhanh hn. n n n n n n n n n n w e b ge > < } { ]] [[ di chuyn n t tip theo di chuyn n cui ca t th n di chuyn ngc li n t di chuyn ngc li n t v t du nhc tr ti ch ci cui t di chuyn n n cu tip theo di chuyn ngc li n cu di chuyn n n on tip theo di chuyn ngc li n on di chuyn n n phn tip theo v t du nhc tr ti u phn di chuyn ngc li n phn v t du nhc tr ti u phn 140

Linux-VN, cc lnh c bn

n n

][ []

di chuyn n n phn tip theo v t du nhc tr ti cui phn di chuyn ngc li n phn v t du nhc tr ti cui phn

6.2.3. Cun mn hnh Mn hnh s t ng cun khi di tr son tho n y hoc ln nh mn hnh. Tuy nhin cng c mt s cc lnh gip c th cun mn hnh theo mun: n n n n n n <CTRL-f> <CTRL-b> <CTRL-d> <CTRL-u> <CTRL-e> <CTRL-y> z<Enter> z. zcun ln n mn hnh (mc nh l 1 mn hnh) cun xung n mn hnh (mc nh l 1 mn hnh) cun xung n dng (mc nh l 1/2 mn hnh) cun ln n dng (mc nh l 1/2 mn hnh) cun xung n dng (mc nh l 1 dng) cun ln n dng (mc nh l 1 dng) v li ca s son tho, dng hin ti s l dng trn cng ca ca s (ging zt) v li ca s son tho, dng hin ti s l dng gia ca ca s (ging zz) v li ca s son tho, dng hin ti s l dng y ca ca s (ging zb)

6.3. Cc thao tc trong vn bn Trong Vim c rt nhiu cc lnh gip son tho hay hiu chnh mt tp tin. Qua phn ny chng ti mun hng dn cc cc cch thm vn bn, hiu chnh vn bn hay xo mt vn bn. Khi son tho vn bn, nhiu dng c th c nhp bng cch s dng phm Enter. Nu c mt li cn phi sa, c th s dng cc phm mi tn di chuyn tr son tho trong vn bn v s dng cc phm Backspace hoc Delete hiu chnh. 6.3.1. Cc lnh chn vn bn trong Vim a n n n n A i I gI chn vn bn vo v tr du nhc tr hin thi (n ln) chn vn bn vo cui mt dng (n ln) chn vn bn vo bn tri du nhc tr (n ln) chn vn bn vo bn tri k t u tin khc trng trn dng hin ti (n ln) chn vn bn vo ct u tin (n ln) 141

Linux-VN, cc lnh c bn

n n

o O : r file : r! lnh

chn n dng trng vo di dng hin ti chn n dng trng vo trn dng hin ti chn vo v tr con tr ni dung ca file chn vo v tr con tr kt qu ca lnh lnh

6.3.2. Cc lnh xo vn bn trong Vim Bn cnh cc lnh to hay chn vn bn th trong Vim cng c mt s cc lnh cho php c th xo vn bn. Di y l bng lit k mt s lnh c bn: n n n n x X dd D hoc d$ dw dG d1G dn$ n,m n n d cc C cn$ n n s S xo n k t bn phi du nhc tr xo n k t bn tri du nhc tr xo n dng k t dng hin thi xo t v tr hin thi n ht dng xo n t k t v tr hin thi xo t v tr hin thi n cui tp tin xo ngc t v tr hin thi n u tp tin xo t dng hin thi n ht dng th n xo t dng th n n dng th m xo n dng, k c dng hin thi ri khi to ch chn (Insert) xo n dng k t v tr hin thi ri khi to ch chn (Insert) xo t dng hin thi n ht dng th n ri khi to ch chn (Insert) xo n k t v chy ch chn (Insert) xo n dng v chy ch chn (Insert)

6.3.3. Cc lnh khi phc vn bn trong Vim i khi cn khi phc li vn bn sau mt thao tc hiu chnh no , cc lnh sau s thc hin c iu ny: n u U khi phc li vn bn nh trc khi thc hin n ln thay i khi phc li hon ton dng vn bn hin thi nh trc khi thc hin bt k s hiu chnh no trn dng 142

Linux-VN, cc lnh c bn

: e! n CTRL-R

hiu chnh li. Lu tr trng thi ca ln ghi trc lm li (redo) n ln khi phc (undo) trc !

6.3.4. Cc lnh thay th vn bn trong Vim Vim cn c cc lnh cho php thay i vn bn m khng cn phi xo vn bn ri sau nh mi. n r <k t> R n n n n n n ~ gUU guu CTRL-A CTRL-X > [> ...] thay th n k t bn phi du tr bi <k t> ghi vn bn bi mt vn bn mi (hay chuyn sang ch thay th - Replace trong Vim) chuyn n ch hoa thnh ch thng v ngc li chuyn cc k t trn n dng, k t dng hin ti, t ch thng thnh ch hoa chuyn cc k t trn n dng, k t dng hin ti, t ch hoa thnh ch thng cng thm n n v vo s hin c bt i n n v t s hin c chuyn dng th n sang bn phi x khong trng (ging nh phm TAB trong Win), nu khng c n mc nh l dng hin ti, x l s du ' > ' (v d: >>> th x bng 3) chuyn dng th n sang bn tri x khong trng (ging nh phm SHIFT+TAB trong Win), nu khng c n mc nh l dng hin ti, x l s du ' <' kt hp n dng, k t dng hin ti, thnh mt dng ging nh J nhng khng chn cc khong trng cn gia t dng th n n dng th m vi rng l width, nu khng c width, mc nh rng l 80 cn phi t dng th n n dng th m vi rng l width, nu khng c width, mc nh rng l 80 cn tri t dng th n n dng th m vi rng l width, nu khng c width, mc nh rng l 80 143

< [< ...]

n n

J gJ :[n,m] ce [width]

:[n,m] ri [width]

:[n,m] le [width]

Linux-VN, cc lnh c bn

:[n,m]s/<mu1>/<mu2>/[g][c] tm t dng th n n dng th m v thay th mu1 bi mu2. Vi [g], thay th cho mi mu tm c. Vi [c], yu cu xc nhn i vi mi mu tm c :[n,m]s[g][c] lp li lnh tm v thay th trc (:s) vi phm Vim mi t dng n n dng m km theo l cc tu chn lp li vic tm kim v thay th trn dng hin thi m khng c cc tu chn

&

6.3.5. Sao chp v di chuyn vn bn trong Vim Phn ny s gii thiu vi cc cc lnh c bn ct v dn vn bn trong Vim. sao chp vn bn phi thc hin ba bc sau: Sao chp vn bn vo mt b nh m (Yanking) Di chuyn du nhc tr n v tr cn sao chp (Moving) Dn vn bn (Pasting) Sau y l cc lnh c th ca tng bc: * Sao chp vn bn vo b nh m n n yw Y sao chp n k t sao chp n dng vn bn, k t dng hin ti, vo b nh m (ging yy)

: [n] co [m] sao chp dng th n vo di dng th m * Dn vn bn: n n n n p P gp gP : [n] put m dn on vn bn c sao chp vo bn phi v tr hin thi (n ln) dn n on vn bn c sao chp vo bn tri v tr hin thi (n ln) ging nh p, nhng a du nhc tr v sau on vn bn mi dn ging nh P, nhng a du nhc tr v sau on vn bn mi dn dn m dng vn bn vo sau dng th n (nu khng c n mc nh l dng hin ti) 144

Linux-VN, cc lnh c bn

: [n] put! m dn m dng vn bn vo trc dng th n (nu khng c n mc nh l dng hin ti) Ngoi cc lnh trn, khi s dng Vim trong xterm, c th s dng chut thc hin cc thao tc cho vic sao chp vn bn. Vic ny ch thc hin c khi ang trong ch son tho ca Vim. Nhn phm tri chut v ko t im bt u n im kt thc ca on vn bn cn sao chp. on vn bn s c t ng sao vo b nh m. Sau di tr son tho n v tr cn dn v nhy nt chut gia (hoc nt chut tri v phi nu khng c chut gia), vn bn s c dn vo v tr mun. di chuyn vn bn trong Vim, cng phi thc hin qua ba bc sau: Ct on vn bn v dn vo b m Di chuyn du nhc tr ti v tr mi ca on vn bn Dn on vn bn vo v tr mi Di chuyn vn bn ch khc sao chp bc u tin l bc ct on vn bn. hy s dng cc lnh xo trong Vim ct on vn bn. V d, khi dng lnh dd, dng b xo s c lu vo trong b m, khi c th s dng cc lnh dn dn vn bn vo v tr mi. Ngoi ra cn c th s dng mt s lnh sau: : [n] m [x] '' '" di chuyn dng th n vo di dng th x dch chuyn n v tr lc trc dch chuyn n v tr lc trc thc hin vic hiu chnh tp tin

6.3.6. Tm kim v thay th vn bn trong Vim Vim c mt s cc lnh tm kim nh sau: / <xu> ? <xu> n N tm xu t dng hin ti n dng cui trong tp tin tm xu t dng hin ti ngc ln dng u trong tp tin tm tip xu c a ra trong lnh / hoc ? (t trn xung di) tm tip xu c a ra trong lnh / hoc ? (t di ln trn)

Xu c tm kim trong lnh / hay ? c th l mt biu thc. Mt biu thc thng thng l mt tp cc k t. Tp k t ny c xy dng bng cch kt hp gia cc k t thng thng v cc k t c bit. Cc k t c bit trong biu thc thng l: . \ * \+ thay th cho mt k t n ngoi tr k t xung dng hin th cc k t c bit thay th cho 0 hoc nhiu k t thay th cho 1 hoc nhiu k t 145

Linux-VN, cc lnh c bn

\= ^ $ \< \> [] [^] [-] \p \s \e \t

thay th cho 0 hoc mt k t thay th cho k t u dng thay th cho k t cui dng thay th cho ch bt u ca t thay th cho ch cui ca t thay th cho mt k t nm trong cp du [] thay th cho k t khng thuc trong cp du [] v ng sau du ^ thay th cho mt tp c th t cc k t thay th cho mt k t c th in c thay th cho mt k t trng thay th cho phm Esc thay th cho phm Tab

Vim s dng ch lnh Ex thc hin cc vic tm kim v thay th. Tt c cc lnh trong ch ny c bt u bng du ':'. c th kt hp lnh tm kim v thay thay th a ra c cc lnh phc tp theo dng tng qut sau: :<im bt u>,<im kt thc> s/<mu cn thay th>/<mu c thay th>/[g][c] V d lnh sau y:
:1,$s/the/The/g

s tm trong tp tin ang son tho v thay t the bi t The. 6.3.7. nh du trong Vim m {a-zA-Z} nh du vn bn ti v tr hin thi vi du l cc ch ci {a-zAZ} '{a-z} '{A-Z} :marks dch chuyn con tr ti v tr c nh du bi cc ch ci {a-z} trong phm Vim tp tin hin thi dch chuyn con tr ti v tr c nh du bi cc ch ci {A-Z} trong mt tp tin bt k hin th cc nh du hin thi Chuyn i ch <Insert> <Esc> chuyn vo ch chn hoc ch thay th thot khi ch chn, tr li ch thng thng 146

6.3.8. Cc phm s dng trong ch chn

Linux-VN, cc lnh c bn

CTRL-C CTRL-O <lnh> Cc phm mi tn SHIFT-left/right <Home> <End> <Enter>, CTRL-J CTRL-E CTRL-Y CTRL-A CTRL-@ CTRL-R <thanh ghi> CTRL-N CTRL-P CTRL-X ... <Backspace>, CTRL-H <Del> CTRL-W CTRL-U CTRL-T CTRL-D

ging nh <Esc>, nhng ??? thc hin <lnh> v tr v ch chn Di chuyn di chuyn tr son tho sang tri/phi/ln/xung mt k t di chuyn tr son tho sang tri/phi mt t di chuyn tr son tho v u dng di chuyn tr son tho v cui dng Cc phm c bit CTRL-M, bt u mt dng mi chn k t vo bn phi du nhc tr chn mt k t vo bn tri du nhc tr chn vo trc on vn bn c chn chn vo trc on vn bn c chn v dng ch chn chn ni dung ca mt thanh ghi chn t tip theo vo trc du nhc tr chn t trc vo trc du nhc tr hon thnh t trc du nhc tr theo nhiu cch khc nhau xo mt k t trc du nhc tr xo mt k t sau du nhc tr xo t trc du nhc tr xo tt c cc k t trn dng hin ti chn mt khong trng trc dng hin thi xo mt khong trng trc dng hin thi

6.3.9. Mt s lnh trong ch o V khi nhn phm ny, c th s dng cc phm di chuyn nh du on vn bn hoc b nh du (vn bn c nh du c mu trng)

147

Linux-VN, cc lnh c bn

khi nhn phm ny, mt dng vn bn s c nh du v c th s dng cc phm di chuyn nh du on vn bn hoc b nh du nhn phm ny s nh du mt khi vn bn v c th s dng cc phm di chuyn nh du on vn bn hoc b nh du di chuyn v tr du nhc tr trn khi c nh du hoc b nh du nh du li on vn bn c nh du lc trc chn nh du n t chn nh du n cu chn nh du n on chn nh du n khi

CTRLV o gv n n n n aw as ap ab

6.3.10. Cc lnh lp n n n . q {a-z} @{a-z} @@ :@{a-z} :@@ :[n,m]g/mu/[lnh] lp li n ln thay i cui ghi cc k t c nhp vo trong thanh ghi {a-z} thc hin ni dung c trong thanh ghi {a-z} n ln lp li n ln s thc hin ca lnh @{a-z} trc thc hin ni dung ca thanh ghi {a-z} nh mt lnh Ex lp li s thc hin ca lnh :@{a-z} trc thc hin lnh (mc nh l :p) trn cc dng c cha mu nm trong khong t dng th n n dng th m

:[n,m]g!/<mu>/[lnh] thc hin lnh (mc nh l :p) trn cc dng khng cha mu nm trong khong t dng th n n dng th m :sl [n] n gs 6.4. Cc lnh khc 6.4.1. Cch thc hin cc lnh bn trong Vim :sh :! <lnh> :!! khi to mt shell thc hin mt lnh shell trong Vim lp li lnh ':! <lnh>' lc trc 148 tm dng trong n giy tip tc dng trong n giy

Linux-VN, cc lnh c bn

K q

m trang man ca lnh trng vi ni dung t ti du nhc tr thot khi lnh ang thc hin tr li Vim

6.4.2. Cc lnh lin quan n tp tin Ngoi cc lnh c bn nh sao chp hay ct dn, trong Vim cn c mt s lnh cho php c th c c nhng thng tin cn thit v tp tin. CTRL-G hin th tn tp tin hin thi km theo trng thi tp tin v v tr du nhc tr (trng thi c th l: ch c, c sa, li khi c, tp tin mi) (ging :f) hin th thng tin nh CTRL -G v c thm ng dn y ca tp tin (nu n>1, tn buffer hin thi s c a ra) a ra v tr du nhc tr theo dng: ct/tng s ct, dng/tng s dng v k t/tng s k t i tn tp tin hin thi thnh tn mi lit k tt c cc tp tin hin thi ang c s dng trong Vim (ging :buffer v :files) a thm ng dn vo tn tp tin to mt bn sao ca tp tin hin thi vi tn mi l tn tp tin (ging nh save as trong Win) Xc nh tp tin cn son tho :e[n, /mu] <tp tin> son tho tp tin, t dng th n hoc t dng c cha mu, tr khi c s thay i thc s trong tp tin

CTRL-G

CTRL-G :f <tn mi> :ls :cd :w <tn tp tin>

:e[n, tin> :e :e!

/mu]!

<tp lun son tho tp tin, t dng th n hoc t dng c cha mu, b qua mi s thay i trong tp tin np li tp tin hin thi, tr khi c s thay i thc s trong tp tin lun np li tp tin hin thi, b qua mi s thay i thc s trong tp tin tm tp tin trn ng dn v son tho son tho tp tin th n (ging n CTRL-^) Cc lnh khc a ra tn th mc hin thi trong thc hin lnh trong Vim v a ra hp thoi yu cu xc nhn khi c thao tc i hi s xc nhn 149

:fin [!] <tp tin> :e #n :pw :conf <lnh Vim>

Linux-VN, cc lnh c bn

150

Linux-VN, cc lnh c bn

Chng 7. Cc lnh lin quan n tin trnh 7.1. Khi nim Khi m mt trang man, lit k cc tp tin vi lnh ls, chy trnh son tho vi hay chy bt k mt lnh no trong Linux, c ngha l ang khi to mt hoc nhiu tin trnh. Trong Linux, bt c chng trnh no ang chy u c c th c coi l mt tin trnh. C th c nhiu tin trnh cng chy mt lc. V d dng lnh ls -l | sort | more s khi to ba tin trnh: ls, sort v more. Mt tin trnh c th c rt nhiu trng thi khc nhau, bng di y s gii thiu cc trng thi c bn ca tin trnh trong Linux. K hiu D R S T Z W < N L ngha (uninterruptible sleep) trng thi ny tin trnh b treo v khng th chy li n bng mt tn hiu (runnable) trng thi sn sng thc hin, tc l tin trnh c th thc hin c nhng mt tin trnh khc ang chy, n ch ch n lt thc hin (sleeping) trng thi tm dng, tc l tin trnh tm dng khng hot ng (20 giy hoc t hn) (traced or stopped) trng thi dng, tin trnh c th b treo bi mt tin trnh ngoi (zombie process) tin trnh kt thc thc hin, nhng n vn c tham chiu trong h thng khng c cc trang thng tr tin trnh c mc u tin cao hn tin trnh c mc u tin thp hn c cc trang kha bn trong b nh

7.2. Cc lnh c bn 7.2.1. Lnh fg v lnh bg C th s dng t hp phm CTRL+z dng mt tin trnh v khi ng li tin trnh bng cch g lnh fg. Lnh fg (foreground) s tham chiu n cc chng trnh m mn hnh cng nh bn phm ca ang lm vic vi chng. V d: ang xem trang man ca lnh sort, nhn xung cui thy c ty chn -b, mun th ty chn ny ng thi vn mun xem trang man. Thay cho vic nh q thot v sau 151

Linux-VN, cc lnh c bn

chy li lnh man, hy g CTRL+z tm dng lnh man v g lnh th ty chn -b. Sau khi th xong, hy g fg tip tc xem trang man ca lnh sort. Kt qu ca qu trnh trn hin th nh sau: # man sort | more
SORT(1) FSF SORT(1) NAME sort - sort lines of text Files SYNOPSIS ../src/sort [OPTION] ... [Files]... DESCRIPTION Write sorted concatenation of all FILE(s) to standard out-put. +POS1 [-POS2] start a key at POS1,end it *before* POS2 obsoles-cent)field numbers and character offsets are num-bered starting with zero(contrast with the -k option) -b ignore leading blanks in sort fields or keys --More-(CTRL+z) [1]+ Stopped man sort | more

# ls -s | sort -b | head -4
1 Archives/ 1 InfoWorld/ 1 Mail/ 1 News/ 1 OWL/

# fg
man sort | more --More--

Trong phn trc, cch thc tm dng mt tin trnh c gii thiu. Linux cn ngi dng cch thc chy mt chng trnh di ch nn (background) - s dng lnh bg - trong khi cc chng trnh khc ang chy, v cch chuyn mt chng trnh vo trong ch nn - dng k hiu &. Nu mt tin trnh hot ng m khng a ra thng tin no trn mn hnh v khng cn nhn bt k thng tin u vo no, th c th s dng lnh bg di chuyn n vo trong ch nn ( ch ny n s tip tc chy cho n khi kt thc). Khi chng trnh cn a thng tin ra mn hnh hoc nhn thng tin t bn phm, h thng s t ng dng chng trnh v thng bo cho . cng c th s dng ch s iu khin cng vic (job control) lm vic vi chng trnh no mun. Khi chy mt chng trnh trong ch 152

Linux-VN, cc lnh c bn

nn, chng trnh s c nh s th t (c bao bi du ngoc vung []), theo sau l ch s ca tin trnh. Sau c th s dng lnh fg + s th t ca chng trnh a chng trnh tr li ch ni v tip tc chy. c mt chng trnh (hoc mt lnh ng) t ng chy trong ch nn, ch cn thm k hiu '&' vo cui lnh. Mt vi h thng khi tin trnh nn kt thc n s gi thng bo ti , nhng trn hu ht cc h thng, khi tin trnh trn nn hon thnh, n s ch cho n khi nhn phm Enter th mi hin th du nhc lnh mi km theo thng bo hon thnh tin trnh (thng th mt tin trnh hon thnh sau khong 20 giy). Nu c chuyn mt chng trnh vo ch nn mc d n c cc thng tin cn xut hoc nhp t cc thit b vo ra chun th h thng s a ra thng bo li di dng sau: Stopped (tty input/output) tn chng trnh V d: lnh sau thc hin vic tm kim tp tin thu1 trong ch nn # find -name thu1 &
[5] 918

trong ch ny, s th t ca chng trnh l [5], ch s tin trnh tng ng vi lnh find l 918. V g Enter khi tin trnh cha thc hin xong nn trn mn hnh ch hin th s th t ca chng trnh v ch s tin trnh, nu ch khong 30 hoc 40 giy sau ri g Enter ln na, mn hnh hin th thng bo hon thnh chng trnh nh sau: #
[5] Done find -name thu1

# Gi s chng trnh cha hon thnh v mun chuyn n ln ch ni, hy g lnh sau: # fg 5
find -name thu1 ./thu1

chng trnh hon thnh v hin th thng bo rng tp tin thu1 nm th mc gc. Chuyn g s xy ra nu c chuyn mt chng trnh vo ch nn khi m n cn phi xut hoc nhp thng tin t thit b vo ra chun? Hy th xem: # vi &
[6] 920

# nhn Enter #
[6] + Stopped (tty output) vi

153

Linux-VN, cc lnh c bn

# Lnh trn gip chy chng trnh vi trong ch nn, tuy nhin lnh gp phi li v y l chng trnh i hi hin th cc thng tin ra mn hnh (output). Nu chng trnh cn nhn thng tin, thng bo s c dng Stopped (tty input) tn chng trnh. 7.2.2. Tm ra cc tin trnh ang chy vi lnh ps C hai cch bit c c nhng chng trnh no ang chy trong h thng ca . Cch d hn, l lnh jobs, n s ch ra cho bit cc tin trnh no dng hoc l c chy trong ch nn. Mt lnh phc tp hn l lnh ps, lnh ny s cho bit thng tin y nht v cc tin trnh ang chy trn h thng ca . V d: # ps
PID TTY TIME CMD 7813 pts/0 00:00:00 bash 7908 pts/0 00:00:00 ps

# (PID - ch s ca tin trnh, TTY - tn thit b u cui trn tin trnh c thc hin, TIME - thi gian chy tin trnh, CMD - lnh khi to tin trnh). C php lnh v cc ty chn: ps [ty-chn] Lnh ps c mt s lng khng l cc ty chn c chia ra lm nhiu loi. Di y l mt s cc ty chn hay dng: Cc ty chn n gin: -A, -e chn hin th tt c cc tin trnh -T chn hin th cc tin trnh trn terminal ang chy -a chn hin th tt c cc tin trnh trn mt terminal, bao gm c cc tin trnh ca nhng ngi dng khc -r ch hin th tin trnh ang c chy Chn theo danh sch -C 154

Linux-VN, cc lnh c bn

chn hin th cc tin trnh theo tn lnh -G hin th cc tin trnh theo ch s nhm ngi dng -U hin th cc tin trnh theo tn hoc ch s ca ngi dng thc s (ngi dng khi ng tin trnh) -p hin th cc tin trnh theo ch s ca tin trnh -s hin th cc tin trnh thuc v mt phin lm vic -t hin th cc tin trnh thuc mt terminal -u hin th cc tin trnh theo tn v ch s ca ngi dng hiu qu Thit t khun dng c a ra ca cc tin trnh -f hin th thng tin v tin trnh vi cc trng sau UID - ch s ngi dng, PID - ch s tin trnh, PPID - ch s tin trnh khi to ra tin trnh, C - , STIME - thi gian khi to tin trnh, TTY - tn thit b u cui trn tin trnh c chy, TIME - thi gian thc hin tin trnh, CMD - lnh khi to tin trnh -l hin th y cc thng tin v tin trnh vi cc trng F, S, UID, PID, PPID, C, PRI, NI, ADDR, SZ, WCHAN, TTY, TIME, CMD -o hin th cc thng tin v tin trnh theo dng do ngi dng t chn. C cc dng nh sau: %C, %cpu % CPU c s dng cho tin trnh %mem %G %P %U %c % b nh c s dng chy tin trnh tn nhm ngi dng ch s ca tin trnh cha khi ng ra tin trnh con nh danh ngi dng hin th lnh to ra tin trnh 155

Linux-VN, cc lnh c bn

%p %x %y

hin th ch s ca tin trnh hin th thi gian chy tin trnh hin th thit b u cui trn tin trnh c thc hin

V d: mun xem cc thng tin nh tn ngi dng, tn nhm, ch s tin trnh, ch s tin trnh khi to ra tin trnh, tn thit b u cui, thi gian chy tin trnh, lnh khi to tin trnh, hy g lnh: # ps -o '%U %G %p %P %y %x %c'
USER GROUP PID PPID TTY TIME COMMAND root root 1929 1927 pts/1 00:00:00 bash root root 2279 1929 pts/1 00:00:00 ps

7.2.3. Hy dit tin trnh vi lnh kill By gi bit cch to nhiu tin trnh, chuyn cc tin trnh vo ch nn hay xem thng tin v cc tin trnh. Vy nu mun hy b mt tin trnh th phi lm nh th no? Hy dng lnh kill. iu quan trng nht, nu mun s dng lnh kill, l phi xc nh c ch s ca tin trnh m mun dng. C php lnh: kill [ty-chn] <ch-s-ca-tin-trnh> kill -l [tn hiu] Lnh kill s gi mt tn hiu n tin trnh c ch ra. Nu khng c tn hiu no c a ra, mc nh tn hiu TERM s c gi. -s xc nh tn hiu c gi. Tn hiu c th l s hoc tn ca tn hiu. Di y l mt s tn hiu hay dng: S 1 Tn SIGHUP ngha (hang up) y l tn hiu c gi n tt c cc tin trnh ang chy trc khi logout khi h thng (interrupt) y l tn hiu c gi khi nhn CTRL+c (kill) tn hiu ny s dng tin trnh ngay lp tc

2 9 15

SIGINT SIGKILL

SIGTERM tn hiu ny yu cu dng chng trnh ngay lp tc, nhng n cho php chng trnh c th xa cc tp tin tm m n to

-p 156

Linux-VN, cc lnh c bn

lnh kill s ch a ra ch s ca tin trnh m khng gi mt tn hiu no. -l hin th danh sch cc tn hiu m lnh kill c th gi n cc tin trnh (cc tn hiu ny c trong tp tin /usr/include/Linux/signal.h) V d, # ps
PID TTY TIME CMD 2240 pts/2 00:00:00 bash 2276 pts/2 00:00:00 man 2277 pts/2 00:00:00 more 2280 pts/2 00:00:00 sh 2281 pts/2 00:00:00 sh 2285 pts/2 00:00:00 less 2289 pts/2 00:00:00 man 2291 pts/2 00:00:00 sh 2292 pts/2 00:00:00 gunzip 2293 pts/2 00:00:00 less 2298 pts/2 00:00:00 ps

# kill 2277
PID TTY TIME CMD 2240 pts/2 00:00:00 bash 2276 pts/2 00:00:00 man 2280 pts/2 00:00:00 sh 2281 pts/2 00:00:00 sh 2285 pts/2 00:00:00 less 2289 pts/2 00:00:00 man 2291 pts/2 00:00:00 sh 2292 pts/2 00:00:00 gunzip 2293 pts/2 00:00:00 less 2298 pts/2 00:00:00 ps

7.2.4. Cho my ngng hot ng mt thi gian vi lnh sleep Nu mun cho my ngh mt thi gian m khng mun tt v ngi khi ng li, mt li khuyn cho l nn dng lnh sleep. 157

Linux-VN, cc lnh c bn

C php: sleep [tu-chn]... NUMBER[SUFFIX] NUMBER: s giy(s) ngng hot ng. SUFFIX : c th l giy(s) hoc pht(m) hoc gi hoc ngy(d) Cc ty chn: --help hin th tr gip v thot --version hin th thng tin v phin bn v thot 7.2.5. Xem cy tin trnh vi lnh pstree bit lnh xem cc tin trnh ang chy trn h thng, tuy nhin trong Linux cn c mt lnh cho php c th nhn thy mc phn cp ca cc tin trnh, l lnh pstree. C php lnh: pstree [ty-chn] [pid | ngi-dng] Lnh pstree s hin th cc tin trnh ang chy di dng cy tin trnh. Gc ca cy tin trnh thng l init. Nu a ra tn ca mt ngi dng th cy ca cc tin trnh do ngi dng s hu s c a ra. pstree thng gp cc nhnh tin trnh trng nhau vo trong du ngoc vung, v d: init -+-getty |-getty |-getty |-getty thnh init ---4*[getty] -a ch ra tham s dng lnh. Nu dng lnh ca mt tin trnh c tro i ra bn ngoi, n c a vo trong du ngoc n. -c khng th thu gn cc cy con ng nht. Mc nh, cc cy con s c thu gn khi c th -h hin th tin trnh hin thi v "t tin" ca n vi mu sng trng -H 158

Linux-VN, cc lnh c bn

ging nh ty chn -h, nhng tin trnh con ca tin trnh hin thi khng c mu sng trng -l hin th dng di. -n sp xp cc tin trnh cng mt t tin theo ch s tin trnh thay cho sp xp theo tn V d, # pstree
init-+-apmd |-atd |-automount |-crond |-enlightenment |-gdm-+-X | `-gdm---gnome-session |-gen_util_applet |-gmc |-gnome-name-serv |-gnome-smproxy |-gnomepager_appl |-gpm |-identd---identd---3*[identd] |-inetd |-kflushd |-klogd |-kpiod |-kswapd |-kupdate |-lockd---rpciod |-login---bash---mc-+-bash-+-cat | | |-passwd | | `-pstree | `-cons.saver

159

Linux-VN, cc lnh c bn

|-lpd |-mdrecoveryd |-5*[mingetty] |-panel |-portmap |-rpc.statd |-sendmail |-syslogd `-xfs

7.2.6. Lnh thit t li u tin ca tin trnh nice v lnh renice Ngoi cc lnh xem v hy b tin trnh, trong Linux cn c hai lnh lin quan n u tin ca tin trnh, l lnh nice v lnh renice. chy mt chng trnh vi u tin nh trc, hy s dng lnh nice. C php lnh: nice [ty-chn] ... [lnh [tham-s ]... ] Lnh nice s chy mt chng trnh (lnh) theo u tin sp xp. Nu khng c lnh, mc u tin hin ti s hin th. u tin c sp xp t -20 (mc u tin cao nht) n 19 (mc u tin thp nht). -ADJUST tng u tin theo ADJUST u tin --help hin th trang tr gip v thot thay i u tin ca mt tin trnh ang chy, hy s dng lnh renice. C php lnh: renice <-u-tin> [ty-chn] Lnh renice s thay i mc u tin ca mt hoc nhiu tin trnh ang chy. -g thay i quyn u tin theo nhm ngi dng -p thay i quyn u tin theo ch s ca tin trnh -u thay i quyn u tin theo tn ngi dng V d: 160

Linux-VN, cc lnh c bn

# renice +1 987 -u daemon root -p 32 lnh trn s thay i mc u tin ca tin trnh c ch s l 987 v 32, v tt c cc tin trnh do ngi dng daemon v root s hu.

161

Linux-VN, cc lnh c bn

Chng 8. Midnight Commander 8.1. Midnight Commander l g? Nu l mt ngi s dng my tnh lu nm, chc chn cc tng dng h iu hnh MS-DOS v chc chn u bit n v s dng thnh tho mt tin ch rt mnh trong vic qun l, iu khin cc thao tc v tp tin, th mc, a, mt mi trng trc quan trong ch vn bn (text). C l khng cn ni thm mi ngi cng bit l tin ch Norton Commander (NC). Trong cc h iu hnh Windows sau ny, mc d c s h tr ca cc tin ch Explorer nhng khng v th m vai tr ca NC gim i. Nhiu ngi dng vn thch dng NC trong cc thao tc vi tp tin v th mc hn. Trong Linux c mt tin ch mang tn Midnight Commander (vit tt l MC) cng c nhng chc nng v giao din gn ging vi NC ca DOS. V nu tng s dng NC th vic s dng MC trong Linux chng c g l kh khn c. 8.2. Khi ng MC Cu trc lnh khi ng MC nh sau: # mc [Ty-chn] C mt s tu chn khi dng tin ch ny. Tham s ny bao gm mt s dng thng dng sau: -a -b -c -d -P Khng s dng cc k t ho v cc ng thng khung. Khi ng trong ch mn hnh en trng. Khi ng trong ch mn hnh mu. Khng h tr chut Vi tham s ny, Midnight Commander s t ng chuyn th mc hin hnh ti th mc ang lm vic. Nh vy, sau khi kt thc, th mc hin hnh s l th mc cui cng thao tc. S dng chc nng View ca MC xem ni dung ca tp tin c ch ra. Cho bit phin bn chng trnh ang s dng.

-v file -V

Nu ch ra ng dn (path), ng dn u tin l th mc c hin th trong panel chn (selected panel), ng dn th hai c hin th panel cn li. 8.3. Giao din ca MC Giao din ca MC c chia ra lm bn phn. Phn ln mn hnh l khng gian hin th ca hai panel. Panel l mt khung ca s hin th cc tp tin th mc cng cc thuc tnh ca n hoc mt s ni dung khc. Theo mc nh, dng th hai t di ln s l dng lnh cn dng di cng hin th cc phm chc nng. Dng u tin trn nh mn hnh l thc n ngang (menu bar) ca MC. Thanh thc n ny c th khng xut hin nhng nu kch hot bng c hai chut ti dng u tin hoc nhn phm <F9> th n s hin ra 162

Linux-VN, cc lnh c bn

v c kch hot. Midnight Commander cho php hin th cng mt lc c hai panel. Mt trong hai panel l panel hin hnh (panel chn). Thanh sng chn nm trn panel hin hnh. Hu ht cc thao tc u din ra trn Panel ny. Mt s cc thao tc khc v tp tin nh Rename hay Copy s mc nh s dng th mc Panel cn li lm th mc ch. Tuy nhin ta vn c th sa c th mc ny trc khi thao tc v cc thao tc ny u tin bao gi cng yu cu nhp ng dn. Trn panel s hin th hu ht cc tp tin v th mc con ca th mc hin hnh. Midnight Commander c c ch hin th cc kiu tp tin khc nhau bng cc k hiu v mu sc khc nhau, v d nh cc tp tin biu tng lin kt s c k hiu @ u, cc tp tin thit b s c mu tm, cc tp tin ng ng c mu en, cc th mc c k hiu / u, cc th mc lin kt c k hiu ~... Cho php thi hnh mt lnh h thng t MC bng cch g chng ln mn hnh. Tt c nhng g c g vo u c hin th dng lnh pha di tr mt s k t iu khin v khi nhn Enter, Midnight Commander s thi hnh lnh g vo. 8.4. Dng chut trong MC Midnight Commander s h tr chut trong trng hp khng gi vi tham s --d. Khi kch chut vo mt tp tin trn Panel, tp tin s c chn, c ngha l thanh sng chn s nm ti v tr tp tin v panel cha tp tin s tr thnh panel hin hnh. Cn nu kch chut phi vo mt tp tin, tp tin s c nh du hoc xo du tu thuc vo trng thi kch trc . Nu kch i chut ti mt tp tin, tp tin s c thi hnh nu l tp tin thi hnh c (executable program) hoc nu c mt chng trnh c trng cho ring phn m rng th chng trnh c trng ny s c thc hin. Ngi dng cng c th thc hin cc lnh ca cc phm chc nng bng cch nhy chut ln phm chc nng . Nu kch chut ti dng u tin trn khung panel, ton b panel s b ko ln. Tng t kch chut ti dng cui cng trn khung panel, ton b panel s b ko xung. C th b qua cc thao tc chut ca MC v s dng cc thao tc chut chun bng cch gi phm <Shift> 8.5. Cc thao tc bn phm Mt s thao tc ca Midnight Commander cho php s dng nhanh bng cch g cc phm tt (hot key). tng thch vi mt s h thng khc, Midnight Commander k hiu phm CTRL l C, phm ALT l M (Meta), phm SHIFT l S. Cc k hiu t hp phm c dng nh sau: C-<chr> C<chr1><char2> C ngha l gi phm CTRL trong khi g phm <char>. V d C -f c ngha l gi CTRL v nhn <f>. C ngha l gi phm CTRL trong khi g phm <char1> sau nh tt c ra v g phm <char2>.

163

Linux-VN, cc lnh c bn

M-<chr>

C ngha l gi phm ALT trong khi g phm <char>. Nu khng c hiu lc th c th thc hin bng cch g phm <Esc> nh ra ri g phm <char>. C ngha l gi phm SHIFT trong khi g phm <char>.

S-<chr>

Sau y l chc nng mt s phm thng dng. c th tham kho thm trong phn sau ca cun sch. Cc phm thc hin lnh: Enter Nu c dng lnh, lnh s c thi hnh. Cn nu khng th s tu vo v tr ca thanh sng trn panel hin hnh l tp tin hay th mc m hoc vic chuyn i th mc hoc thi hnh tp tin hay thi hnh mt chng trnh tng ng s din ra. Cp nht li cc thng tin trn Panel.

C-l

Cc phm thao tc trn dng lnh: M-Enter hay CEnter M-Tab C-x t, C-x C-t C-x p, C-x C-p M-p, M-n C-a C-e C-b, Left C-f, Right M-f M-b C-h, Space C-d, Delete C-@ C-k chp tn tp tin v tr thanh sng chn xung dng lnh hon thnh tn tp tin, lnh, cc bin, tn ngi dng hoc tn my gip sao cc tp tin c nh du (mc nh l tp tin hin thi) trn panel chn (C-x t) hoc trn panel kia (C-x C-t) xung dng lnh a tn ng dn hin thi trn panel chn (C-x p) hoc trn panel kia (C-x C-p) xung dng lnh s dng hin li trn dng lnh cc lnh c gi trc . M-p s hin li dng lnh c thi hnh gn nht, M-n hin li lnh c gi trc lnh a du nhc tr v u dng a du nhc tr v cui dng a du nhc tr di chuyn sang tri mt k t a du nhc tr di chuyn sang phi mt k t a du nhc tr n t tip theo a du nhc tr ngc li mt t xo k t trc xo k t ti v tr du nhc tr nh du ct xo cc k t t v tr du nhc tr n cui dng 164

Linux-VN, cc lnh c bn

M-C-h, MBackspace

xo ngc li mt t

Cc phm thao tc trn panel: Up,Down, PgUp, PgDown, Home, End s dng cc phm ny di chuyn trong mt panel

b, C-b, C-h, di chuyn ngc li mt trang mn hnh Backspace, Delete Space u, d g, G Tab, C-i Insert, C-t M-g, M-h, M-j di chuyn tip mt trang mn hnh di chuyn ln/ xung 1/2 trang mn hnh di chuyn n im u hoc cui ca mt mn hnh hon i panel hin hnh. Thanh sng chn s chuyn t panel c sang panel hin hnh chn nh du mt tp tin hoc th mc ln lt chn tp tin u tin, tp tin gia v tp tin cui trn panel hin th tm kim tp tin trong th mc. Khi kch hot ch ny, nhng k t g vo s c thm vo xu tm kim thay v hin th trn dng lnh. Nu tu chn Show mini-status trong option c t th xu tm kim s c hin th dng trng thi. Khi g cc k t, thanh sng chn s di chuyn n tp tin u tin c nhng k t u ging nhng k t g vo. S dng phm Backspace hoc Del hiu chnh sai st. Nu nhn C-s ln na, vic tm kim s c tip tc chuyn i kiu hin th thng tin v tp tin hoc th mc thay i th mc hin thi s dng du cng la chn nh du mt nhm tp tin. C th s dng cc k t i din nh *, ?... biu din cc tp tin s chn s dng du tr xo nh du mt nhm tp tin. C th s dng cc k t di din nh *, ? biu din cc tp tin s xo s dng du * nh du hoc xo nh du tt c cc tp tin trong panel 165

C-s, M-s

M-t C-\ +

\ *

Linux-VN, cc lnh c bn

M-o M-y M-u

mt panel s hin th ni dung th mc hin thi hoc th mc cha ca th mc hin thi ca panel kia di chuyn n th mc lc trc c s dng di chuyn n th mc tip theo c s dng

8.6. Thc n thanh ngang (menu bar) Thc n thanh ngang trong Midnight Commander c hin th dng u tin trn mn hnh. Mi khi nhn <F9> hoc kch chut ti dng du tin trn mn hnh thc n ngang s c kch hot. Thc n ngang ca MC c nm mc Left, File, Command, Option v Right. Thc n Left v Right gip ta thit lp cng nh thay i kiu hin th ca hai panel left v right. Cc thc n mc con ca chng gm: thc n ny c dng khi mun thit lp kiu hin th ca cc tp tin. C bn kiu hin th: * Full - hin th thng tin v tn , kch thc, v thi gian s i ca tp tin; Listing Mode ... * Brief - ch hin th tn ca tp tin; * Long - hin th thng tin y v tp tin (tng t lnh ls -l); * User - hin th cc thng tin do t chn v tp tin; Quick view Info Tree Sort order... Filter ... Network link ... FTP link ... Rescan C-r C-x q C-x i xem nhanh ni dung ca mt tp tin xem cc thng tin v mt th mc hoc tp tin hin th di dng cy th mc thc hin sp xp ni dung hin th theo tn, theo tn m rng, thi gian sa cha, thi gian truy nhp, thi gian thay i, kch thc, inode thc hin vic lc tp tin theo tn thc hin lin kt n mt my tnh thc hin vic ly cc tp tin trn cc my t xa qut li

Thc n File cha mt danh sch cc lnh m c th thi hnh trn cc tp tin c nh du hoc tp tin ti v tr thanh chn. Cc thc n mc con: User menu View View file ... F2 F3 thc n dnh cho ngi dng xem ni dung ca tp tin hin thi m v xem ni dung ca mt tp tin bt k 166

Linux-VN, cc lnh c bn

Filtered view Edit Copy cHmod Link Symlink edit sYimlink chOwn Advanced chown Rename/Move Mkdir Delete Quick cd select Group Unselect group Exit Directory tree Find file Swap panels Switch panels on/of

M-! F4 F5 C-x c C-x l C-x s C-x C-s C-x o

thc hin mt lnh lc vi tham s l tn tp tin v hin th ni dung ca tp tin son tho tp tin hin thi vi trnh son tho mc nh trn h thng thc hin copy thay i quyn truy nhp i vi mt th mc hay mt tp tin to mt lin kt cng n tp tin hin thi to mt lin kt tng trng n tp tin hin thi hiu chnh li mt lin kt tng trng thay i quyn s hu i vi th mc hay tp tin thay i quyn s hu cng nh quyn truy nhp ca tp tin hay th mc

F6 F7 F8 M-c M-+ M-\ F10

thc hin vic i tn hay di chuyn i vi mt tp tin to mt th mc xo mt hoc nhiu tp tin chuyn nhanh n mt th mc thc hin vic chn mt nhm cc tp tin ngc vi lnh trn chn cc tp tin trong th mc hin thi thot khi MC hin th th mc di dng cy th mc

reverse selecTion M-*

Thc n Command cng cha mt danh sch cc lnh. M-? C-u C-o tm mt tp tin thc hin tro i ni dung gia hai panel hin th a ra lnh shell c thc hin ln cui (ch s dng trn xterm, trn console SCO v Linux) thc hin so snh th mc hin ti trn panel chn vi cc th mc khc a ra danh sch cc lnh thc hin C-\ thay i th mc hin thi

Compare directories C-x d Command history Directory hotlist

167

Linux-VN, cc lnh c bn

External panelize

C-x !

thc hin mt lnh trong MC v hin th kt qu trn panel chn (v d: nu mun trn panel chn hin th tt c cc tp tin lin kt trong th mc hin thi, hy chn mc thc n ny v nhp lnh find . -type l -print s thy kt qu tht tuyt vi)

Show directory size Command history Directory hotlist Background Extension file edit C-\ C-x j

hin th kch thc ca th mc hin th danh sch cc lnh thc hin chuyn nhanh n mt th mc thc hin mt s lnh lin quan n cc tin trnh nn cho php hiu chnh tp tin ~/.mc/ext xc nh chng trnh s thc hin khi xem, son tho hay lm bt c iu g trn cc tp tin c tn m rng

Thc n Options cho php thit lp, hu b mt s tu chn c lin quan n hot ng ca chng trnh MC. Configuration ... thit lp cc tu chn cu hnh cho MC Lay-out ... Confirmation ... Display bits ... Learn keys ... Virtual FS ... Save setup xc lp cch hin th ca MC trn mn hnh thit lp cc hp thoi xc nhn khi thc hin mt thao tc no thit lp cch hin th ca cc k t xc nh cc phm khng c kch hot thit lp h thng tp tin o ghi mi s thit lp c thay i

8.7. Cc phm chc nng Cc phm chc nng ca Midnight Commander c hin th ti dng cui cng ca mn hnh. C th thc hin cc chc nng bng cch kch chut ln nhn ca cc chc nng tng ng hoc nhn trn bn phm chc nng . F1 F2 F3 F4 F5 F6 hin th trang tr gip a ra thc n ngi dng xem ni dung mt tp tin son tho ni dung mt tp tin thc hin sao chp tp tin thc hin di chuyn hoc i tn tp tin 168

Linux-VN, cc lnh c bn

F7 F8 F9 F10

to th mc mi xo th mc hoc tp tin a tr son tho ln thanh thc n nm ngang thot khi MC

8.8. B son tho ca Midnight Commander Midnight Commander cung cp mt b son tho kh tin dng trong vic son tho cc vn bn ASCII. B son tho ny c giao din v thao tc kh ging vi tin ch Edit ca DOS hay NcEdit ca Norton Commander. hiu chnh mt s tp tin vn bn, hy di chuyn thanh sng chn n v tr tp tin ri nhn F4, ni dung ca tp tin s hin ra trong vng son tho. Sau khi hiu chnh xong, nhn F2 ghi li. B son tho ny c mt thc n ngang cung cp cc chc nng y nh mt b son tho thng thng. Nu tng l ngi dng DOS v mi dng Linux th nn dng b son tho ny hiu chnh v son tho vn bn thay v b son tho Vim. Sau y l bng lit k cc phm chc nng cng nh cc mc thc n trong b son tho ny: * Thanh thc n Thc n File: Cc thao tc lin quan n tp tin Open/load New Save Save as ... Insert file ... About .. Quit Thc n Edit: Cc thao tc lin quan n vic son tho ni dung tp tin Toggle Mark Mark Columns F3 S-F3 thc hin nh du mt on vn bn nh du theo ct chuyn i gia hai ch chn/ 169 F10 C-o C-n F2 F12 F15 m hoc np mt tp tin to mt tp tin mi ghi ni dung tp tin c son tho to mt tp tin khc tn nhng c ni dung trng vi ni dung tp tin hin thi chn ni dung mt tp tin vo tp tin hin thi sao on vn bn c nh du n mt tp tin khc thng tin v b son tho thot khi b son tho

Copy to file ... C-f

Toggle Ins/overw Ins

Linux-VN, cc lnh c bn

Copy Move Delete Undo Beginning End

F5 F6 F8 C-u C-PgUp C-PgDn

thc hin sao chp tp tin thc hin di chuyn tp tin xo tp tin tr v trng thi trc khi thc hin mt s thay i di chuyn n u mn hnh di chuyn n cui mn hnh

Thc n Sear/Repl: Cc thao tc lin quan n vic tm kim v thay th Search .. Search again Replace ... Thc n Command: Cc lnh c th c thc hin trong khi son tho Goto line ... Insert Literal ... Refresh screen Insert Date/time Format paragraph M-p Sort Thc n Options: Cc tu chn c th thit lp cho b son tho General ... Save mode ... thit lp cc tu chn cho b son tho ghi li mi s thit lp c thay i 170 M-t M-l C-q C-l di chuyn tr son tho n mt dng chn vo trc du nhc tr mt k t lm ti li mn hnh chn ngy gi hin ti vo v tr du nhc tr nh dng li on vn bn thc hin sp xp F7 F17 F4 thc hin tm kim mt xu vn bn tm kim tip tm v thay th xu vn bn

Linux-VN, cc lnh c bn

* Cc phm chc nng F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 hin th trang tr gip ghi ni dung tp tin thc hin vic nh du on vn bn tm v thay th xu vn bn thc hin vic sao chp di chuyn tp tin tm kim xu vn bn xo on vn bn c nh du hin th thanh thc n ngang thot khi b son tho

171

Linux-VN, cc lnh c bn

Chng 9. Mtools - tin ch truy cp a DOS trong Linux 9.1. Phn gii thiu Mtools l mt nhm cc cng c chung cho php cc h thng UNIX ni chung (v Linux ni ring) thao tc vi cc tp tin MS-DOS nh: c, ghi, di chuyn cc tp tin trong mt h thng tp tin MS-DOS (chng hn a mm). Trong Mtools, mi chng trnh c gng m phng cc lnh tng ng trong MS-DOS. Mtools rt hiu qu trong vic truy cp vo h thng tp tin MS-DOS. Vi Mtools, mt ngi c th d dng truy cp vo a mm vi ch mt lnh m khng cn mount v unmount li. 9.2. Cc thuc tnh chung ca cc lnh mtools 9.2.1. Cc tu chn v tn cc tp tin i vi MSTOOLS, s dng mt tp tin trong Linux, cn xc nh r v tr ca tp tin v tn ca n, mt cch tng qut c th vit nh sau: [<-a:>] [/<tn-th-mc>/... /] <tn-tp-tin> tn a km du hai chm (:), tn th mc (y ) cha tp tin v tn tp tin. Ch phn tn tp tin l bt buc, tn a v tn th mc (ng dn) l c th c hoc khng. Ngm nh cc tp tin khng c tn a i km l cc tp tin Linux. Cc th mc trong tn tp tin c phn cch bi du '/' hoc du '\'. Nu s dng du '\' hoc cc k t i din trong tn tp tin MS-DOS, nn bao chng bi du nhy kp ("") m bo tnh ng n ca lnh. Mi tu chn u c bt u bi du tr (-), ch khng phi k t '/' nh trong MSDOS. Hu ht cc lnh mtools u cho php tc ng ln nhiu tp tin cng lc hoc s dng nhiu tu chn lnh khc nhau, khng tun theo cc quy tc trong MS-DOS, nhng iu ny li gip ch cho ngi dng hn. Tn a Cch t tn a ph thuc vo tng cu trc my, tuy nhin hu ht thng qui nh a A l a mm u tin, a B l a mm th hai (nu c), a J (nu c) l mt a Jaz v Z l a Zip. Trn cc h thng ny, cc tn thit b c bt ngun t SCSI id, a Jaz c gi nh n SCSI ch 4, v Zip SCSI ch 5 (sp t ngm nh ca nh sn xut). Trn LINUX, c hai a ny c t trn a th hai trn SCSI bus (/dev/sdb). S thit lp mc nh ny c th c thay i bng mt tp tin cu hnh (configuration file). Th mc lm vic hin thi Lnh mcd c s dng khi to mt thit b v th mc lm vic hin thi (lin quan n h thng tp tin MS-DOS ), ngm nh c t l A:/, khng nh MS-DOS, y ch c mt th mc lm vic cho mi a ch khng phi cho mi a. 172

Linux-VN, cc lnh c bn

Tn tp tin di kiu VFAT Phin bn ny ca mtools h tr cc tn tp tin di VFAT. Nu tn mt tp tin Linux di qu qui nh t tn trong MS-DOS, n s c lu thnh mt tn VFAT di, v mt tn ngn i km s c to ra. Tn ngn ny l ci nhn thy khi kim tra a bng mt phin bn ca DOS trc version 7.0. Bng di y ch ra vi v d ca tn tp tin ngn: Tn di --------thisisatest prn.txt .abc hot+cold Tn MS-DOS ----------------THISIS~1 PRN~1.TXT ABC~1 HOT_CO~1 L do thay i --------------------Tn tp tin qu di Tn m rng qu di PRN l tn thit b Tn chnh ca tp tin khng c m ch c tn m rng Trong tn tp tin c cha k t c bit

alain.knaff ALAIN~1.KNA

Ni chung, c mt s cc qui tc sau khi to mt tn tp tin ngn: Cc k t c bit c thay th bi du gch di. Cc k t l ; + = [ ] ' , \ " * \\ < > / ? : | Cc du chm phn cch gia tn chnh v tn m rng s c b qua Mt s ~n c to ra cui tn tp tin (v d: HOT_CO~1 ) Tn tp tin c rt ngn nm trong gii hn 8 k t tn chnh v 3 k t tn m rng. Tn tp tin kiu Linux (c di v ngn) c gi l tn chnh (primary name), v tn c rt ngn theo dng MS-DOS l tn ph (secondary name). V d: # mcopy /etc/motd a:Reallylongname Mtools s t ng to ra mt tn ngn l REALLY~1 thay cho tn di l Reallylongname. Reallylongname l primary name, v REALLY~1 l secondary name. # mcopy /etc/motd a:motd Trong lnh trn, tn tp tin l ph hp vi gii hn tn tp tin ca DOS, do , mtools khng cn to ra tn khc, motd l tn chnh, v khng cn tn ph. Xung t tn tp tin Khi ghi mt tp tin vo a, rt c th tn tp tin ny (tn ngn hoc tn di) trng vi tn mt tp tin hoc mt th mc tn ti. iu ny c th xy ra vi tt c cc lnh to ra mt th mc mi, chng hn mcopy, mmd, mren, mmove, mwrite v mread. Khi mt xung t tn tp tin xy ra, mtools hi nn lm th no, c vi la chn sau: overwrite 173

Linux-VN, cc lnh c bn

Ghi mt tp tin ang tn ti. Khng th ghi mt tn tp tin ln mt th mc. rename i tn tp tin mi to ra. Mtools nhc a vo tn mi autorename Mtools t ng i tn tp tin m khng hi skip B tp tin ny, v chuyn n tp tin tip theo (nu c) chn mt trong nhng la chn ny, nh ch u tin ca cc la chn trn ti du nhc. Nu s dng ch thng, thao tc ch p dng cho tp tin , nu dng ch hoa, thao tc s p dng cho mi tp tin, s khng b hi li na. ng thi c th chn cc thao tc tc dng ln tn tp tin (cho mi tp tin) trn dng lnh khi gi mtools: -o Ngm nh ghi tn tp tin chnh. -O Ngm nh ghi tn tp tin ph. -r Ngm nh i tn tp tin chnh. -R Ngm nh i tn tp tin ph. -a Ngm nh t ng i tn tp tin chnh. -A Ngm nh t ng i tn tp tin ph. -s Ngm nh b qua tn tp tin chnh. -S Ngm nh b qua tn tp tin ph. -m Hi ngi s dng lm g vi tn tp tin chnh. -M Hi ngi s dng lm g vi tn tp tin ph. Lu rng cc tu chn lin quan n tn tp tin ca lnh c s tng ng gia ch hoa/ch thng cho tn chnh/tn ph, ngc li vi cc la chn tng tc ch thng/ch hoa gia mt thi im/thng xuyn. Ngm nh, ngi s dng s c nhc nu xy ra xung t tn chnh, v tn ph s c t ng i tn. Nu xung t tn xy ra trong mt th mc Linux, mtools ch hi khi ghi tp tin hoc b qua tp tin . Phn bit ch hoa, ch thng trong h thng tp tin VFAT H thng tp tin VFAT cho php tn tp tin c th bao gm c ch hoa hay ch thng. Tuy nhin trong cng mt th mc, khng th tn ti hai tp tin cng c tn vi ni dung nh nhau ch khc ch hoa ch thng. V d nu lu mt tp tin c tn LongFileName trn mt h thng tp tin VFAT, mdir hin th tp tin ny l LongFileName. V khi , nu c thm tp tin LONGFILENAME 174

Linux-VN, cc lnh c bn

vo cng th mc, n s b t chi, v kim tra xung t b qua phn bit ch hoa/ch thng. # mcd a:/ # mmd LongFileName # mdir
CRACKVK LONGFI~1 EXE <DIR> 110592 11-27-2000 0:49 CrackVK.exe 08-14-2000 14:32 LongFileName 110 592 bytes 1 346 560 bytes free

2 files

# mmd LONGFILENAME
Long file name "LONGFILENAME" already exists. a)utorename A)utorename-all r)ename R)ename-all s)kip S)kip-all q)uit (aArRsSq): _

H thng tp tin VFAT cho php lu kiu ch ca tn tp tin trong byte thuc tnh, nu mi k t ca tn tp tin c cng kiu ch, v mi k t ca tn m rng cng cng kiu ch. Mtools s dng thng tin ny khi hin th tp tin, v ng thi to ra tn tp tin Linux khi mcopying n mt th mc Linux. C th kt qu s khng nh mong mun nu p dng cho tp tin c vit bi cc phin bn 7.0 tr v trc ca DOS v: cc tn tp tin MS-DOS kiu c c chuyn thnh ch hoa, trong khi cc phin bn c ca mtools li s dng cc tn tp Linux ch thng. nh dng dung lng ln Mtools h tr mt s loi nh dng cho php lu tr nhiu d liu trn a hn thng thng. Cc nh dng ny c th khng c h tr trn tt c cc h iu hnh v cc kh nng khc nhau ca chng. nh dng cc a, cn phi s dng mt cng c c sn trn h iu hnh ang s dng. i vi Linux, cc cng c dnh cho mm c th thy trong gi tin fdutils nm trong cc a ch sau: ftp://www.tux.org/pub/knaff/fdutils/. ftp://sunsite.unc.edu/pub/Linux/utils/disk-management/fdutils-* Nhiu sector hn Phng php c nht lu tr nhiu d liu hn trn mt a l s dng nhiu sector v cylinder hn. Mc d nh dng chun s dng 80 cylinder v 18sector (trn mt a mt cao 3 1/2 inch), nhng c th tng ln thnh 83 cylinder (vi hu ht cc a) v 21 sector. Phng php ny cho php lu tr thm 1743K trn mt a mt cao 3 1/2 inch. Tuy nhin, cc a c 21 sector c chm gp i so vi a chun 18 sector bi v cc sector c nn li st nhau hn m chng ta li cn phi xen vo gia chng c. Vn ny khng gp phi vi nh dng a 20 sector. Cc nh dng ny c h tr bi rt nhiu cc tin ch phn mm ca DOS chng hn 175

Linux-VN, cc lnh c bn

fdformat v vgacopy. Mtools h tr cc nh dng ny trn Linux, trn Sun v DELL Unix PC. Sectors ln hn Bng vic s dng cc sector ln hn, c th vt ra khi dung lng c c ca cc sector chun 512-byte. l v cc u c (header) sector. Cc u c sector c cng c, bt k c bao nhiu byte bn trong sector. Do , s tit kim thm khong trng bng cch s dng mt s t hn cc sector c dung lng ln hn. V d, 1 sector c dung lng 4K ch cn mt u c l c th c d liu mt cch thng sut, trong khi 8 sector vi dung lng 512 byte cn ti nhng 8 u c c th c thng sut cng mt lng d liu. Phng php ny cho php lu tr ln ti 1992K trn mt i 3 1/2 inch. Mtools ch h tr cc nh dng ny trn Linux. nh dng 2m nh dng 2m c pht minh bi Ciriaco Garcia de Celis. nh dng ny cng s dng cc sector ln hn thng thng cha c nhiu d liu trn a. Tuy nhin, nh dng ny vn s dng nh dng chun (18 sector, 1 sector = 512 byte) trn cylinder u tin DOS d iu khin cc a hn. Thc s phng php ny cho php c mt bootsector dng chun, dng cha cc m t cch c nhng phn cn li nh th no. D vy, mt tr ngi ca nh dng ny l cylinder u tin c th cha t d liu hn cc cylinder khc. Tht khng may, DOS ch c th c c cc a m mi track cha cng mt lng d liu. V vy, nh dng 2m phi du track u tin cha t d liu dn bng cch s dng mt shadow FAT.(Thng thng DOS lu bng FAT thnh 2 bn d phng. XDF ch lu mt bng, v n bo vi DOS l n lu 2 bn. V vy, phn tng t bn FAT th hai cng c ghi li). N ng nghi rng khng bao gi nn s dng mt a nh dng 2m lu nhng th khng phi l DOS fs. Mtools ch h tr nh dng ny trn Linux. nh dng XDF XDF l mt nh dng dung lng ln c OS/2 s dng. nh dng ny c th cha 1840 K trn mt a mm, tc l vn nh hn cc nh dng 2m tt nht. Nhng u im chnh ca n tc c nhanh: 600 miligiy trn mt track, nhanh hn nh dng 21 sector, v hu nh tng ng vi nh dng chun 18 sector. truy cp vo cc a nh dng ny, phi chc chn rng mtools c bin dch vi h tr XDF, v t bin usedf cho a trong tp tin cu hnh (configuration).Tham kho thm v Compiling mtools, v misc v cch thc hin. Truy cp Fast XDF ch l bin ca cc nhn Linux t 1.1.34 tr i. Mtools ch h tr nh dng ny trn Linux. Cn thn: Ch cc nh phn phi: Nu mtools * c bin dch trn nhn Linux sau phin bn 1.3.34, n s khng th chy trn mt nhn Linux trc . D vy, nu mtools c bin dch trn mt nhn trc , n vn c th chy trn mt nhn mi hn, tr khi truy cp XDF chm hn. C ngh l cc nh phn phi sn phm ch bao gm mtools binaries c bin dch trn nhn trc phin bn 1.3.34 cho n khi phin bn 2.0 c pht hnh. Khi bn 2.0 c pht hnh, mtools binaries c bin dch trn mt nhn mi c th (v nn) c pht hnh. Mtools binaries c bin dch trn nhn 176

Linux-VN, cc lnh c bn

trc bn 1.3.34 s khng chy c trn phin bn t 2.1 tr i. M thot ra Mi lnh Mtools tr li gi tr 0 khi thc hin thnh cng, gi tr 1 nu hng, v 2 khi hng mt phn. Mi lnh Mtools thc hin mt vi kim tra thng minh trc khi tip tc thc hin, xc nh a thc s l mt a MS-DOS (ch khng phi l a ext2 hay minix). Cc kim tra ny c th loi b cc b cc a hng m c th vn c c bng cch khc. trnh cc kim tra ny, t bin mi trng MTOOLS_SKIP_CHECK hoc bin tp tin thit lp tng ng (corresponding configuration file variable). Vng mc Mt nh hng ph l vic khng c lng thit b hp l (khi cc dung lng a a dng c h tr) l thng bo li thng gp ca driver thit b. Nhng thng bo ny c th b qua. M kim tra FAT chn li trn cc a 1.72 Mb c nh dng vi cc phin bn Mtools trc 2.0.7, iu ny c th b qua. t bin mi trng MTOOLS_FAT_COMPATIBILITY (hoc bin tp tin thit lp tng ng, `global variables') b qua kim tra FAT. Cc lnh hay s dng * Lnh floppyd_installtest Floppyd_installtest c s dng kim tra mt chng trnh floppyd daemon ang chy. Lnh ny rt hu ch, nu c mt frontend script ti mtools, n quyt nh c s dng floppyd hay khng. C php: floppyd_installtest [-f] Connect-String Tu chn -f floppyd_installtest thc hin mt xc nhn X-Cookie y v bo li nu khng lm vic. Connect-String c nh dng c m t phn floppyd-section: HOSTNAME:DISPLAYNUMBER[/BASEPORT] * Lnh mattrib Mattrib c dng thay i cc thuc tnh ca tp tin MS-DOS. Lnh ny c c php nh sau: mattrib [-a |+a] [-h | +h] [-r | +r] [-s | +s] [-/ ] [ -p ][X] MSDOSFILE [ MSDOSFILES ... ] Mattrib thm cc thuc tnh vo mt tp tin MS-DOS (vi k hiu php ton ``+'') loi b thuc tnh (vi k hiu php ton ``-''). 177

Linux-VN, cc lnh c bn

Mattrib h tr cc bit thuc tnh sau: a thuc tnh lu tr (Archive bit). c s dng bi cc chng trnh sao lu ch ra cc tp tin mi r thuc tnh ch c (Read-only bit). Dng xc nh mt tp tin ch c. Cc tp tin c thuc tnh ny khng th chnh sa hay xo bng lnh `DEL' s thuc tnh h thng. c MS-DOS dng xc nh mt tp tin h thng h thuc tnh n. c dng giu cc tp tin khi dng lnh`DIR' Mattrib cng h tr cc k hiu lnh sau: / quy. Lit k quy danh sch cc thuc tnh ca cc tp tin trong th mc con X rt gn. In ra cc thuc tnh khng c cc k t trng chn gia Nu tu chn / khng c t, hay MSDOSFILE cha cc k t lin kt, v ch c mt ng dn tp tin Msdos trn dng lnh, th ch cc thuc tnh c in ra, ch khng phi l tn tp tin. Tu chn ny rt thun tin cho cc scripts p ch thc hin li (Replay). a ra mt dy cc lnh mformat s lu li trng thi hin thi, bt u t mt trng thi lu li bi tp tin h thng DOS. Cc lnh ch a ra cho cc thit lp thuc tnh khc ngm nh. (Cc thuc tnh lu tr t cho tp tin, khng t cho th mc). Tu chn ny nhm mc ch s dng thm vo tar * Lnh mbadblocks Lnh mbadblocks c s dng qut mt mm MS-DOS v nh du cc sector hng khng dng c l bad. Lnh ny c c php: mbadblocks DRIVE Lnh mbadblocks qut mt mm MS-DOS xc nh cc sector hng. Mi bad sector c nh du nh thc t trn bn FAT. iu ny nhm trnh s dng cc sector hng sau khi thc hin mformat. N khng dng cu cc sector hng. Cc li: Mbadblocks cng c gng (nhng khng hon ton) cu cc sector hng ang s dng bng cch c li nhiu ln, sau mi nh du l hng. * Lnh mcat Lnh mcat c dng sao chp ton b ni dung nh a t mt mm hoc ln mt mm. C php lnh: mcat [ -w ] DRIVE 178

Linux-VN, cc lnh c bn

Lnh mcat thc hin cng nhim v nh lnh cat ca Linux. N c bao gm trong cc gi ca mtools, v lnh cat khng th truy cp n cc mm m tin trnh mm mtools yu cu. By gi ta c th to cc a mm khi ng t xa bng mcat. Thao tc ngm nh l c. u ra c ghi vo stdout. Nu tu chn `-w' c xc nh, mcat c mt nh a t stdin v ghi vo thit b c cho trc. *S dng cn thn* Do tnh t nhin cp thp ca lnh ny, n s hu mt cch hp l bt c d liu no c ghi trn a trc m khng h cnh bo. Lnh mcd Lnh mcd c s dng thay i th mc lm vic mtools trn a MS-DOS . N s dng c php sau: mcd [th-mc-MSDOS] Khng c i s, mcd thng bo thit b hin thi v th mc ang lm vic. Mt khc, mcd thay i thit b hin thi v th mc lm vic hin thi lin quan n mt h thng tp tin MS-DOS . Bin mi trng MCWD c th s dng xc nh tp tin m thng tin thit b v th mc lm vic hin thi c lu tr. Gi tr ngm nh l `$HOME/.mcwd'. Thng tin trong tp tin ny c b qua nu tp tin ny to ra c gi tr ln. Lnh mcd tr li gi tr 0 khi hon thnh hoc 1 khi b hng. Khng nh lnh CD ca MS-DOS, mcd c th dng thay i sang mt thit b khc. N c th sng sut xo b tp tin .mcwd c khi logout. *Lnh mcopy Lnh mcopy c s dng copy cc tp tin MS-DOS t Linux/vo Linux. Lnh ny c ba dng: mcopy [-b/ptnvmoQOsSrRA] tp-tin-gc tp-tin-ch mcopy [-b/ptnvmoQOsSrRA] tp-tin-gc... tp-tin-ch mcopy [-tnvm] tp-tin-gc-MSDOS Lnh mcopy sao ni dung cc tp tin c ch nh n cc tp tin c t tn, hoc copy nhiu tp tin n mt th mc t tn. Ngun v ch c th ng thi l tp tin MS-DOS hoc Linux . Vic s dng xc nh tn a trn cc tp tin MS-DOS , v d 'a:', xc nh hng di chuyn d liu. Vic khng xc nh tn a s m ch n mt tp tin Unix c ng dn l th mc hin thi. Nu tn a ngun khng c tp tin i km, chng hn # mcopy a: th mi tp tin trong a s c copy. 179

Linux-VN, cc lnh c bn

Nu ch mt tn tp tin, chng hn # mcopy a:foo.exe ng dn ngun MS-DOS s c cung cp, mt ch mc nh ca th mc hin hnh (``.'') c tha nhn. Mt tn tp tin '`-'' c ngha l ng vo chun hoc ng ra chun, ph thuc vo v tr ca n trn dng lnh. Lnh mcopy chp nhn cc tu chn lnh sau: -b Ch m (Batch mode): Ti u cho vic copy quy ln, nhng khng m bo nu c s c trong qu trnh copy. -/ Copy quy. ng thi copy cc th mc v ni dung ca chng -p Bo qun cc thuc tnh ca cc tp tin c copy. -Q Khi mcopy nhiu tp tin, thot ngay khi mt copy b hng (V d, tit kim b nh trn a ch) -t Chuyn tp tin text, mcopy chuyn i phm xung dng/ tn hiu xung dng nhn c thnh tn hiu xung dng. -n Khng xc nhn khi ghi cc tp tin Unix. mcopy khng cnh bo ngi s dng khi ghi mt tp tin Unix ang tn ti. chuyn thnh khng xc nhn cc tp tin DOS , s dng -o. -m Lu gi thi gian chnh sa tp tin c. Nu tp tin ch tn ti, v tu chn -n khng hin hnh, mcopy hi ghi hoc sa tn tp tin mi (*Xem phn name clash*) . Vng mc Khng nh MS-DOS, tu chn du '+' (b sung) ca MS-DOS khng c h tr. D vy, c th s dng mtype a ra hiu qu tng t: mtype a:tp-tin1 a:tp-tin2 Lnh mdel Lnh mdel c s dng xo mt tp tin MS-DOS, c c php l: 180 > tp-tin-Linux mtype a:tp-tin1 a:tp-tin2 | mcopy - a:tp-tin-MSDOS

Linux-VN, cc lnh c bn

mdel [-v] tp-tin-MSDOS... Lnh mdel hi kim tra trc khi xo b mt tp tin ch c. Lnh mdeltree Lnh mdeltree c dng d xo mt th mc MS-DOS c c php l: mdeltree [-v] th-mc-MSDOS ... Lnh mdeltree xo b mt th mc v tt c cc tp tin v cc th mc con bn trong t mt h thng tp tin MS-DOS. Mt li s xut hin nu th mc cn xo b khng tn ti. Lnh mdir Lnh mdir c dng hin th mt th mc MS-DOS. C php ca lnh ny: mdir [-/] [-f] [-w] [-a] [-X] tp-tin-MSDOS ... Lnh mdir hin th ni dung ca mt th mc MS-DOS, hoc cc mc ca mt s tp tin MS-DOS. Cc tu chn lnh mdir: -/ quy u ra, ging nh tu chn -s ca DOS -w u ra m rng. Vi tu chn ny, mdir in ra cc tn tp tin ra mn hnh theo chiu ngang v khng hin th kch thc tp tin hay ngy to ra tp tin. -a Lit k cc tp tin n. -f Nhanh. Khng c tm b nh trng. Trn cc a ln, vic tm ra s lng b nh trng mt mt khong thi gian ng k, nh vic ton b bng FAT phi c c vo v qut. Tu chn -f s b qua bc ny. Tu chn ny khng cn thit trn cc h thng tp tin FAT32, lu tr kch thc rng. -X Lit k vn tt. Ch lit k mt danh sch ring bit dng mi ca cc tn ng dn m khng c phn trang tr hay thong tin b sung. Mt li s xut hin nu mt thnh phn ca ng dn khng phi l mt th mc. Lnh mdu Lnh mdu c dng lit k b nh m mt th mc chim, bao gm cc th mc con v cc tp tin. N tng t lnh du ca Unix. n v c s dng l clusters. Dng lnh mifo tm ra kch thc cluster. mdu [ty-chn] [ tp-tin-MSDOS ... ] 181

Linux-VN, cc lnh c bn

Vi tu chn: -a Tt c cc tp tin. ng thi lit k b nh m cc tp tin ring l s dng. -s Ch hin th b nh tng, khng chi tit tng th mc con. Lnh mformat Lnh mformat c s dng thm mt h thng tp tin MS-DOS vo mt a nh dng cp thp. C php lnh ny l: mformat [ty-chn] -a: Lnh mformat thm mt h thng tp tin MS-DOS ti thiu (boot sector, FAT, v th mc gc) ln mt a nh dng bng mt nh dng cp thp Unix. Cc tu chn sau c h tr: (Tu chn -S, -2, -1 v -M c th khng c nu bn mstools c bin dch khng c tu chn USE_2M). -t s-tr a cn nh dng c s lng tr (s lng rnh) l s-tr. -h s-mt a cn nh dng c s lng mt l s-mt. -s s-sector a cn nh dng c s lng sector trn mt mt l s-sector. Nu tu chn -2 (ch t mm) c t trc, l s lng sector di 512 byte tng ng vi rnh cng loi (tc l khng c mt 0, rnh 0). Nu tu chn -2 khng c t, l s lng cc sector vt l trn mi rnh (c th ln hn 512 byte). -l nhn a c nh dng c tn l nhn. -S m-kch-thc Kch thc ca sector tnh theo byte l 2^(m-kch-thc +7) -2 sector-rnh-0 Tham s ny theo ch gi 2m cho php kch thc sector rnh 0 mt 0 ln hn thng thng: s lng sector trn track 0, head 0 ca a nh dng l sector-rnh-0. -1 Khng s dng nh dng 2m, thm ch khi kiu a (geometry) hin thi l kiu nh dng 2m. 182

Linux-VN, cc lnh c bn

-M c-sector-phn-mm Kch thc sector nh theo phn mm. Tham s ny m t kch thc sector tnh theo byte c h thng tp tin MS-DOS s dng l c-sectorphn-mm. Ngm nh l kch thc vt l ca sector. -a Nu tu chn ny c s dng, mt s hiu kiu Atari s c to ra. Ataris lu tr s serial ca n trong nhn OEM. -X nh dng a nh mt a XDF. Cc a c nh dng mc thp s dng tin ch xdfcopy nm trng gi fdutils. -C To tp tin nh a ci t h thng tp tin MS-DOS trn . R rng, iu ny v dng trn cc thit b vt l chng hn cc a mm v cc phn vng cng. -H sector-b-che S lng cc sector b che (cn gi l s lng cc sector i trc a lgic) l sector-b-che. Tham s ny rt hu ch cho vic nh dng cc phn vng cng, vi cc ng bin track khng c sp thng hng, chng hn, mt u tin ca rnh u tin khng thuc phn vng nhng li cha mt bng phn vng. Trong trng hp ny, s lng ca cc sector n chung vi s lng cc sector trn cylinder. iu ny ang c kim chng. -n S serial [-0 RATE_ON_TRACK_0] [-A RATE_ON_OTHER_TRACKS] [-1] [-k] -a: -F nh dng phn vng nh FAT32 (ang thc nghim). -I phin-bn-httt t ch s phin bn h thng tp tin l phin-bn-httt khi nh dng mt a FAT32. bit c iu ny, chy minfo trn mt a FAT32 ang tn ti. -c c-cluster t kch thc ca mt cluster (s lng sector trong mt cluster) ca a cn inh dng. Nu kch thc cluster ny to ra mt bng FAT qu ln vi s lng cc bit ca n, mtools s t ng tng kch thc cluster, cho n khi bng FAT nh xung ph hp. 183

Linux-VN, cc lnh c bn

-r s-sector--gc t kch thc (s lng tnh theo sector) ca th mc gc l s-sector-gc. Ch thch hp cho bng FAT 12 bit v 16 bit. -B boot-sector S dng bootsector c lu trong tp tin hay device cho trc (c xc nh bi boot-sector), thay v s dng boot sector ca a cn nh dng. Ch c cc trng nh dng c cp nht ph hp vi cc tham s a ch. -k Gi cc boot sector ang tn ti cng nhiu cng tt. Ch c cc trng nh dng c cp nht ph hp cc tham s a ch. -0 cp--rnh-0 Cp truyn d liu trn track 0 l tc--rnh-0. -A tc--rnh-khc T l chuyn d liu trn cc track khc l tc--rnh-khc. nh dng mt a c mt khc ngm nh, phi cung cp (t nht) cc tham s dng lnh khc vi ngm nh trn y. Lnh mformat tr li gi tr 0 khi thc hin thnh cng v 1 khi li. Lnh ny khng ghi li cc thng tin ca cc khi bad ln bng FAT, s dng lnh mkmanifest lm vic ny. Lnh mkmanifest Lnh mkmanifest c s dng to mt shell script (danh sch ng gi) phc hi cc tn tp tin Unix . C php lnh ny nh sau: mkmanifest [tp-tin] Lnh mkmanifest to mt shell script h tr trong vic phc hi cc tn tp tin UNIX b mt bi gii hn tn tp tin ca MS-DOS. Cc tn tp tin MS-DOS b gii hn trong 8 k t phn tn v 3 k t phn m rng, ch chp nhn kiu ch hoa, khng c trng tn thit b,v khng c cha k t khng hp l. Chng trnh mkmanifest tng thch vi cc phng php c s dng trong pcomm, arc v mstools thay i cc tn tp tin Unix chun ph hp vi gii hn tn ca MS-DOS. Lnh ny ch hu dng khi h thng ch (s c a) khng th kim sot cc tn tp tin di VFAT. V d: Khi sao chp cc tp tin Unix c tn c bit (khng theo quy tc t tn tp tin ca MSDOS) nh sau y ln mt a MS-DOS (s dng lnh mcopy).
very_long_name

184

Linux-VN, cc lnh c bn

2.many.dots illegal: good.c prn.dev Capital

mcopy s chuyn cc tn tp tin thnh:


very_lon 2xmany.dot illegalx good.c xprn.dev capital

Lnh: # mkmanifest very_long_name 2.many.dots illegal: good.c prn.dev Capital >manifest s to ra nh sau:
mv very_lon very_long_name mv 2xmany.dot 2.many.dots mv illegalx illegal: mv xprn.dev prn.dev mv capital Capital

Lu rng tp tin "good.c" khng cn chuyn i nn khng xut hin trong kt qu chuyn. Gi s copy cc tp tin ny t a mm ln mt h thng Unix khc, v by gi mun cc tn tp tin quay tr li tn ban u. Nu tp tin "manifest" (tp tin u ra c c khi thc hin lnh mkmanifest trn) c i km vi cc tp tin ny, n s c dng chuyn i li cc tn tp tin nh c. Vng mc Cc tn ngn c to bi lnh mkmanifest theo cch chuyn i c (t mtools-2.0.7) khng ging trong Windows 95 v mtools-3.0. Lnh minfo Lnh mifor hin th cc tham s ca h thng tp tin MS-DOS, chng hn s cc sector, cc u c v cc cylinder. N cng ng thi in ra mt dng lnh mformat dng to mt h thng tp tin DOS tng t trn mt mi trng khc. Tuy nhin lnh ny khng dng c trn mi trng 2m hoc Xdf, v trn h thng tp tin Dos 1.0. C php lnh 185

Linux-VN, cc lnh c bn

minfo [ty-chn] -a: Lnh mifor c tu chn sau: -v In ra mt hexdump ca bootsector, thm vo cc thng tin khc. Lnh mlabel Lnh mlabel dng thm mt nhn a vo a, c php nh sau: mlabel [-vcs] -a:[nhn-mi] Lnh mlabel hin th nhn a hin thi, nu c. Nu phn nhn-mi khng c cho, v nu tu chn -c hay -s khng c t, n s yu cu ngi s dng nhp mt nhn a mi. xo mt nhn a hin thi, n phm return ti du nhc. V s thn trng hp l, cn phi to mt nhn a MS-DOS hp l. Nu t mt nhn a khng hp l, , mlabel s thay i nhn a (v hin th nhn a mi nu mode chi tit (verbose) c t). Lnh mlabel tr li gi tr 0 khi thc hin thnh cng v 1 khi hng. Lnh mlabel c cc tu chn sau: -c Xo mt nhn a hin thi m khng hi ngi s dng -s Hin ra nhn a hin thi m khng hi ngi s dng Lnh mmd Lnh mmd c s dng to mt th mc con MS-DOS. C php ca n l: mmd [-voOsSrRA] th-mc-MSDOS... Lnh mmd to ra mt th mc trn mt h thng tp tin MS-DOS. Nu tn th mc th-mc-MSDOS cn to tn ti th bo li. Lnh mmount Lnh mmount c dng kt gn mt a MS-DOS. Lnh ny ch c trn Linux, v cng ch hu ch khi nhn OS cho php cu hnh hnh dng ca a. C php ca n nh sau: mmount -a-MSDOS [th-mc-mount] Lnh mmount c boot sector ca mt a MS-DOS, nh cu hnh nh dng a, v cui cng gn vo ch th-mc-mount. Nu khng xc nh i s mount, tn ca thit b s c s dng. Nu a c thuc tnh chng ghi (write protected), lnh ny s t ng mount ch ch c (read only). Lnh mmove Lnh mmove c dng di chuyn hoc i tn mt tp tin hoc th mc MS-DOS 186

Linux-VN, cc lnh c bn

ang tn ti. mmove [-voOsSrRA] Tp-tin-ngun Tp-tin-ich mmove [-voOsSrRA] tin-ich Tp-tin-ngun [Tp-tin-ngun... ] Tp-

Mmove di chuyn hoc i tn mt tp tin hay th mc MS-DOS ang tn ti. Khng nh MOVE ca phin bn MS-DOS, mmove c kh nng di chuyn cc th mc con. Cc tp tin hoc th mc con ch c th di chuyn bn trong mt h thng tp tin. D liu khng th c di chuyn t Dos sang Unix hoc ngc li. Nu b st tn a ca tp tin hay th mc ch, lnh ny s t bng tn a ca tp tin ngun. Nu khng nh tn a cho mi tham s, a a: s ngm nh c t. Lnh mpartition Lnh mpartition c s dng to mt h thng tp tin MS-DOS nh mt phn vng. Lnh ny vi mc ch s dng trn mt h thng khng phi Linux, chng hn cc h thng khng s dng c fdisk v cc truy nhp d dng n cc thit b Scsi. Lnh ny ch lm vic trn cc a c cc bin phn vng c t. C php lnh ny nh sau: mpartition mpartition mpartition mpartition mpartition mpartition -p -r DRIVE DRIVE

-I [-B BOOTSECTOR] DRIVE -a DRIVE -d DRIVE -c [ -s SECTORS] [-h HEADS]

[-t CYLINDERS] [-v [-T TYPE] [-b BEGIN] [-l length] [-f] Lnh mpartition h tr cc tu chn sau: -p In ra mt dng lnh to li phn vng cho a DRIVE. Lnh ny s khng in ra g nu phn vng cho a khng c xc nh, hoc xc nh c mt mu thun no . Nu tu chn chi tit (-v) c t, lnh ny s in ra bng phn vng. -r Xo b phn vng c m t bi DRIVE. -I Khi to bng phn vng, v xo b mi phn vng. -c 187

Linux-VN, cc lnh c bn

To phn vng c m t bi DRIVE. -a "Kch hot" phn vng, chng hn to kh nng boot. Ch c mt phn vng c th boot vo mt thi im. -d "Khng kch hot" phn vng, chng hn khng cho php boot. Nu khng c hot ng no c cho trc, thit t hin thi s c in ra. i vi vic to phn vng, s c cc tu chn sau: -s SECTORS Xc nh s lng cc sector trn track ca phn vng (cng ng thi l s lng ca sector trn track cho ton b a). -h HEADS Xc nh s u c (heads) ca phn vng (cng ng thi l s u c ca ton b a). Ngm nh, thng tin nh dng ny(s lng cc sectors v heads) c tnh t cc mc nhp ca cc bng phn vng bn cnh, hoc c on t kch thc phn vng. -t CYLINDERS Xc nh s cylinders ca phn vng (khng phi s lng cylinder ca ton b a. -b BEGIN Xc nh khong cha trng bt u ca phn vng, xc nh bng cc sector. Nu phn BEGIN khng c t, mpartition s t phn vng bt u t phn u tin ca a (phn vng s 1), hoc ngay sau phn kt thc ca phn vng trc. -l LENGTH Xc nh kch thc (chiu di) ca phn vng, xc n bng cc sector. Nu phn kt thc khng c t, mpartition tnh ra kch thc t s lng cc sectors, heads v cylinders. Nu cc thng tin ny cng khng c cho trc, n s to phn vng ln nht c th, tu vo kch thc a hoc phn bt u ca phn vng tip theo. Cc thao tc chnh sa bng phn vng s c cc tu chn sau: -f Thng thng, trc khi ghi li cc thng tin sa i vo phn vng, mpartition thc hin cc kim tra chc chn, chng hn kim tra xem cc phn vng c gi chng ln nhau khng v nh v c ng khng. Nu mt trong cc kim tra ny hng, bng phn vng s khng c thay i. Tu chn -f cho php b qua cc kim tra an ton ny. Tt c cc thao tc vi phn vng s c cc tu chn sau: 188

Linux-VN, cc lnh c bn

-v i cng vi tu chn -p in ra thng tin bng phn vng hin ti (khng c cc thao tc chnh sa), hoc thng tin sau khi phn vng thc hin cc chnh sa. -vv Nu tu chn chi tit vc a ra hai ln, mpartition s in ra hexdump ca bng phn vng t khi c n n khi ghi n vo thit b. Qu trnh khi to bng phn vng s c tu chn sau: -B BOOTSECTOR c master boot record mu t tp tin BOOTSECTOR. Lnh mrd Lnh mrd c s dng xo b mt th mc con MS-DOS. C php lnh ny l: -mrd [-v] MSDOSDIRECTORY [ MSDOSDIRECTORIES... ] Mrd - xo mt th mc con t mt h thng tp tin MS-DOS. Lnh ny bo li khi tn th mc con cn xo khng tn ti hoc khng rng. Lnh mren Lnh mren c s dng i tn hay di chuyn mt tp tin hoc mt th mc con MS-DOS ang tn ti. C php ca n l: mren [-voOsSrRA] SOURCEFILE TARGETFILE Mren i tn mt tp tin ang tn ti trn mt h thng tp tin MS-DOS. Trong mode chi tit (verbose mode), Mren hin th tn tp tin mi nu tn cung cp khng hp l. Nu c php u tin c s dng (ch mt Tp-tin-ngun), v tn Tp-tin-ich khng cha bt k du xoc cho / hoc du hai chm :, th tp tin hoc th mc s c i tn trong cng th mc hin ti, khng ging nh lnh mmove trong trng hp ny s chuyn n th mc mcd hin thi. Khng ging lnh ren ca phin bn MS-DOS, mren c th s dng i tn cc th mc. Lnh mshowfat Lnh mshowfat c s dng hin th cc mc nhp bng FAT cho mt tp tin. C php lnh: mshowfat Tp-tin Lnh mtoolstest Lnh mtoolstest dng kim tra cc tp tin cu hnh mtools. gi lnh ny ch cn g mtoolstest m khng cn i s no. Mtoolstest c cc tp tin cu hnh mtools, v in cu hnh lu tch (cumulative configuration) ra thit b ra chun. Bn thn kt qu c th s dng nh mt tp tin cu hnh (mc d c th mun xo b cc mnh tha). C th s dng chng trnh ny 189

Linux-VN, cc lnh c bn

chuyn i cc tp tin cu hnh kiu c thnh cc tp tin cu hnh mi. Lnh mtype Lnh mtype c dng hin th ni dung ca mt tp tin MS-DOS. C php ca n l: mtype [-ts] MSDOSFILE [ MSDOSFILE... ] Mtype hin th tp tin MS-DOS c ch nh ln trn mn hnh. Ngoi cc tu chn chun, mtype cn cho php cc tu chn dng lnh sau: -t Xem ni dung tp tin vn bn. Mtype c th dch cc phm xung dng/tn hiu chuyn dng. -s Mtype b i cc bit cao ca d liu. Lnh mtype c th dng thit lp cc thit b v cc th mc lm vic hin thi (tng t MS-DOS), mt khc, ngm nh l `A:/'. Mtype tr li gi tr 0 khi hon thnh, 1 khi hng hon ton, hoc 2 khi hng mt phn. Khng nh type trong phin bn ca MS_DOS, mtype cho php s dng nhiu i s. Lnh mzip Lnh mzip dng a ra cc lnh a ZIP c th trn Solaris hay HPUX. C php lnh ny l: mzip [-epqrwx] Mzip cho php s dng cc tu chn dng lnh sau: -e a a ra ngoi. -f Bt buc a a ra thm ch khi a ang c kt ni (phi c t thm trc vo tu chn -e). -r Xc lp a chng ghi. -w B thuc tnh chng ghi ca a. -p t Password chng ghi. -x 190

Linux-VN, cc lnh c bn

t Password bo v -u G b tm thi cc c tnh bo v a cho n khi a a ra ngoi. Khi t tu chn ny, a s ghi c, v chuyn li trng thi bo v c sau khi a a ra ngoi. -q Truy vn trng thi g b mt khu, t a vo mt trong cc mode khng bo mt `-r hoc `-w: mzip s hi mt khu, v sau g b ch bo mt ca a. Nu qun mt khu, c th khc phc bng cch nh dng cp thp a (s dng BIOS setup ca SCSI adaptor). a ZipTools c chuyn cng a cng c t ch bo mt bng password. Trn mt h Dos hoc Mac, mt khu ny c t ng xo khi ZipTools c ci t. Mzip bit mt khu ny, v th n u tin trc khi hi mt khu ca bn. V vy mzip -w z: g bo mt cho a tools . da tools c nh dng theo mt cch c bit nn c th s dng c trong PC v trong Mac. Trn mt PC, h thng tp tin Mac nh mt tp tin n c tn partishn.mac. C th xo n c thm 50 Meg b nh b chim bi h thng tp tin Mac. Lnh xcopy Script xcopy c dng sao quy mt th mc n mt th mc khc. C php ca n nh sau: xcopy Th-mc-ngun Th-mc-ich Nu th-mc-ch khng tn ti, n s c to ra. Nu tn ti, cc tp tin ca th mc con s c copy thng n , v khng c Th-mc-ngun no c to ra, khng nh vi cp -rf.

191

Linux-VN, cc lnh c bn

Ph lc A. Qu trnh ci t Linux A.1. Gii thiu s b v Linux Nu chng ta ang tm mt H iu hnh c tc cao, ng tin cy, khng t tin, c th cho nhiu ngi dng cng s dng mt lc, c kh nng lm server cho mng Internet ng thi h tr cc giao din bt mt th chnh l Linux. Khp ni trn th gii, mi ngy c hng ngn ngi dng mi mun khm ph sc mnh ca h iu hnh c b m ngun m, v c xut x t Unix ny. Vy c nhng b n th v no bn trong Linux ? Trc ht kh m lm cho Linux b ngng tr v t lit. c ni th nghim nhiu h thng chy Linux lin tc hng nm tri m khng phi khi ng li. Linux c th chy trn cc my tnh th h c vn khng th chy Windows 95, 98, thm ch c nhng my 486 vt trong nh kho. Trn y l nhng im khin Linux c nhiu ngi ng h. Th nhng vic ci t h iu hnh ny c th lm lo lng. Linux c phn phi t do nn c nhiu cng ty tm cch a ra th trng bn phn phi ring ca h. Ngoi chng trnh Linux ct li, khc nhau c bn phn mm i km v cch thc ci t. Cc nh phn phi Linux ph bin hin nay l Red Hat Software, Caldera, Slackware, S.U.S.E v Debian. Trong ph lc ny chng ta gii thiu qu trnh ci t bn Linux ca Red Hat Software 6.2. A.2. Chun b cho vic ci t Linux s dng phn cng ca my PC hiu qu hn MS-DOS, Window hay WinNT, v do kh nng chu cc li do cu hnh sai phn cng s km hn. phi lm mt s vic trc khi bt u ci t gim thiu cc kh nng khng th ci t tip khi gp phi vn ny. Trc tin, hy c gng tm cng nhiu cng tt cc ti liu v phn cng my PC m mnh nh ci, nh mainboard, card ho, mn hnh, modem... v chng ni c th tm thy v tra cu d dng. Tip theo, tm hiu thng tin v phn cng my tnh ca v tp hp chng li. C th lm iu ny khi s dng chc nng in cu hnh my ca mt s tin ch nh MSD trong DOS, hoc System Information trong Windows. Nhng thng tin chnh xc v bn phm, chut, mn hnh... s gip rt nhiu trong qu trnh cu hnh X sau ny. Sau , kim tra phn cng my tnh ca tm ra cc vn nu c, bi chng c th lm qu trnh ci t Linux b treo sau ny. Sau y l mt s vn thng gp: Mt h thng DOS hay Windows c th qun l a IDE v CDROM c khi jumper master/slave khng c t ng. Trong khi Linux s khng gii quyt c vn ny. V vy nu c nghi ng hy xem li cc jumper ny c t ng cha. Mt s thit b ngoi vi cn c nhng tin ch t cu hnh cho chng khi my khi ng. Cc thit b nh card mng, CD-ROM, card m thanh hoc bng t c th gp phi vn ny. Nu trng hp ny xy ra, c th s dng lnh t cu hnh li ti du nhc khi ng. 192

Linux-VN, cc lnh c bn

Mt s h iu hnh khc cho php chut dng bus chia s mt IRQ vi cc thit b khc, trong khi Linux khng h tr iu ny. Nu th lm th, h thng c th b treo. Nu c th hy ghi s in thoi ca mt ngi dng Linux c kinh nghim v gi cho h khi cn thit, hoc cc c th gi cho chng ti theo s in thoi 7761075, chng ti s rt vui khi c gii p nhng vng mc ca cc . Cn tin hnh cng vic chun b thi gian cho vic ci t. Qu trnh ci t c th ko di mt ting hoc hn vi nhng h thng ch ci Linux, hoc ln ti 3 ting vi h thng cn chy nhiu h iu hnh khc nhau (thng vi nhng h thng ny kh nng b treo my hoc c li khi ci s cao hn). A.3. To a mm khi ng Bc ny ch cn thit khi khng th khi ng t CD-ROM. Nu mua Red Hat Linux trc tip t Red Hat Linux th chng ta s nhn km a khi ng. Cn nu mua bn copy t cng ty th 3, chng ta phi t to a khi ng v cch to l nh sau : Trong Windows, a a mm vo . Bm phm phi chut vo desktop to folder mi, t tn Bootdisk ri m folder ny. a a CD Red Hat vo CD. M My Computer, nhn vo CD, m folder c tn Dosutils, nhn vo file Rawrite, bm phm phi chut v ko n vo Bootdisk. Chn Copy here t menu xut hin. ng ca s Dosutils. M folder Images trong CD-ROM. Chp file Boot.img vo folder Bootdisk, ging nh lm vi Rawrite. Chn Start.Run g vo Command trong hp hi thoi, nhn OK. Mt ca s xut hin vi du nhc DOS C:\Windows\Desktop. G vo cd bootdisk, nhn Enter. By gi chng ta hon tt vic to a mm khi ng: g rawrite ti du nhc DOS. Nhp boot.img l tn file mun copy, nhn Enter. G a:\ (tn a mm), v nhn Enter khi c hi ch. A.4. Phn vng li a DOS/Windows hin thi Trong hu ht cc h thng c s dng, cng thng c phn vng cho MS-DOS, OS/2,... Chng ta cn phi thay i kch thc, sp xp li cc phn vng ny to ch trng cho vic ci t Linux. Cch tt nht lm vic ny l dng phn mm PQMagic ca Power Quest. Dng phn mm ny, c th di chuyn / thay i kch thc / thm / xo / format cc phn vng trong cng mt cch d dng vi giao din ho. Cn vic dng FDisk ca MS-DOS th cc k vt v, mun di chuyn / thay i kch thc ca mt phn vng no , u tin phi backup tt c cc d liu trong phn vng, xo phn vng (vic ny s lm mt cc thng tin v d liu trong phn vng), tip theo l to mt phn vng mi vi kch thc mong mun, cui cng l restore li ton b d liu backup vo phn vng mi to ny! Nh vy chng di g m chng ta li khng dng mt phn mm min ph cc mnh nh PQMagic.

193

Linux-VN, cc lnh c bn

A.5. Cc bc ci t (bn RedHat 6.2 v khi ng t CD-ROM) a a CDROM Redhat 6.2 vo CD, sau trong BIOS SETUP ta t ch khi ng t CD. Khi khi ng li my, qu trnh s c boot t CDROM. Sau y l chi tit qu trnh mt a khi ng ci t tin hnh. A.5.1. La chn ch ci t H thng a ra cc ch cho chng ta la chn : G Enter chn ch ci t ha. G text + Enter chn ch Text. G expert + Enter chn ch Expert. Chn ch ny c ngha chng ta t chn cu hnh phn cng cn hai ch trn s t ng detect. G linux ks + Enter chn ch ci t t mng hoc t a mm. A.5.2. La chn ngn ng hin th. H thng a ra rt nhiu ngn ng cho chng ta la chn, v d nh Czech, English, French, German.... Thng l chn English. A.5.3. La chn cu hnh bn phm Linux i hi la chn cu hnh bn phm t cc m hnh sau: Model : Brazilian ABNT 2 Dell Generic. Microsoft. ................. Chng ta s la chn bn phm tng thch theo cc dng trn, nu khng r bn phm ca chng ta thuc loi no th nn chn kiu Generic. Layout: Ngn ng s dng g (khong 24 ngn ng) Variant: C 2 ch l. Eliminate Dead Keys (khi chng ta s dng cc k t c bit). None (kiu mc nh). Test: chng ta s g cc phm kim tra th. A.5.4. Chn cu hnh chut. H thng a ra 10 loi chut chng ta la chn loi tng thch vi chut ca mnh, nu khng bit r chut chng ta thuc loi no th nn chn kiu Generic. V phi chn ng kiu chut l PS/2 hay Serial nu khng th s khng s dng c chut.

194

Linux-VN, cc lnh c bn

A.5.5. H thng a ra li gii thiu v bn Red Hat ang ci t. A.5.6. La chn kiu ci t. Install (ci mi) gm c cc ch : GNome Workstation. KDE Workstation. Server Custom Upgrade (Nng cp) Tu chn ci t WorkStation. Nu chng ta la chn kiu ci mi l GNome Workstation hoc KDE Workstation th h thng s ci t X Window System v chng trnh qun l Desktop theo dng GNome hoc KDE. Nu cha tho lm v Linux th hy s dng tu chn ny, n s b qua nhiu bc. La chn Custom l ph hp nht i vi ngi quen vi Linux. C hai la chn WorkStation ny s chun b cc vic sau: Nu a cng ca cha h c phn vng trc , Linux s xo ht tt c cc phn vng trn cc a cng v ci t cc phn vng sau: + Mt phn vng swap kch thc 64MB + Mt phn vng root (c mount l / ) cha ng mi file c ci t. Ch l chng ta s phi cn ti thiu 600MB cng tin hnh ci t theo kiu WorkStattion. Nu h thng c ci sn Windows (Windows 3.1/95/98), kiu ci t WorkStation s t ng cu hnh h thng khi ng ch song song s dng LILO. Tu chn ci t Server Nu chng ta la chn kiu ci t mi l Server th h thng s ci t theo kiu my ch Linux v cng nh kiu WorkStation, tu chn ny s trnh cho chng ta phi cu hnh nhiu thnh phn phn cng. V khi ci t theo kiu ny th chng ta nn cn thn v h thng s xo tt c cc partition trn tt c cc a. V vy, ch chn kiu ci t Server nu chc chn trong cng khng c mt d liu g c. Sau y l cc bc m kiu ny tin hnh phn vng a: + To mt phn vng Swap kch thc 64MB. + To mt phn vng kch thc 256MB vi mount point l /. + To mt phn vng kch thc ti thiu 512MB c mount l /usr. + To mt phn vng ti thiu 215MB c mount l /home. + To mt phn vng kch thc 256MB c mount l /var. Nh vy chng ta phi cn ti thiu 1.6BG cng tin hnh ci t theo kiu Server. Tu chn ci t Custom 195

Linux-VN, cc lnh c bn

i vi kiu Custom h thng s cho chng ta t chn cc thnh phn v cu hnh phn cng ci t mt cch y nht, tuy nhin cng ri rm v phc tp nht. T bc 7 tr i, chng ti s ch gii thiu v tu chn ci t ny. Sau y s gii thiu tng qut mt s bc m qu trnh ny thit t: To cc phn vng: cn phi ch r Redhat s c ci t vo phn vng no. Format cc phn vng: Nhng phn vng mi c thm vo s phi c format li theo nh dng Linux filesystem. Tuy nhin cng c th la chn phn vng no cn phi format. La chn v ci t cc gi phn mm i km: Thc hin sau khi phn vng a cng. Thit t cu hnh LILO: c th la chn ci t LILO vo Master Boot Record hoc Sector u tin ca phn vng Root hoc khng la chn ci LILO. A.5.7. Xc nh cc Partition u tin chng ta phi xc nh cc im kch hot (mount point) cho mt hoc nhiu partition. Trong bng partition c cc thng tin sau: Mount Point: Xc nh partition no s c kch hot khi Linux c ci t v chy. Nu partition tn ti v c nhn l not set th chng ta s xc nh mount point bng cch kch chut vo nt Edit hoc double - click trn partition. V h thng khuyn chng ta nn to cc partition theo cch sau: Mt swap partition (t nht 16MB) - dng h tr b nh o. Nu my chng ta c 16Mb Ram hoc t hn th bt buc chng ta phi to swap partition. Thm ch nu c nhiu b nh hn, chng ta cng nn to swap partition. Kch thc ti thiu ca swap partition = max {b nh Ram v 16Mb}. Mt boot partition (ti a 16Mb) - cha nhn ca HH cng vi cc file trong qu trnh khi ng. Mt root partition (t 500Mb - 1Gb) l ni cha th mc gc v tt c cc file (tr cc file trong boot partition). Vi 500Mb cho php ci theo kiu Workstation v vi 1Gb cho php ci mi th. Device: Hin tn cc device partition (V d: hda2 i din cho partition th 2 trn cng primary). Request: Cho bit khng gian m partition hin c. Nu mun thay i kch thc th chng ta phi xo partition v to li bng cch dng nt Add. Actual: Cho bit khng gian m partition ang s dng. 196

Linux-VN, cc lnh c bn

Type: Cho bit kiu ca partition. V chng ta c th add, edit, v delete cc partition bng cch kch chut vo cc nt . Chc nng ca tng nt l: Add: Dng to mt partition mi, gm c cc thng tin sau: Mount Point: gm c cc kiu /: /boot : /usr : /home : /var : /opt : /tmp : /usr/local : Size (Megs): chn kch thc ca partition. Grow to fill disk: nu chn th partition ny s s dng ton b vng a trng cn li. Partition type: gm c cc kiu Linux Swap: chn kiu ny nu chng ta mun to partition swap. Linux Native : chn kiu ny nu chng ta mun to partition root. Linux RAID : DOS 16-bit < 32 : DOS 16-bit > 32 : Edit: Dng thay i mount point ca partition. Delete: Dng xo partition. Reset: Khi phc li nhng thay i. Make RAID Device: S dng Make Raid device ch khi chng ta c kinh nghim v RAID. Drive Summaries: hin th thng tin v cu hnh a. A.5.8. Chn Partition Format. Gm c cc thng tin: Partition mun Format. La chn Check for bad blocks while formating 197

Linux-VN, cc lnh c bn

Chng ta s chn Check for bad blocks while formating tm ra nhng bad bocks trn a sau s nh du li nhm khng ghi d liu ln chng na. A.5.9. Chn cu hnh LILO (Linux Loader) chn cu hnh LILO, phi khng t du kim Do not install LILO. Nu Linux Native c tn l /dev/hda5 th mn hnh s hin ra cho php ci t chng trnh np Linux vo Master Boot Record (MBR) hoc First Sector of boot partition (sector u tin ca phn vng khi ng). Ni chung l nn chn Master Boot Record c th khi ng t nhiu . Nu c cc a SCSI hoc a cng ca h tr LBA th cn phi nh du kim vo mc Use Linear Mode. Kernel Parameters: Cc tham s s dng bt c khi no nhn c khi ng. Bng di s cho bit thng tin v cc phn vng: tn phn vng, loi phn vng, c phi l phn vng khi ng khng ?. cn chn phn vng khi ng l phn vng c tn Linux (thng l phn vng m Redhat s t mc nh v chng ta khng phi thay i g). Nu c phn vng tn l dos, chnh l phn vng trc khi ci t th sau ny mi khi khi ng my tnh, chng ta c th chn phn vng ny khi ng mt cch bnh thng bng cch g tn phn vng ti du nhc LILO Boot trong qu trnh khi ng. c th thay i tn ca phn vng tng ng trong phn Boot Label. Tu chn Create boot disk: ch cn chn mc ny nu khng ci LILO hoc ci LILO nhng khng ci vo MBR. Ch l nu khng ci LILO th bt buc phi chn mc ny khi ng t a mm. A.5.10. Chn mi gi Nu ci trong ch ha, mn hnh mc nh s hin ra mt bn th gii. C th thay i bn theo cc kiu sau: World (bn th gii) North American (Bc M) South American (Nam M) Pacific Rim (Chu c) Europe (Chu u) Africa (Chu Phi) Asia (Chu ) i vi Vit Nam ta th chn Asia/Saigon (trong a CD ci t LinuxVN th mc chn l Asia/Hanoi). C th chn mi gi theo kiu UTC Offset (Universal Time Coordinated), tc l kiu GMT +/- lch. Nu h thng gi s ti s dng UTC th chn mc System clock uses UTC. A.5.11. Thit t cu hnh Account (ngi s dng) Nh bit Linux k tha t Unix, do n cng h tr ch a ngi dng nh Unix. 198

Linux-VN, cc lnh c bn

Bn ci t Redhat cho php t lun cu hnh ngi dng ngay trong qu trnh ci t. u tin chng ta cn t mt khu cho ngi dng Root trong phn Root Password v xc nhn li mt khu ny trong mc Confirm. Ch l mc nh tt c cc mt khu u phi ti thiu 6 k t. Sau ta c th thm ngay mt s ngi dng u tin: Tn t trong Account Name, g password trong mc Password v xc nhn mt khu trong mc Password (confirm) ngay bn cnh, tn y ca ngi dng trong mc Full Name. Sau g phm Add th thm ngi dng mi vo danh sch cc ngi dng. Phm Edit cho php hin th ngi dng hin hnh trong bng danh sch ngi dng , phm Delete xo ngi dng hin thi. A.5.12. Thit t cu hnh quyn hn (Authentication Configuration) C cc mc sau: Enable MD5 Password: cch m ho ny cho php mt khu di ti 256 k t. Shadow Password: y l cch bo mt ti a cho mt khu, file cha mt khu /etc/passwd s c thay bng etc/shadow v file ny ch c php hin th bi ngi dng Root. Chn c 2 mc ny s tng tnh bo mt ca h thng. Enable NIS: chn mc ny nu my tnh kt ni vo mng NIS (Network Information System) cho php mt nhm my tnh trong vng Network Information Service vi cng mt password. NIS domain: tn ca domain hoc nhm my tnh cha h thng. NIS server: cho php my tnh dng mt NIS server rng, hn l mt thng ip rng ri trong mng LAN. A.5.13. La chn cc gi phn mm ci t (Pakage Selection) C rt nhiu mc chn s ni chi tit phn sau nh: Printer Support, h thng X Window, GNome, KDE, DOS / Window Connectivity,.... La chn Everything s ci y tt c mi th, do cn phi la chn cc gi phn mm ph hp nu Linux Native / khng . Cc packages c th c chn ci t bao gm: Printer Support: Nu c ci Linux s c gng nhn my in hoc cho php ngi dng thit lp cc thng s v my in ca h thng. X Window System: Mi trng ha nguyn thu trong Linux, c gi tt l X. X khng phi l mt giao din ha ngi dng thc s m ch l mt h ca s cng vi cc cng c mt giao din ha ngi dng c th c xy dng t . GNOME: L mt giao din ha ngi dng p hn, tin li v thn thin hn X, GNOME cng cung cp mt giao din lp trnh mc cao hn to ra cc ng dng vi giao din kiu GNOME. KDE: KDE l mt giao din ha ngi dng c pht trin da trn th vin giao din ha C++ Qt. Th vin giao din ny h tr UNIX, Windows v c Mac. Do c pht trin trc GNOME nn KDE c nhiu im tt hn. 199

Linux-VN, cc lnh c bn

Mail/ WWW/ News tools: B cng c dng gi, nhn th tn in t, duyt Web v c cc bn tin. Dos/ Windows Connectivity: B gi lp DOS v Windows cho php ngi dng chy cc ng dng DOS v Windows ngay trong Linux. Graphic Manupulation: Cc tin ch ha nh Gview, Imgedit... cho php trnh din v x l cc tp tin hnh nh. Games: Mt s chng trnh tr chi gii tr trong ch text hoc X Window. Multimedia Support: Cc chng trnh h tr a phng tin, nh nghe midi, wave, mp3... iu khin joystick, thu m ... Dialup WorkStation: Cho php ngi dng s dng modem v quay s s dng cc dch v qua ng in thoi nh gi nhn mail, web... News Server: Cung cp dch v my ch news, cho php my tnh tr thnh mt server bn tin. NFS Server: My ch h thng file mng NFS (Network File System). SMB Server: My ch h thng file mng Samba. IPX/ Netware Connectivity: Gip h thng chy Linux giao tip vi cc my tnh khc qua mng Netware s dng giao thc IPX. Anonymous FTP Server: Ci t package ny gip my tnh tr thnh mt my ch FTP (File Transfer Protocol), c th cung cp dch v truyn file cho cc my khc trong mng. Web Server: Ci t package ny gip my tnh tr thnh mt my ch Web, c th cung cp dch v web cho cc my khc trong mng. DNS Name Server: Ci t package ny gip my tnh tr thnh mt my ch DNS, c th cung cp dch v t tn vng cho cc my khc trong mng. Postgres (SQL) Server: Ci t package ny gip my tnh tr thnh mt my ch SQL, c th cung cp dch v truy vn d liu cho cc my khc trong mng. Network Management Workstation: Gip my tnh trm lm vic iu hnh tr thnh mt my ch SQL, c th cung cp dch v truy vn d liu cho cc my khc trong mng. TeX Document Formatting: H son tho v nh dng vn bn di dng Tex. Emacs: H son tho vn bn n gin. Development: Cc b bin dch, g ri, cng c pht trin phn mm ... di cc ngn ng nh Perl, C, C++. M ngun ca cc chng trnh trong Linux. Kernel Development: M ngun nhn Linux v b cng c pht trin dnh cho pht trin nhn Linux. Extra Documentation: Mi ti liu v Linux c trong a CD, di nhng ngn ng nh Anh, Php, Italia, Ty Ban Nha... 200

Linux-VN, cc lnh c bn

Utilities: Cc tin ch cho Linux. A.5.14. Thit t cu hnh X (X Configuration) Phn ny s t cu hnh card mn hnh th hin khi chng ta s dng cc h thng X Window. V d sau y l mt s thng s hin th khi chng ta ci t: Video Card: ATI Mach64 Video Ram: 4096KB X server: Mach64 Monitor: 14 COLOR qut ngang: 30 - 54 Khz qut dc: 50 - 120 Hz y l phn kh quan trng, nu card mn hnh ca khng phi l dng chun th s phi ci bng tay, mt cng vic kh mt mi. Tt nht l nn sm mt chic card mn hnh loi chun m c mt cht cng c. Test this Configuration: n vo y kim tra tnh nng ho c hot ng tt khng, nu mn hnh ca qua khi cuc kim tra ny th c th coi l thnh cng ti 90% qu trnh ci t Redhat. Customize X Configuration: Nu chn mc ny th ghi g Next, Redhat s cho mt bng cho thit lp bng tay cc ch ha 8 bits, 16 bits, 32 bits; cc ch phn gii 640x480, 800x600, 1024x786, ... Ch l khi chn phn gii no th lun lun g phm Test this Configuration m bo mn hnh ca lun hin th ng. (Nu mun bit r hn v phn ny, hy c ph lc 2) A.5.15. Bt u qu trnh copy t a CD vo cng Bc cui cng ny s thc hin cc bc format Linux Native / (nu chn phn trc), format Linux Swap, v sau l gii nn tt c cc gi phn mm m la chn trong bc th 13 vo cng. Qu trnh ny mt khong 10 pht n 20 pht tu theo s lng cc gi chn. Kt thc qu trnh ny, g Exit, khi ng li my, nh tho a CD Redhat ra khi bt u khi ng t cng. Cuc chu du vo th gii Linux ca bt u t y! A.6. Cc hn ch v phn cng i vi Linux A.6.1. Cc b vi x l m Linux h tr Linux ch yu chy trn cc my PC th h 386, 486, 586 s dng cc phn cng h vi x l 80386. Vic ci t trn cc phn cng khc th vn ang trong giai on thit k. C th chy th Linux bng mt my vi phn cng ti thiu l: b vi x l Intel 386, 486, 586, 4MB RAM v mt mm. D nhin l cng nhiu RAM th cng tt. Linux h tr VESA Local Bus v PCI. Linux cng h tr phn ln cho cc cng chun ESDI v MCA (bus c quyn ca 201

Linux-VN, cc lnh c bn

IBM). Linux cng c th chy trn cc laptop h 386. C mt cch ci t Linux trn 8086 c bit n di tn gi ELKS (Embeddable Linux Kernel Subset). y l mt nhn Linux 16 bit c ch yu s dng trong cc h thng nhng. Thc ra phin bn Linux hin nay s khng th chy c y trn 8086 hay 286 bi v nhng b vi x l ny khng h tr cho vic chuyn i tc v cng nh qun l b nh. Linux h tr a qu trnh cho cc kin trc Intel MP. Di y l danh sch cc b VXL m Linux h tr: Dng 68000 ca Amigas v Ataris hin ang c trin khai nghin cu. Cc phin bn GNU/Linux cng c th ci t cho cc nn Alpha, Sparc, PowerPC, ARM. Mt d n v Linux trn PPC cng c tin hnh. Hin ti Apple h tr MkLinux trn cc Power Macs da trn OSF ca Mach vi nhn. Linux cho my 64 bit DEC Alpha/AXP. Hin ti ngi ta cng ang nghin cu v Linux cho MIPS, bt u i vi R4 trn cc my Deskstation Type. Hin ang c 2 bn Linux cho dng my dng h vi x l ARM. Mt l ca vi x l ARM3 trn cc my Acorn A5000 v n cn bao gm c cc thit b I/O cho 82710. Cn li l cho h vi x l ARM610 ca my Acorn RISC PC. Linux cho SPARC ang c tin hnh. Cng c bn Hardhat cho cc my SGI/Indy. A.6.2. Cc yu cu v khng gian cng i vic ci t ti thiu l 10 MB, ch yu l th ch khng c nhiu cc tnh nng khc. Ta c th ci t thm X vi khong 80 MB. Nu ci t c b GNU/Linux s cn khong 500MB-1GB bao gm c m ngun v nhiu th khc na. A.6.3. Cc yu cu v b nh Ti thiu l 4MB. Ta c th s dng swapping chy thm cc ci t khc. Linux ni chung l chy tng i thoi mi vi 4MB Ram nhng cc ng dng X Windows s chy chm bi v chng cn phi thc vic swap vo ra trn a. Mt vi ng dng hin ti li ch chy bnh thng vi 64MB b nh vt l chng hn nh Netscape. Linux c th s dng c bao nhiu dung lng b nh ? Thc ra cng cha c ti liu no ni chnh xc v vn ny nhng hin ti th Linux c th h tr c 128MB Ram. Ta c th lm thm cc th nghim khc kim chng kh nng qun l b nh ca Linux. 202

Linux-VN, cc lnh c bn

A.6.4. S tng thch vi cc h iu hnh khc: DOS, OS/2, 386BSD, Win95 Linux s dng sp xp phn dng ging nh MS-DOS do n c th chia s a vi cc h iu hnh khc. Tuy vy, iu ny cng c ngha l cc h iu hnh khc cng c th khng hn l hon ton tng thch. Cc trnh Fdisk v Format ca Dos thnh thong li c th vit ln d liu trong phn vng ca Linux bi v chng c th s dng cc thng tin phn vng sai lnh t boot sector ca phn vng ch khng phi l t bng phn vng. trnh hin tng ny, mt tng l a v 0 a ch bt u ca mt phn vng va mi to lp trong Linux trc khi s dng cc lnh format ca MS-DOS. S dng lnh sau: $ dd if=/dev/zero of=/dev/hdXY bs=512 count=1 Vi hdXY l phn vng lin quan, chng hn /dev/hda1 l phn vng u tin trn a IDE u tin. Linux c th c v ghi cc file trn cc phn vng FAT ca DOS v OS/2 v cc a mm bng cch s dng h thng file DOS c tch hp vo nhn hoc cc cng c mtool. Nhn cng cung cp h tr cho h thng file VFAT ca Windows 9x v Windows NT. Hin ti cc a phn vng theo NTFS cng ang c nghin cu h tr cng vi vic h tr nn a nh l mt tnh nng chun. Linux cng c th truy cp c ti h thng file HPFS ca OS/2 nhng ch ch read-only. Ngi ta c th thc hin iu ny nh mt la chn khi bin dch nhn. Linux cng h tr cho vic thao tc trn cc nh dng AFFS (Amiga Fast File System) t bn 1.3 tr v sau bng cch nh mt la chn lc bin dch hay nh mt m un ring. Tuy vy, iu ny cng ch dng mc ch c. Cc truy cp a mm th cha c h tr bi v s khc bit gia cc iu khin a ca PC v Amiga. i vi cc my chy cc h iu hnh ca Unix nh BSD, System V... th cc nhn hin ti cng mi ch c th c h thng file UFS trn System V, Xenix, BSD, mt s sn phm tha k khc nh SunOS, FreeBSD, NetBSD, NeXTStep. H tr UFS cng c coi nh mt la chn lc bin dch nhn hay nh mt m un. Linux cho php c/vit trn cc a SMB ca cc nhm Windows v WinNT. C mt chng trnh tn l Samba cho php truy cp v h thng file mng WfW (min l dng giao thc TCP/IP) . i vi cc my Macintosh th c mt tp hp cc chng trnh cp ngi dng c th c, ghi trn HFS (Macintosh Hierarchical File System). Liu ta c th chy mt chng trnh Windows trong Linux? Mt chng trnh tn WINE ang c nghin cu m phng mi trng Windows trong Linux. Hin ti khi mun dng hai h iu hnh cng lc vi Linux th ta c chng trnh LILO boot. LILO boot bt buc ta phi la chn h iu hnh vo lc khi ng. Ngoi ra, cn c mt chng trnh tn LOADLIN l mt chng trnh DOS cho php np Linux (cng nh bt k h iu hnh khc) khin cho Linux cng tn ti vi DOS. LOADLIN c bit hu dng khi ta mun ci Linux trn cc a th 3, 4 ca h thng (hoc khi ta thm mt SCSI vo mt h thng c cha IDE). Trong trng hp ny th LILO boot s khng c kh nng tm kim v np nhn. Do ta s phi to mt th mc chng hn C:\LINUX, t LOADLIN vo trong cng vi mt bn copy ca nhn v ri s dng n. 203

Linux-VN, cc lnh c bn

Ch : Cn to t nht mt phn vng Linux di gii hn 1024 cylinder logic.

204

Linux-VN, cc lnh c bn

Ph lc B. m thanh trong linux Ph lc ny trnh by cch thit lp cu hnh cho card m thanh trong Linux, gii thiu mt s chng trnh ng dng h tr m thanh v mt s gi chng trnh ng dng m thanh cn thit cho bn phn phi Linux. B.1. Khi qut v Soundcard m thanh l dng tn hiu tng t, my tnh l thit b s. Do sound card s dng mt b chuyn i AD (Analog to Digital Converter) chuyn m thanh tng t (dng sng) thnh cc gi tr s c th ghi vo b nh. Mt b chuyn i DA (Digital to Analog Converter) chuyn cc gi tr dng s tr li thnh tn hiu tng t m c th a tr li loa pht ra m thanh. Qu trnh chuyn i t analog sang digital c x l bng cch ly mu. Tn s ly mu l s cc mu trn mt n v thi gian (thng c biu din bng Hertz). Cc sound card thng thng s dng cc mu 8 bt hoc 16 bt vi tn s ly mu t 4000 n 44.000 mu/giy. Cc mu ny cng c th c cha trn mt knh (mono) hoc hai knh (stereo). B tng hp FM (Frequency Modulation): dng b sung cho b chuyn i DA, nhng n kh iu khin hn v khng mm do bng. Wavetable Synthesis l s kt hp mm do ca b chuyn i DA vi kh nng a knh ca b tng hp FM. Lc m thanh s ny c th np vo b nh, chi, tng hp v sa m thanh. Hu ht cc sound card u cung cp kh nng trn v phi hp cc tn hiu. MIDI (Musical Instrument Digital Interface): l mt chun phn cng v giao thc phn mm cho php truyn thng vi cc dng c nhc. D liu c truyn trn bus MIDI v cng c th ghi thnh cc tp tin MIDI son sa (edit) v chi li (playback). Cc tp tin ny cha cc mu c s ho cho cc dng c (hoc cc m ging). Cc tp tin nh dng thng thng i vi cc tp tin nhc gm: wav, mpeg (I, II, III), .mid, .mod, .au (ca Sun), .snd (ca Mac), .voc, v.v... B.2. H tr phn cng H iu hnh Linux hin h tr cho hu ht cc loi Sound card thng dng v nhiu card m phng theo cc loi c h tr khc. Cc loi card c h tr hin nay gm cc kiu card sau: Cc card SoundBlaster, SoundBlaster Pro, SoundBlaster 16, AWE ca Creative Lab v hu ht cc h thng tng thch vi SoundBlaster, gm Stereo F/X ca ATI, Thunderboard... H Adlib ca Adlib v cc card tng thch. ProAudio Spectrum v card SoundMan 16 ca Logitech. Cc card Gravis UltraSound ca Gravis. Microsoft Sound System ca Microsoft. 205

Linux-VN, cc lnh c bn

Cc card v cc giao din da trn MPU 401 MIDI.

Thng tin v cc loi card c h tr mi nht c th tm thy trong th mc /usr/src/linux/Documentation/sounds/ ca bn phn phi Linux hoc Linux Sound HOWTO. Tng ng vi tng loi card sound thng c mt tp tin ghi cc hng dn tm tt v ci t v cc phng php, cc thng s thit lp cu hnh cho sound card . Mt s tp tin c bit cn tham kho: Introduction ghi cc ch v sound driver v thit lp cu hnh cho card; tp tin Readme gii thiu v cc loi card c h tr v tr gip v cc thit lp cu hnh modules cho card sound. Ngoi ra ta c th tm cc thng tin tr gip trong cc tp tin Readme trong th mc /usr/src/linux/drivers/sound/. Hu ht cc Sound card u nhn l tng thch vi Sound Blaster, nhng rt t cc sound card hin nay c th lm vic c vi driver SoundBlaster ca Linux. Nhng soundcard ny thng thng lm vic tt hn vi cc driver MSS/WSS hoc MAD16. Ch cc card SoundBlaster thc s, m s dng cc chip ca Creative Labs (v d: SoundBlaster16 Vibra), MV Jazz16 v cc card s dng ESS686/1688 ni chung c th lm vic vi driver SoundBlaster. Linux c th h tr hai loi sound card, nhng hai sound card ny phi khc nhau v khng c bt c thng tin cu hnh no ging nhau (a ch I/O, IRQs, DMAs). B.3. Cu trc cc tp tin cho Soundcard Cc phin bn mi ca Linux c cc trnh iu khin (driver) cho hu ht cc card thng dng v nh l mt phn ca gi driver c bn. Cc driver c lu nhiu ni khc nhau, tu theo bn phn phi, thng thng trong tp tin /lib/modules/2.2.14-5/misc. Cc chng trnh ngun c t trong /usr/src/linux/drivers/sound. Cc thng tin tham kho c t trong th mc /usr/src/linux/Documentation/sounds/. Mt s tp tin thit b c bit cho sound card: /dev/audio l thit b audio u tin, thng thng c lin kt ti /dev/audio0. /dev/audio0 (audio1) tp tin thit b audio th nht (th hai). /dev/dsp thng thng c lin kt ti /dev/dsp0. /dev/dsp0 (dsp1) l thit b x l mu s th nht (th hai). /dev/midi l driver thit b MIDI. /dev/midi00 l cng MIDI th 1. /dev/mixer l thit b sound mixer, thng thng c tr ti /dev/mixer0. /dev/mixer0 (mixer1) l sound mixer u tin (th hai). /dev/music l giao din sequencer mc cao. /dev/pcaudio l driver thit b audio cho loa ca PC. /dev/pcsp l thit b mu s ca loa PC. /dev/pcmixer l thit b mixer ca loa PC. 206

Linux-VN, cc lnh c bn

/dev/sequencer l thit b sequencer, truy cp MIDI, FM v GUS mc thp. /dev/sndstat l mt tp tin m n s hin th cc thng tin v trng thi ca cc driver sound. iu khin ng, cc tp tin thit b phi c to cho cc thit b m thanh. Cc tp tin ny thng c to trong qu trnh ci t h thng Linux. Trong mt s t trng hp ta phi to li cc tp tin ny. Hu ht cc bn phn phi u c kch bn /dev/MAKEDEV s dng cho mc ch ny. B.4. Lp cu hnh v ci t modules cho Sound Card Hu ht cc soundcard hin nay u h tr tnh nng PnP (Plug and Play), vic ci t phn cng kh d dng m khng cp y. i vi mt s soundcard c, c th phi thit lp cc jumpers. Sau c mt s cch thit lp cu hnh v ci t cho Sound card trn Linux nh sau: * Bin dch li nhn make cc module kernel sound, chuyn vo th mc /usr/src/linux-x.y.z/ (vi t cch l root) v chn mt trong ba cch sau: make config make menuconfig make xconfig Chn option Sound v mt hp thoi s xut hin. Trc tin phi chn Sound card support. Tu theo tng loi card (c cc tp tin hng dn cho loi card ), m s chn cc module ph hp. <M> 100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support Nu s dng card Sound Blaster, chn cc mc sau <M> Generic OPL2/OPL3 FM synthesizer support <M> FM synthesizer (YM3812/OPL-3) support Make kernel (make dep; make bzImage) v ci t nhn (sa v cp nht tp tin lilo.conf). Make cc modules v ci t chng (make modules; make modules_install). Sau nn sao tp tin /usr/src/linux-x. y. z/i386/arch/boot/vmlinuz ( an ton nn i vi mt tn mi) sang th mc /boot, sa li tp tin lilo. conf v cp nht li tp tin ny bng lnh lilo. D dng thy rng cch ny khng thun tin v thi gian bin dch nhn kh lu v phc tp. * Dng lnh Insmod Khi s dng lnh insmod v modprobe ln u tin (cha c tp tin isapnp.conf ph hp cho sound card) ta phi lp cu hnh PnP cho cc cng I/O, cc IRQ, DMA cho card sound, v mt s modules yu cu phi xc lp cc a ch vo ra, dma, irq,... 207

Linux-VN, cc lnh c bn

Lp cu hnh Plug and Play Hu ht cc sound card hin nay s dng giao thc PnP thit lp cu hnh cho a ch I/O, interrupts, v cc knh DMA (cc sound card c thng s dng jumper thit lp c nh). thit lp cu hnh cho cc card PnP, c th s dng cng c isapnp. C th cc bc nh sau: S dng pnpdump to cc thit lp c th cho cc thit b PnP, ghi kt qu vo tp tin /etc/isapnp.conf v c nh du # u tt c cc dng. pnpdump > /etc/isapnp.conf Chn cc thit lp cho sound card m khng xung t vi bt k mt thit b no khc trong h thng bng vic b cc du ch thch # cc dng cha cc m t v cc cng I/O, DMA v IRQs ph hp. Nh b du # dng lnh ACT Y gn cui tp tin. Thng thng isapnp c chy khi khi ng bi mt script. n y c th khi ng li hoc c th np tp tin cu hnh isapnp.conf bng lnh: isapnp /etc/isapnp.conf Cc sound module c th c np bng lnh insmod hoc modprobe. h tr cho tt c cc sound modules, phi np ba modules h tr chung trc tin: soundcore.o: l module iu khin mc cao nht cho h thng m thanh, cung cp mt tp cc hm ng k kiu thit b. soundlow.o: l sound driver mc thp. sound.o: cc hm sound chung cn cho tt c cc module. Nu np bng insmod, cc module chung phi c np theo th t trn v np trc cc sound module khc. Hu ht cc module c ch nh c th yu cu cc tham s chng hn nh cc a ch I/O, IRQ, DMA,... V d: c th s dng mt shell scripts (gi s ly tn l soundon) sau np cc module cho card Yamaha OPL3SA2:
echo Starting sound... insmod soundcore insmod soundlow insmod sound echo Starting sound Yamaha OPL3SA2.... insmod mpu401 insmod ad1848 insmod opl3 io=0x388 insmod opl3sa mss_io=0x530 irq=5 dma=0 dma2=1 mpu_io=330 io=370

* Modprobe Nu np bng modprobe, nhng module chung s c np t ng khi yu cu. c th 208

Linux-VN, cc lnh c bn

g t dng lnh vi cc tham s cho modprobe. # modprobe -k sb mpu_io=330 io=370 # alias sound sb options sb io=0x240 irq=9 dma=3 dma16=5 mpu_io=0x300 Ti du nhc lnh ch cn g: # /sbin/modprobe sb * Dng trnh sndconfig Trnh sndconfig s d tm sound card v thit lp cc tp tin cu hnh cn thit np cc driver ph hp cho sound card trn h thng Linux (trnh ny ch c RedHat). Kt qu c ghi vo cc tp tin sau: /etc/sysconfig/soundcard: ghi thng tin v kiu card. /etc/con.modules: ghi thng tin cu hnh modules. /etc/isapnp.conf: ghi thng tin cu hnh PnP ca sound card. Ch : a ch vo ra thng thng ca cc loi sound card c ch ra trong bng sau: Cng IO 0 IO 1 IO 2 IO 3 IO 4 Vng c chp nhn Mc ch
a ch c bn ca Sound Blaster

mss_io=0x530

irq=5

dma=0

dma2=1

Hoc trong tp tin /etc/conf.modules c cha cc dng sau:

0x0220 - 0x0280 0x0530 - 0x0F48 0x0388 - 0x03F8 0x0300 - 0x0334 0x0100 - 0x0FFE

a ch c bn ca MSS a ch c bn ca OPL3 a ch c bn ca MPU a ch c bn ca chnh card n iu khin cc cng I/O ca n.

B.5. Kim tra trng thi soundcard Trong khi khi ng (sau ci t) ch cc thng bo (c th xem li bng lnh dmesg). Nu ta dch li nhn, n s c thng bo dng nh sau:
Sound initialization started <Sound Blaster 16 (4.13)> at 0x220 irq 5 dma 1,5 <Sound Blaster 16> at 0x330 irq dma 0 <Yamaha OPL3 FM> at 0x388 Sound initialization complete

209

Linux-VN, cc lnh c bn

Thng bo c th c dng khc nu ta s dng module c th np. C th c hoc kim tra trng thi ca sound bng lnh: # cat /proc/sound # cat /dev/sndstat Sau kim tra qu trnh ci t bng cch gi mt tp tin .au no ra thit b audio. V d : # cat (anyfile).au > /dev/audio # cat (anyfile).midi > /dev/dsp Khi cn g b cc module sound np, s dng lnh /sbin/rmmod theo th t ngc vi khi np. Tip theo xa cc sound module trong tp tin /etc/conf.modules. B.6. Cc chng trnh ng dng h tr m thanh C rt nhiu cc chng trnh ng dng h tr cho m thanh trong Linux, song y ch gii thiu mt s chng trnh thng i km vi a ci t: aumix: chng trnh ny dng iu chnh volume, bass, treb, mix, cd audio,... mikmod: mt chng trnh s dng chi cc tp tin nhc MOD. N cn h tr cho cc nh dng STM, S3M, MTM, XM, ULT, IT. cdplay (/usr/bin/cdplay): dng chi nhc CD, chng trnh dng ch dng lnh. Ch vic g cdplay m audio disc t CDROM v a con tr v du nhc lnh. Vi chng trnh ny ch c mt cch duy nht dng c a l g lnh eject. cdp (/usr/bin/cdp): y l mt chng trnh cho mt giao din ch vn bn, song rt d s dng v kh n gin. S dng phn Pad-key iu khin chng trnh. playmidi, xplaymidi: l cc chng trnh dng chi cc tp tin nhc MIDI. Ch n gin l playmidi -r namefile.midi. Tham kho th mc /usr/doc/playmidi-2.4. play, rec: hai chng trnh ny cho php chi v ghi theo nhiu nh dng tp tin khc nhau vi nhiu la chn khc nhau. tm hiu thm c th tham kho trang man. S dng chng trnh play c rt nhiu cc la chn tuyt vi cho chi nhc trong thi gian thc, chng hn nh hiu ng ting vng (echo), v ting vang (echos), chorus, flanger,... Cc tp tin trong th mc /usr/doc/sox12.16/ m t rt chi tit cch chi cc tp tin nhc bt k bng chng trnh ny. wavplay: chng trnh ny h tr chi v ghi vi nh dng .wav. C th ti v t: <ftp://sunsite.unc.edu/pub/Linux/apps/sound/players/wavplay~1.0.tar.gz> sox (vit tt ca Sound exchange) l mt chng trnh chuyn i cc dng 210

Linux-VN, cc lnh c bn

m thanh khc nhau. C c php nh sau: sox infile outfile sox infile outfile [effect [effect option ...]] sox infile -e outfile [effect [effect option ...]] sox [general options] [format option] infile [format options] outfile [effect] Chng trnh ny s chuyn i cc nh dng khc nhau: .au sang cc tp tin .snd, .voc, .wav v ngc li, chuyn i t cc tp tin dng .wav sang .voc, .voc sang .wav... Chng trnh ny c i km vi a ci t Red Hat 6.2, hoc c th ti t a ch <ftp://sunsite.unc.edu/pub/Linux/apps/sound/convert/Lsox-linux.tar.gz> xmms (/usr/bin/xmms): n cn c gi l X11Amp, n c giao din ging ht vi chng trnh WinAmp. N c th s dng chi cc tp tin nhc .wav, mp3. Audio mixer: l chng trnh ng dng cho X dng iu khin mixer, iu chnh cc mc u vo t CD, micro phone... ESD volume meter: l mt chng trnh m phng s bin i tn s ca m thanh th hin di dng hai hng n. XplayCD: mt chng trnh chy di X dng chi nhc t a CD. Xmixer: tng t nh chng trnh audio mixer. Extace Waveform Display: chng trnh ny s biu din m thanh ang c chi di dng sng. Vi cc cch biu din s bin i tn s di cc dng 3D Wireframe FFT, 3D Landframe FFT, Graphic Equalizer, Gradient Scope, Spectragram, 3D HI- resolution fft. mpg123: y l mt chng trnh dng chi dng nhc MPEG, n h tr cho c cc layer I, II, III. N c th chi nhc trong thi gian thc m c t www. cdda2wav: dng sao cc tp tin nhc audio CD v chuyn thnh cc nh dng wav. Tham kho cc thng tin chi tit trong th mc /usr/doc/cdda2wav/. Tuy nhin chng trnh ny yu cu phi c bus SCSI. cdparanioa: y l mt chng trnh tng t nh cdda2wav, n c audio trc tip t CDROM v vit d liu vo mt tp tin theo cc nh dng .wav, .aifc hoc raw 16 bit linear PCM. Ngoi ra cn rt nhiu cc chng trnh khc nh bplay, sidplay, RealAudio Player, Sound Studio, mp v xmp (trong gi adagio), TiMidity, MikMod, s3mod, mod, nspmod, yampmod, Tickle Music, Sajber Jukebox. c bit cn c mt s chng trnh nn nhc MP3: Layer 3 Shareware Encoder/Decoder, Blades MP3 Encoder (http://bladeenc.cjb.net).

211

Linux-VN, cc lnh c bn

Bng ch thch cc thut ng s dng Vn chn thut ng ting Vit cho cc thut ng gc ting Anh lun l vn cn c tho lun vic chn la nh vy l thch hp. D cho trong cun sch ny, nhiu thut ng ting Vit c s dng mt cch ph bin nhng chng ti cng lit k vo bng ch thch di y vi mc ch gip bn c thun tin trong tra cu v lin h. Trong bng ch thch, mi thut ng ting Vit dng trong cun sch s c km theo thut ng ting Anh gc v sau c th l mt li ch thch ngn. Chng ti coi bng ch thch nh mt c gng nhm h tr bn c s dng cun sch ny hiu qu hn v phm vi s dng ca n gii hn trong cun sch. Ting Vit Tp tin Ting Anh File Gii thch ngn Tp hp d liu c t chc theo mt mc ch s dng: on vn bn, mt chng trnh ngun, mt tp hp d liu ... Cn c gi l tp hay gi theo cch gi nguyn gc ting Anh l File. Tn gi ca tp tin (tp tin thng, th mc, tp tin c bit ...) c dng xc nh tp tin. Ni cha mt danh sch cc tp tin trong h thng File, c Linux coi nh mt dng tp tin c bit. H thng ton b cc tp tin c trong h iu hnh Linux (v UNIX ni chung). Linux cho php ngi s dng dng lnh trnh by mt "thao tc" yu cu h thng thc hin. Nhng lnh c sn trong Linux, c trong shell hoc c t ti nhng th mc theo quy nh ca Linux. Dng lnh bao gm mt hoc mt s lnh trong mt ln yu cu ca ngi dng. Kt thc dng lnh l du xung dng. Th tc bt u mt phin lm vic ca mt ngi s dng. Login l lnh cho php ng nhp. Th tc logout kt thc phin lm vic. Ngi s dng Linux cho cng vic ca mnh.

Tn tp tin

Filename

Th mc

Directory

H thng tp File system tin Lnh Command

Tin ch (cn Utility gi l lnh thng trc) Dng lnh Command line

ng nhp

Login

Ngi dng

User

212

Linux-VN, cc lnh c bn

Siu ngi dng (ngi dng ti cao/ngi qun tr) Con tr

Superuser

Linux quy nh c mt siu ngi dng thc hin c quyn hn ti cao trong h thng bao gm cc lnh qun tr h thng. Vi mt s lnh Linux (thm, bt ngi dng ...) th ch siu ngi dng c php s dng. im nh du trn mn hnh nh du v tr hin thi hin thng tin. Trong cc trnh son tho vn bn y thng l v tr son tho hin thi trong vn bn B chng trnh bao gm cc tp tin trn a (bng) t c chc nng qun l ti nguyn my tnh v ng vai tr l "my tnh o" i vi ngi dng. H iu hnh hot ng theo cch thc trong b nh ng thi c nhiu chng trnh c "bnh ng" trong phn phi ti nguyn (CPU, b nh).

cursor

H iu hnh

Operating System (OS)

H iu hnh a chng trnh H iu hnh a ngi dng Nhn

Multiprogramming OS

Multi-users OS H iu hnh a chng trnh m mi ngi dng s dng mt trm cui c kt ni my tnh trc tip thc hin cng vic trn my tnh. Kernel B phn ct li nht ca Linux, thng trc thc hin cc chc nng c bn ca h iu hnh (cn c gi l li) Mt ln thc hin ca mt chng trnh. Cn c gi l qu trnh. Mt s h iu hnh gi l bi ton (task).

Tin trnh

Process

Chng trnh Command Mt chng trnh thuc h iu hnh c gii thch Comment chc nng tip nhn, phn tch dng lnh Program (CCP) lnh ngi dng lnh c thc hin. Trong Linux l shell, trong MSDOS l COMMAND.COM. ng nhp Login Th tc m mt ngi dng cn phi thc hin khi bt u phin lm vic vi Linux. Th tc ny yu cu ngi dng a vo tn k hiu v mt khu c ng k trong h thng.

213

Linux-VN, cc lnh c bn

ng xut

Logout

Th tc m mt ngi dng cn phi thc hin khi kt thc phin lm vic vi Linux. Trn my tnh c nhn, ph bin l sau khi ng xut s ko theo mt ng nhp mi. Cn gi l du nhc dng lnh

Du nhc shell K hiu m t nhm Ci t Linux wildcards

K hiu c dng xc nh mt nhm tp tin (v d *, ?, [] v [] vi -). Cn c gi l k hiu thay th. Tin trnh to ra h iu hnh Linux ln my tnh s dng

Installation Linux

214

Linux-VN, cc lnh c bn

Tn sch: H iu hnh Linux: Cc lnh cn bn trong giao din vn bn Tp th tc gi: Nguyn Thnh Bin, Bi Vit H, Nguyn Thanh Huyn, Nguyn Hng Lan, H Quang Thy (thuc nhm LinuxVN Group) Cc ni dung chnh: Cun sch vi tn gi "H iu hnh Linux: Cc lnh cn bn trong giao din vn bn" cung cp chi tit v cc lnh thng dng nht ca Linux vi cc ni dung sau y: Cc lnh v h thng ni chung, lnh thao tc tp tin, qun l tin trnh v qun tr ngi dng, Chng trnh son tho vn bn Vim, Chng trnh tin ch Midnight Commander, B tin ch MSTOOLS, Lp trnh trn shell Phn cui cun sch l ph lc v Qu trnh ci t h iu hnh Linux. i tng s dng Sinh vin cc khoa Cng ngh Thng tin, Ton - Tin, Sinh vin cc ngnh khoa hc cng ngh khc Chuyn vin pht trin ng dng Tin hc Kch c sch 200 trang A4 Tnh trng bn tho C bn hon thin, ang chnh l xut ca tc gi Tc gi chu trch nhim pht hnh 500 cun Li gii thiu v cun sch Mi nm gn y, chng ta chng kin s pht trin vi tc vt bc ca h iu hnh Linux v iu c coi nh mt trong nhiu kt qu ca s pht trin k diu ca mng Internet. Linux, mt h iu hnh thuc dng UNIX, ngy cng nhn c s quan tm ca i ng rng ri nhng ngi lm cng tc nghin cu, trin khai v ng dng trn quy m ton th gii, c bit l tng lp sinh vin v hc sinh. Cng v tm quan trng ca vic nghin cu, pht trin h iu hnh Linux m trong phng hng pht trin khoa hc - cng ngh ca nc ta trong thp nin sp ti khng nh vai tr ca vic nghin cu h iu hnh Linux. Hi tho "Linux Vit nam" do Ban qun l Khu cng ngh cao Ha Lc ng cai t chc ti H Ni trong hai ngy 7 v 8 thng 12 215

Linux-VN, cc lnh c bn

nm 2000 vi s tham gia nhit tnh ca hng trm chuyn vin trong lnh vc CNTT trn mi min t nc cng mt s chuyn gia nc ngoi chng t du hiu kh quan i vi vic pht trin h iu hnh Linux Vit nam. LinuxVN Group l mt nhm chuyn vin nghin cu h iu hnh Linux (m phn ng trong l sinh vin) thc hin D n xy dng h iu hnh Linux Vit Nam, bc u c t tn l LinuxVN. D n ny do Tng cng ty in t - Tin hc Vit nam ch qun v nhn c s phi hp trin khai ca nhiu c s o to, nghin cu bao gm Khoa Cng ngh (i hc Quc gia H Ni), Cng ty Cng ngh Tin hc nh trng School@net v mt s c quan khc. Hn na, LinuxVN Group cn nhn c s lin kt, h tr ca nhiu nhm nghin cu v Linux trong nc v nc ngoi (nh VietLug, Visc ...). Ngoi cng vic chnh yu nht l xy dng, pht trin h iu hnh LinuxVN ca Vit nam, LinuxVN Group cn thc hin vic bin son cc cun sch v Linux ni chung v v LinuxVN ni ring, gp phn vo cng cuc "a Linux vo Vit nam". Hai cun sch u tin c LinuxVN Group gii thiu ng thi cng bn c l: - H iu hnh Linux: Cc lnh cn bn trong giao din vn bn - H iu hnh Linux: Giao din ha GNOME Cun sch vi tn gi "H iu hnh Linux: Cc lnh cn bn trong giao din vn bn" cung cp chi tit v cc lnh thng dng nht ca Linux vi cc ni dung sau y: - Cc lnh v h thng ni chung, lnh thao tc tp tin, qun l tin trnh v qun tr ngi dng, - Chng trnh son tho vn bn Vim, - Chng trnh tin ch Midnight Commander, - Lp trnh trn shell, - B cng c MSTOOLS, Phn cui cun sch l ph lc v Qu trnh ci t h iu hnh Linux. Cun sch vi tn gi " H iu hnh Linux: Giao din ha GNOME" trnh by cc ni dung v giao din ha GNOME ca Linux v X Window. Nhng chng u tin trnh by nhng ni dung thc hin vic s dung giao din GNOME nh mt mi trng hiu qu h tr ngi dng. Cch thc s dng Thanh-GNOME, menu chnh, mn hnh nn, trnh qun l h thng tp tin v mt s tiu dng ph dng nht c gii thiu. Cc chng tip theo cung cp nhng ni dung c bn v cch thc thit lp GNOME. Hai chng cui ca cun sch gii thiu cu trc v cch thit lp h thng X-Window ca Linux. LinuxVN Group mong mun cc cun sch c bin son p ng c nhu cu ca nhiu ngi, t nhng chuyn vin c nhiu kinh nghim v h thng tm n cun sch nh mt ngun t liu tham kho, cho n cc em sinh vin, hc sinh mi bt u lm quen vi mt h iu hnh. Chnh v l , i vi mt s ni dung kin thc c bn c trnh by trong cc cun sch, th vi bn c l ngi c nhiu kinh nghim c th ch cn xem lt qua, cn vi bn c mi lm quen vi mt h iu hnh th nn xem xt k 216

Linux-VN, cc lnh c bn

lng chng v iu l rt cn thit. Mt khc, phn ph lc hoc nhng ni dung v cch thc thit lp cc thnh phn h thng l nhng ni dung tng i kh v vy nu bn c mi lm quen vi h iu hnh th c th b qua chng trong ln c u tin. Trong mi trng hp, chng ti hy vng rng cc cun sch l c ch vi tng bn c. Ni dung cc cun sch c su tm v bin son t nhiu ti liu c gi tr, trong ngun t liu chnh l nhng trang tr gip ca trnh Help Browser, mt khc, cc ni dung cng c cc thnh vin trong LinuxVN Group kim chng trong qu trnh nghin cu xy dng h iu hnh LinuxVN. Mt khc, Linux c pht trin hng ngy, c bit l nhng ni dung v GNOME cng nh v X Window c thay i vi tc nhanh v trnh nhng ngi bin son cn nhiu hn ch, chc chn hai cun sch trn y khng trnh khi cc thiu st v ni dung v cch trnh by. Tp th tc gi mong mun nhn c kin ng gp ca bn c ni dung cc cun sch ngy cng c hon thin v hu dng. Trong thi gian sp ti, LinuxVN Group tip tc hon thin mt s cun sch theo nh hng pht trin ng dng trn Linux: - Cc ngn ng lp trnh trn Linux: C, Pascal, Perl, Java, Python ... - Hng dn s dng cc phn mm ng dng nh StarOffice, DB2 ... Chng ti rt hy vng nhn c nhng gp t bn c v vic nh hng ni dung cc ti liu nhm m rng phm vi s dng ca mi cun sch m LinuxVN Group s mang ti cc bn c. Nhm tc gi Nguyn Thnh Bin Bi Vit H Nguyn Thanh Huyn Nguyn Hng Lan H Quang Thy

217

H Ni - 2003

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Mc Lc

chng 1. gii thiu v gnome...1

1.1. S lc v GNOME 1.2. Khi ng GNOME v khi qut v mn hnh 1.3. Mt s kin thc c s 1.4. S b lm vic trong GNOME 1.5. Ra khi GNOME 1.6. Mt s quy c trnh by ni dung cun sch

1 2 3 5 7 8

chng 2. S dng thanh Gnome...9

2.1. Mt s khi nim lin quan 2.2 Cc thao tc c bn trn thanh GNOME 2.3. Di chuyn v thm thanh GNOME 2.4. B sung cc thnh phn vo thanh GNOME 2.5. Chy cc ng dng trong GNOME 2.6. Cch thc ra khi GNOME

9 10 12 12 14 15

chng 3. mn hnh nn trong gnome16

3.1 S dng mn hnh 3.2 Vng mn hnh 3.4. Tnh nng ko-th trong GNOME 3.5. Vt-GNOME

16 17 18 19

CHNG 4. TRNH QUN L TP TIN TRONG...21

4.1 Li gii thiu 4.2. Di chuyn trong trnh qun l tp tin GNOME 4.3 La chn tp tin 4.5 i tn tp tin 4.6. Chy ng dng t trnh qun l tp tin 4.7 Nhng thuc tnh tp tin v cc thao tc khc 4.8 Thay i nhng ch dn ca trnh qun l tp tin 4.9. S dng menu ca trnh qun l tp tin

21 22 23 24 25 25 26 31

KC-06-03CN

Hng dn s dng Giao din ha GNOME

chng 5. B cc tiu dng trong gnome34

5.1 Li gii thiu 5.2 Nhm tiu dng gii tr (Amusement applets) 5.3. Nhm tiu dng kim sot (Monitor Applets) 5.4. Nhm tiu dng a phng tin (Multimedia Applets) 5.6 Nhm tiu dng tin ch (Utility Applets)

34 34 34 35 40

chng 6. b lp lch gnome.45

6.1 Li gii thiu 6.3. Ghi nh thi im ca mt d nh 6.4. Thit lp b lp lch GNOME

45 48 49

chng 7. hng dn s dng gnome-terminal50

7.1 Gii thiu 7.2 S m phng trm cui (Emulation) 7.3 Cu hnh trm cui (menu Thit lp) 7.4 Nhng lp trm cui 7.5 Nhng ty chn ca lnh tclass 7.6 Cch s dng chut v con tr 7.7 Cc menu 7.8 Cc bin mi trng (Environment)

50 51 51 52 52 54 55 57

chng 8. cu hnh thanh gnome v menu chnh57

8.1 Cu hnh thanh GNOME 8.2. Son tho Menu chnh

57 64

chng 9. trnh qun l ca s...66

9.1. Gii thiu v trnh qun l ca s 9.3 Trnh qun l ca s Enlightenment

66 68

chng 10. b iu khin trung tm gnome80

10.1 Li gii thiu 10.2 Nhm C-tiu dng mn hnh 10.3 C-tiu dng trnh son tho ngm nh 10.4 Cc kiu iu khin tp tin (mc Cc kiu mime) 10.5. Nhm C-tiu dng a phng tin

80 81 86 86 87

KC-06-03CN

Hng dn s dng Giao din ha GNOME

10.6 Nhm C-tiu dng thit b ngoi vi 10.7 C-tiu dng trnh qun l phin lm vic v trnh qun l phin lm vic 10.8. Nhm C-tiu dng giao din ngi dng

88 90 92

chng 11. tng quan v h thng x window97

11.1. Kin trc ca X Window System 11.2. Cc chng trnh v tin ch c bn i km X Window System 11.3. Mt s khi nim 11.4. Chng trnh qun l hin th (X display manager) 11.5. Tng quan v X font server 11.6. X terminal emulator (xterm)

97 98 99 101 104 108

chng 12. thit t cu hnh cho x window system.110

12.1. Thit lp cu hnh cho X bng chng trnh Xconfigurator 12.2. Cu trc tp tin /etc/X11/XF86config 12.3. Thit lp d liu cho Monitor 12.4. Kt hp d liu Monitor v phn cng Video 12.5. S dng 16 bt mu

110 113 116 117 119

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Chng 1. Gii thiu chung v GNOME

1.1. S lc v GNOME Tng t nhng h iu hnh thn thin vi ngi dng, Linux cng c cc ca s, l X-Window. Hn th na i vi Linux tn ti nhiu loi giao din ha nh GNOME, KDE ... m GNOME c coi nh mt loi giao din in hnh. Trong hi tho Linux Expo c t chc vo cui thng 8-2000 ti M, cng ng Linux quyt nh chn GNOME l giao din chnh pht trin vi mc ch cnh tranh vi Microsoft Windows. GNOME l mt mi trng ha d dng thit lp v s dng, cho php ngi dng thc hin yu cu i vi my tnh mt cch thun li. GNOME l t vit tt ca Gnu Network Object Model Environment, v vy GNOME l mt phn ca d n GNU. D n GNU bt u vo nm 1984 pht trin mt h iu hnh thuc dng UNIX hon ton min ph. tm hiu thm v d n ny, hy vo a ch: http://www.gnu.org GNOME bao gm mt thanh GNOME (the Panel) cho php khi ng nhng ng dng v hin th trng thi, mt vng mn hnh nn (the Desktop) l vng mn hnh hin th d liu v nhng ng dng, mt tp hp cc cng c mn hnh nn chun v nhng ng dng cng vi mt tp hp nhng giao tip gip cho cc ng dng d dng phi hp v thch ng vi nhau. Nhng ngi dng cc h iu hnh khc hoc nhng mi trng khc s cm thy thoi mi vi mi trng ha mnh do GNOME cung cp. GNOME hon ton c m ngun m (phn mm min ph), vi m ngun sn c c pht trin bi hng trm ngi lp trnh trn th gii. tm hiu thm v GNOME, hy vo a ch: http:// www.gnome.org. GNOME to nhiu thun li cho ngi dng khi kt hp mn hnh ha vi vic kch chut (mouse). GNOME n gin ho vic thit lp v s dng ng dng a dng v cc ng dng ny khng cn b hn ch ch theo giao din vn bn na. GNOME rt d cu hnh, cho php ngi s dng thit t vng mn hnh nn theo mong mun. Trnh qun l phin lm vic ca GNOME lu tr mi thit t trc, v vy ngi dng ch cn thit t mt ln. GNOME h tr nhiu ngn ng, v ngi dng c th b sung nhiu loi ngn ng m khng cn thay i phn mm. GNOME thm ch h tr tnh nng ko-th vi nhng ng dng khng tng hp vi GNOME. GNOME khng nhng thun li cho cc nh pht trin, m cn h tr ngi dng cui mt cch gin tip. Nhng ngi pht trin khng cn mua mt bn quyn t tin cc ng dng thng mi ca h tng hp vi GNOME. Thc t, GNOME l nh cung cp trung lp - khng c mt thnh phn no ca GNOME b kim sot bi mt cng ty hoc b hn ch vic thay i hoc phn phi li. Nhng ng dng GNOME c th c pht trin bng rt nhiu ngn ng lp trnh khc nhau ch khng phi l ch trn mt ngn ng. GNOME s dng kin trc CORBA (Common Object Request Broker Architecture) cho php cc phn mm phi hp hot ng mt cch tri chy, m khng b l thuc vo vic n c to ra bi ngn ng lp trnh no hoc thm ch l n chy trn my tnh no. GNOME c s dng nhiu trn cc h iu hnh thuc dng UNIX, bao gm c Linux.
Trang 1

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Cc ni dung v GNOME trong cun sch c vit da theo cc kt qu c cng b ca nhiu tc gi nh: Michael Zucchi, Miguel de Icaza, Jay Painter, George Lebl, Erik Troan, Jeff Garzik, Jay, Christopher Blizzard, Jens Lautenbacher, Tom Tromey, Tristan Tarrant, Jonathan Blandford, Nat Friedman, Felix Bellaby v Manish Vachharajani ... Cc ni dung c trnh by lin quan ch yu ti phin bn Linux 6.2 ca hng Red Hat l mt phin bn ph dng trong thi gian va qua v cc ni dung nh th v i th vn gi nguyn gi tr trong cc phin bn khc vi mt s bin dng. 1.2. Khi ng GNOME v khi qut v mn hnh 1.2.1. Khi ng GNOME C hai cch khi ng GNOME lm vic: hoc GNOME c ngi dng khi ng t giao din mn hnh vn bn hoc GNOME t ng khi ng ngay trong qu trnh ng nhp ca ngi dng. a. Khi ng GNOME t giao din mn hnh vn bn GNOME l mt b chng trnh ng dng chy trn h iu hnh Linux (v UNIX) ni chung. s dng GNOME, ngi dng g lnh: # startx Mt s thng bo di dng vn bn hoc hnh nh c hin ra trn mn hnh v sau giao din mn hnh GNOME xut hin (xem hnh v 1.2). T thi im ny tr i, ngi dng thc hin cc yu cu ca mnh nh giao din mn hnh ha. b. GNOME c t ng khi ng khi ng nhp Trong mt s trng hp, siu ngi dng cho php ngi dng c php vo giao din mn hnh ha ti thi im ng nhp h thng. Ngay sau khi qu trnh khi ng h iu hnh Linux thnh cng, thay v vic vic hin cc dng vn bn ng nhp, h thng a ra mt mn hnh ng nhp ha ngi dng thc hin th tc ng nhp h thng (hnh 1.1 l mt dng mn hnh ng nhp ha GNOME). Sau khi ngi dng nhp c tn ng nhp th h thng hi tip mt khu ngi dng g mt khu hon thin th tc ng nhp. Nu ng nhp thnh cng, mn hnh giao din ha xut hin bt u mt phin lm vic vi GNOME.

H1.1. Mn hnh ng nhp ha


Trang 2

KC-06-03CN

Hng dn s dng Giao din ha GNOME

1.2.2. S lc v giao din mn hnh GNOME Hnh 1.2. l mt v d giao din mn hnh ca GNOME (sau y chng ta gi tt l mn hnh GNOME). GNOME rt d cu hnh, v vy ngi dng hon ton c th cu hnh li giao din mn hnh khc vi hnh 1.2. Mt s khi nim c bn lin quan n giao din mn hnh ha GNOME s c gii thiu trong on 1.3 v y chng ta xem xt s b cc i tng c trong hnh 1.2. Cc i tng l Thanh-GNOME, Tiu-dng, Nt-menu, Vt-GNOME, Mn-hnh-nn, Ca-s-ng-dng, Nt-m-thng-dng. Cc chng tip theo s gii thch ngha ca mi i tng ni trn. Thanh-GNOME (the GNOME Panel) nm pha y ca mn hnh, cha cc Tiudng (Applet) v Nt-menu. Trn thanh ny cn xut hin Vt-GNOME (the GNOME pager).

Nt bt thng

Menu con

Mn hnh nn Nt n / hin thanh

Tiu dng ng h Menu chnh Vt GNOME Nt Menu chnh Thanh GNOME

Hnh 1.2. Mn hnh GNOME

Mn-hnh-nn (the Desktop) chim v tr chnh yu trong mn hnh ha. Cc trnh ng dng hin ang chy c giao din qua Ca-s-ng-dng ti mt vng mn hnh nn. Trong Mn-hnh-nn cn thy cc Nt-m-thng-dng. 1.3. Mt s kin thc c s 1.3.1. Mt s khi nim Trc khi kho st cch thc s dng cng c GNOME, chng ta xem xt mt s khi nim c s dng m t cc hot ng trong mi trng mn hnh ha. Cc khi nim trung tm nht c th k n l mn-hnh-nn (the Desktop), cc danh-mc (the Folders), thanh-GNOME (the Panel) ... Mt s ni dung v cc khi nim ny c trnh by s b trong phn trc y.
Trang 3

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Mn-hnh-nn l vng lm vic chnh yu trong mi trng ha. Ca s lm vic (window) ca cc trnh ng dng hin ang thc hin c t ti mt vng trong mn hnh nn v chng c gi l ca-s-ng-dng. Trong mn hnh nn cn c cc nt-m (button) ca cc trnh-ng-dng, ca cc danh-mc (folder), ca cc ti liu v d liu khc. Nt-m c trnh by di dng mt biu-tng (icon) l mt hnh nh cng mt xu vn bn l tn ca nt. Nt m ca trnh ng dng cn c gi l nt-bt (launcher). Trong nhiu ng cnh, cho php c th ng nht nt m vi biu tng. Khi kch p chut tri vo mt nt m th mt trnh ng dng tng ng c khi ng thc hin. Trn mn hnh nn, nt m danh mc c trnh by di dng hnh v cch iu ca mt quyn v. Khi kch chut vo nt m danh mc th trnh qun l tp tin s m ni dung ca danh mc. Danh-mc cha cc nt m, trong s c th li c nt m ca danh mc con. Ti mn hnh nn, danh mc thng cha cc nt m cha ti liu tr gip-hng dn c trong my tnh hoc trn Web. Khi nim danh mc y c ngha tng ng vi khi nim th mc v trong mt s ng cnh, chng hn lm vic vi trnh qun l tp tin, chng ta ng nht chng. Thanh-GNOME l mt thanh di chy ngang qua y ca mn hnh nn, ng vai tr thng trc phc v nhanh ngi dng. Thanh GNOME cha mt dy cc mc gm cc tiu-dng (applet), nt bt v nt-menu. Mt nt menu c bit, c hnh dng ca mt du chn GNOME cch iu, c gi l nt-menu-chnh (the Main Menu Button). Kch vo nt menu chnh s nhn c mt menu cha cc b ng dng c a vo h thng. Vt-GNOME l mt tiu dng c hin th trn Thanh-GNOME thnh hai phn: phn cc mn hnh v phn danh sch tn cc ng dng ang thc hin ti mn hnh hot ng. Cch biu din cc i tng trn mt mn hnh ha GNOME c th c th khng ging nh trong hnh 1.2. song v tng th chng vn gi ngha nh c trnh by. 1.3.2. Lm vic vi chut my tnh Giao din ha lun i km vi vic s dng chut (mouse) ca my tnh (di y chng ta gi tt l chut) v chnh vic s dng chut lm tng tnh hiu qu ca giao din mn hnh ho. Trong mt s h iu hnh c th s dng bn phm thay th cho chut trong giao din ha. Tuy nhin trong GNOME, chut l thit b khng th thiu. i km vi chut l con tr chut, xut hin trn mn hnh my tnh, c hnh dng no tu thuc vo tng phn mm; vi GNOME th v ph bin, con tr chut l mt mi tn c hnh dng . Mun thao tc vi mt i tng no c trong mn hnh ha, cng vic cn thit u tin l chng ta phi di chuyn c con tr chut ti v tr ca i tng . Chut my tnh c mt s nt ngi dng thao tc nhm mc ch t c mt yu cu no ti h thng. Di y l mt s thao tc: - Kch (click) chut: nhy nhanh vo nt chut ri th ngay. Thao tc ny thng c s dng chn (cn c gi l nh du) mt i tng no ti ng v tr con tr chut.
Trang 4

KC-06-03CN

Hng dn s dng Giao din ha GNOME

- Kch p chut: kch chut hai ln lin tip. Thao tc ny thng c s dng chy mt trnh ng dng lin quan n i tng hoc "m" mt danh mc ti ng v tr ca con tr chut. - R (drag) chut: nhn khng th mt nt chut ng thi vi vic di chuyn chut. Thao tc ny thng c s dng chn mt nhm i tng thng qua mt hnh ch nht c xc nh khi r chut. Ch l v tr nhn chut u tin (nh u tin ca hnh ch nht) cn phi nm ngoi mi i tng trong nhm. - Ko-th (drag and drop): a con tr chut ti vng cc i tng c chn. Nhn (khng th) chut vo v tr ca mt trong cc i tng sau di chuyn chut ti v tr mi v th nt chut. GNOME tun theo cc quy c ca UNIX, trong c quy c l nt chut tri c dng la chn, thc hin ng dng v ko cc i tng. Nt chut phi c dng hin ra mt menu bt. a s chut dng trong UNIX u c ba nt, v nt gia c s dng dn vn bn (nu trong mt vng vn bn) hoc di chuyn mi th. Mun sao chp vn bn, s dng nt tri nh du vn bn cn sao chp, di chuyn ti ch cn dn, v kch nt chut gia dn. Ngm nh GNOME i km vi chut ba nt v iu m bo tnh linh hot mm do cao do mt s thao tc c gn sn vi mi trong ba nt chut. Vi chut ch c hai nt th thao tc nhn ng thi hai nt tri v phi thay th cho thao tc nhn nt gia. Trong cun sch ny, ngm nh s dng chut ba nt. Mt khc, trong nhiu trng hp, khi ni ti cc thao tc kch, kch-p, r, ko-th chut cn km thm c nt c thao tc, chng hn nh, khi ni "kch chut tri" c ngha l thao tc kch nt tri ca chut. 1.4. S b lm vic trong GNOME Chng ta s dng hnh 1.2. lm v d minh ha cho cc ni dung c trnh by trong on ny. 1.4.1. Lm vic vi thanh GNOME Thanh GNOME thng trc phc v ngi dng trong sut phin lm vic vi GNOME. GNOME cn cho php ngi dng loi b thanh GNOME nu thy khng cn thit s dng thanh. Nh ni, thanh GNOME cha cc tiu dng (chng hn, tiu dng ng h hin thi gian h thng c t pha phi ca thanh GNOME cho bit thi gian hin ti) v cc nt m. Hai c cha mi tn hai u ca thanh GNOME ( u tri v u phi) c dng n hoc hin thanh GNOME khi b kch chut tri vo mt trong hai . Trn hnh 1.2, nt u tin bn tri thanh GNOME c hnh mt ch chim cnh ct l nt menu chnh. Cho php kch chut vo nt menu chnh nhn c mt danh sch cc b ng dng, cc thao tc c np sn vo , bao gm c lnh Thot. Mun lm vic vi nt m no ch cn di chut n v tr tng ng v kch chut tri. Chng 3 s trnh by kh y cc ni dung v thanh GNOME, bao gm ni dung v cc i tng khc c trong thanh; cc thao tc di chuyn, to thm, loi b thanh GNOME hoc b sung hay loi b cc mc c trong thanh.
Trang 5

KC-06-03CN

Hng dn s dng Giao din ha GNOME

1.4.2. Lm vic vi mn hnh nn Mn hnh nn cha cc nt m thng dng v cc ca s ng dng. Trc ht chng ta xem xt cch thc lm vic vi cc nt m thng dng. a. Lm vic vi nt m thng dng Nt m thng dng trong mn hnh nn biu tng cho nhng thnh phn (chng trnh, d liu, th mc) c trong h thng m thng xuyn c s dng. Khi kch p chut tri vo mt nt m ny th mt trong nhng tnh hung sau y s xy ra: Nu l mt nt bt ca mt chng trnh, th chng trnh ny s chy. Nu l mt nt m d liu, th chng trnh tng ng vi d liu ny s chy v ti d liu vo lm vic. Nu l mt nt danh mc, th trnh ng dng qun l tp tin s chy v hin ra ni dung ca th mc , y l mt trnh ng dng c sn trong GNOME. Trn vng mn hnh nn ngm nh c sn nt m cho th mc c nhn ca ngi dng vi tn gi "Home directory". b. Lm vic trong cc ca s ng dng Trc ht chng ta xem xt cch thc lm vic trong ca s ng dng ca trnh qun l tp tin v thng qua , mt mt, cho php s b nm bt c thao tc vi tp tin trong mi trng GNOME, v mt khc, cung cp mt s kin thc v cch thc lm vic trong mt ca s ng dng in hnh. Trnh qun l tp tin cho php thao tc vi nhiu tp tin. Ca s ca trnh qun l tp tin c chia lm hai vng lm vic r rt hai pha tri v phi, khng k cc thanh pha trn. Vng bn tri ca s l danh sch cc th mc, cn vng bn phi ca s cha ni dung ca th mc c chn: di chuyn tp tin hoc th mc, ch cn s dng nt tri chn v ko n n v tr thch hp ri th. sao chp mt tp tin, hy gi phm CTRL trong khi ko chut tri. chy mt chng trnh hoc son tho mt tp tin d liu, hy kch p chut tri vo n. thc hin nhng thao tc khc trn mt tp tin (nh i tn hoc xa), hy kch chut phi vo tp tin v chn thao tc tng ng. la chn nhiu thnh phn cng mt lc, trc tin hy gi phm SHIFT ri kch vo cc thnh phn. C th d dng di chuyn hoc sao chp cc tp tin gia cc th mc bng cch chy ng thi hai trnh ng dng qun l tp tin, mi ln nh th to ra mt tin trnh (process) trong my, hai tin trnh hin th hai th mc: c th ni rng chng ta chy hai trnh ng dng trnh qun l tp tin. V d, a mt tp tin ra mn hnh nn th ch cn thc hin mt thao tc rt n gin l ko-th tp tin t ca s mn hnh ca trnh qun l ri a ra mn hnh nn th. Thc t, ko-th cc thnh phn ny ln trn cc thnh phn khc trong GNOME l mt vic lm d dng. Trn y trnh by mt s ni dung s lc v trnh ng dng qun l file v ca s ng dng ca n. Tuy cc ni dung v thao tc trong ca s ng dng ca trnh qun l file l kh in hnh, c th c trng cho mt lp rng ln cc trnh ng dng, song thao tc trong mi ca s ng dng li tu thuc vo hot ng ca trnh ng dng
Trang 6

KC-06-03CN

Hng dn s dng Giao din ha GNOME

tng ng, c ngha l ph thuc vo c th ca tng trnh ng dng. Chng ta xem xt mt s nt chung nht ca cc ca s ng dng, l cc ng vin ca cc ca s ny. Khi mt ca s ng dng bt k c hin th, ng vin pha trn t sn mt vi nt tng ng vi cc chc nng iu khin ca s. Nhng chc nng bao gm cc thu (nt thu), gin (nt gin) v ng ca s (nt ng). Vic xut hin ca cc nt ny c xc nh v kim sot bi mt thnh phn c gi l trnh-qun-l-ca-s (window manager). Di y l hai v d v nhng kiu vin vi tn gi l Clean (hnh 1.3) v ICE (hnh 1.4) : Trong kiu vin Clean, du gch ni "_" l nt thu nh, du hnh vung " " l nt gin to ra (s dng ton b mn hnh), v du ch thp cho l nt ng ca s. Trong kiu ICE, du ch thp cho (bn phi vin) l nt ng ca s. Kch vo mi tn bng nt chut tri s thu nh ca s, trong khi kch nt chut phi cho ta mt menu vi nhiu la chn khc nhau.

Hnh 1.3. Kiu vin Clean

Hnh 1.4. Kiu vin ICE

Nu ang s dng s thit t ngm nh ca GNOME, thao tc thu nh mt ca s ng dng lm cho ca s bin mt khi mn hnh, tuy nhin pha di y mn hnh nn xut hin mt hnh ch nht nh (c th c biu tng no tng ng vi trnh ng dng). Kch chut vo hnh ch nht , chng ta li nhn c ca s ng dng nh trc khi b thu nh. GNOME cho php ngi dng s dng vt-GNOME qun l mn hnh v cc ng dng ang hot ng trong mn hnh . 1.5. Ra khi GNOME ra khi GNOME, trc ht i ti thanhGNOME, kch chut tri vo nt-menu-chnh nhn c mt dy mc ca cc b ng dng c trong GNOME, trong c mc Logout. Kch chut tri vo mc Logout trong danh sch ni trn, mn hnh logout t GNOME xut hin (xem hnh 1.5) ng thi vi mn hnh GNOME vn cn tn ti. Nu khng thc s mun ra khi GNOME hy kch chut tri vo vng ch nht cha ch No, chng ta s tr li mn hnh GNOME. Nu mun thc s ra khi GNOME, kch chut tri vo cc ng nhp li, Tt my, Khi ng li, sau kch chut tri vo vng ch nht con cha ch ng .
Trang 7

Hnh 1.5 Hp thoi logout

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Cc lnh ng nhp li, Tt my, Khi ng li tng ng c thc hin. Trc , nu mun lu li cc thit t thc hin trong phin lm vic m cha lu li, hy kch chut tri vo vung nh bn cnh thng bo Ghi li cc thit lp hin ti. 1.6. Mt s quy c trnh by ni dung cun sch thun tin cho vic trnh by v tm hiu cc ni dung ca cun sch ny, mc ny gii thiu mt s quy c sau y trong vic trnh by ni dung: Cc xu vn bn ting Anh xut hin trong mn hnh ha GNOME hoc xut hin trong cc thnh phn khc ca h iu hnh (tr tn tp tin, tn th mc) c vit ng nh ting Anh theo kiu ch rng, m (c th dng font ch .VnCourier New ca ABC). Mt lp ph bin cc xu nh th l tn nhm menu, tn menu, tn la chn, tn nt, , thng bo ca h thng ... Mt s v d v cch vit nh th l thng bo Ghi li cc thit lp hin ti, ng nhp li, Tt my, Khi ng li, mc Trnh qun l ca s, nhm chc nng Destop, menu Thanh Panel, menu Trung tm iu khin GNOME... Tn lnh, tn tp tin, tn th mc, tn mt trnh ng dng ... thng c vit theo kiu ch khng chn, m (chng hn dng font ch VnArial). Mt s v d l lnh ng nhp li, Tt my, Khi ng li, trnh Qun l file... Trong mt s trng hp, cc khi nim ting Vit c dng ch cc i tng trong GNOME cng c vit theo kiu ch rng, m (c th dng font ch .VnCourier New ca ABC), c th c gch ni hoc khng. Mt s v d v cch vit nh vy l Vt-GNOME, Thanh-GNOME, Mn-hnh-nn ... Trong mt trng hp khc, cc khi nim ny c vit nh cc xu vn bn ni dung nh thng thng. Mt s khi nim mc, , nt, menu, nhm chc nng ... c dng vi ngha xc nh tng i, tuy nhin mt s ni dung sau y nu c phn bit s b v ngha ca chng: La chn v nt bm c dng ch cc i tng m khi c chn th khng xut hin thm bng chn mi na, ngha l chng khng c cc i tng thnh phn. Menu, nhm chc nng, mc ... c dng ch cc i tng khi n c chn th mt bng chn mi c xut hin chn la tip. Trong mt s trng hp, khi nim mc cng mang ni dung nh vy. Menu c th c hiu nh thc n hay bng la chn, tuy nhin chng ta coi thut ng "menu" l c ph dng. Trong GNOME, chng ta phn bit hai loi menu: menu ng cnh v menu bt(pop-up menu). Menu ng cnh l menu hin ra khi kch chut tri mt nt menu, chn mt mc hay a chut ti mt mc; vic hin menu gn vi mt v tr nht nh theo ng cnh. Menu bt l menu hin ra khi chng ta nhn chut phi vo v tr khng bt buc phi xc nh. Trong cun sch ny, chng ta dng t "menu" ch menu ng cnh phn bit vi "menu bt".

Trang 8

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Chng 2. S dng thanh GNOME

2.1. Mt s khi nim lin quan Thanh GNOME l trung tm ca giao din GNOME, hot ng nh mt ci kho lu tr v trng by cc mc gm tiu dng, nt bt, nt menu (v cc ngn ko, xem on 2.4.3), thng trc phc v ngi dng. Thanh GNOME rt d nh hnh. Ngm nh c sn mt thanh GNOME. GNOME cho php ngi dng to thm thanh GNOME trn mn hnh nu thy iu l cn thit. Ngc li, GNOME cng cho php loi b bt cc thanh GNOME thm ch ti mc khng cn mt thanh GNOME no. Tuy nhin, thanh GNOME c tc dng h tr ngi dng rt hiu qu v vy nn c t nht mt thanh GNOME. Thanh GNOME m ngi dng chn hoc ang lm vic c gi l thanh GNOME hin thi. Khi nim tiu dng c dng ch cc trnh ng dng nh, c phn bit vi cc ng dng ni chung khng nhng v cch hin th trn thanh GNOME m cn v c cch h thng qun l tin trnh (process) ca tiu dng l khc bit vi tin trnh ca ng dng ni chung. Ti nhng mc trnh by tiu dng, thay v hin th mt nt bm nh i vi ng dng, chng ta li thy hin th kt qu thc hin ca tiu dng. V d, tiu dng ng h cho kt qu l thi gian h thng c hin th ti mc tng ng vi tiu dng. V t chc qun l tin trnh, cc tin trnh tiu dng thng c t vng cache trong b nh trong. Cc nt trn thanh GNOME (nt menu, nt bt ..) thc cht cng l cc nt m nhng l vi biu tng nh (tng t nh biu tng ca menu chnh) m khng s dng biu tng ln v tn nh nt ti mn hnh nn. C mt mi tn nh nt menu phn bit vi cc nt khc. Khi a chut n mt nt bt, mt li gii thch ni dung ca nt hin ra ngi dng nhn bit. Khi kch chut vo mt menu th mt danh sch cc thnh phn con ca menu c hin ra cho ngi dng s dng. Khi kch chut vo mt nt bt th trnh ng dng tng ng c thc hin. on 2.2 trnh by hai thao cc c bn nht v cc on tip theo trnh by mt s thao tc khc i vi thanh GNOME. a s cc thao tc ti thanh GNOME c thc hin bng cch gi menu-bt-thanh-GNOME, mt khi nim i km vi thanh GNOME. Trong khi trnh by v thanh GNOME nhiu lc chng ta gi tt menu bt thanh GNOME l menu-thanh, tuy nhin nn nh rng c nhiu menu bt tng ng vi tnh hung lm vic. Menu-thanh l mt bng cha danh sch cc mc lm vic vi thanh GNOME gm cc mc menu: Menu h thng, Menu ngi dng, Thm ng dng, Thm menu chnh, Thm menu ngn ko, Thm nt thot, Gi chng trnh, Thm mt chng trnh mi, Cc thuc tnh..., Cc thuc tnh chung..., Chuyn ti Panel gc hoc Chuyn ti panel vin, To panel mi, Xo b panel ny, Thot. ngha ca mi mc hay menu ny c trnh by trong nhng tnh hung lin quan n chng. C hai cch lm cho menu thanh hin ra. Cch th nht c thc hin rt n gin, ch cn kch chut phi vo vng rng bt k trn thanh GNOME: menu thanh xut
Trang 9

KC-06-03CN

Hng dn s dng Giao din ha GNOME

hin ngay. Cch th hai c thc hin theo trnh t: vo menu chnh, chn menu con Thanh panel trong danh sch menu chnh (xem hnh 2.2): menu thanh hin ra. Cng vic chn menu thanh c coi l mt thao tc c bn nht khi lm vic vi thanh GNOME. Thanh GNOME c hai kiu: kiu vin v kiu gc. Thanh GNOME vin (Edge Panel) c dng mt thanh di nm dc kn theo mt cnh ca mn hnh nn. Hnh 1.2 cho mt v d v thanh GNOME vin. Thanh GNOME vin thng c hai nt n hai u cho php c th n thanh GNOME theo hai hng. Hnh 2.3 di y cho hnh nh ca nt n tri. Thanh GNOME gc (Corner Panel) l mt hnh ch nht mt gc ca mn hnh nn, kch thc ph thuc vo s lng cc mc c trong thanh GNOME. Thanh GNOME gc cng c hai nt n: mt nt hng mi tn v mp mn hnh cn nt kia hng theo chiu ngc li. Thanh GNOME gc s c tri di ra khi b sung mc mi vo n. GNOME cho php chuyn i thanh GNOME hin thi t kiu ny sang kiu kia bng cch chn mc Chuyn ti Panel vin (khi thanh GNOME hin thi l gc) hoc chn mc Chuyn ti Panel gc (khi thanh GNOME hin thi l vin). Mt trong hai mc ny xut hin khi menu thanh c bt v ty thuc vo kiu ca thanh GNOME mun chuyn i. 2.2 Cc thao tc c bn trn thanh GNOME Vic s dng thanh GNOME rt n gin v d dng. C th thm cc thanh GNOME mi hoc thm cc ng dng hay cc tiu dng mi vo mt thanh GNOME. Chng ny v mt s chng sau s m t cc ni dung v cch s dng v cc thao tc ti thanh GNOME. 2.2.1 Nt menu chnh v s dng Menu chnh bt u s dng bt k mt ng dng no c np trc, hy kch chut tri vo nt-menu chnh. Nt menu chnh c hnh nh mt bn chn (hnh 2.1) v thng ngm nh c t pha tri ca thanh GNOME (xem hnh 1.2). Nn nh chut sau khi nhn vo nt menu chnh c th thc hin c cc tnh nng kch chut phi hay ko-th trn menu chnh.

Hnh 2.1 Nt Menu chnh

Menu chnh (xem hnh 2.2) l im bt u cho vic s dng tt c cc ng dng c trn h thng. Cc phn sau ca cun sch ny s gii thiu cch ngi dng c th bin i menu chnh tha mn mi trng lm vic ca mnh, tuy nhin hin ti chng ta coi cc menu thnh phn tng ng vi cc b ng dng c thit lp khi ci t GNOME. Menu chnh hot ng tng t nh mi menu khc trong mi trng ha. n gin l kch vo nt menu chnh v la chn cc mc con khi menu chnh hin ra.

Trang 10

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Hnh 2.2 cho thy cc mc (thnh phn) trong menu chnh c chia hai loi khc nhau: mt s mc c du mi tn bn phi ( ) v cc mc cn li th khng. Mc c du mi tn (chng hn nh Cc ng dng, Cc tr chi, H thng ...) l mt menu con. Khi ngi dng di con tr chut ti mt trong nhng mc ny th menu con (l mt menu ng cnh) xut hin ngi dng chn la cc mc con ca menu con . Trong hnh 2.2, mc a phng tin c chn v v vy xut hin menu con tng ng c dng tiu l a phng tin). Mc ca menu chnh khng c du mi tn (chng hn nh Kho mn hnh, Thng tin v h thng...) n thun l mt nt bt ca mt trnh ng dng. Sau y, chng ta gii thch s b v ngha ca mt s mc xut hin trong menu chnh. Cc ng dng: Mc ny cha cc trnh ng dng c np vo h thng GNOME. Khi di con tr chut ti mc ny, cc trnh ng dng hoc cc nhm trnh ng dng s hin ra cho ngi dng chn la. Cc tr chi: Cha cc b chng trnh tr chi, gii tr ca GNOME. Ngi ta nh gi rng Linux l h iu hnh c mt lng kh phong ph cc tr chi c ci t sn v hn hn mt s h iu hnh khc. Mc H thng cho ngi dng cc cch thc thao tc cng nh cu hnh trn h

Menu

Mc menu con chn c

Hnh 2.2. Menu chnh

thng. Mc Thanh panel cho ngi dng kh nng thao tc vi thanh GNOME (b sung, thay i, loi b cc mc...) v thm ch b sung v loi b chnh thanh GNOME. Mc Thot (thng l mc thp nht trong menu chnh; khng xut hin trn hnh 2.2 v b ct mt pha di) cho php ngi dng kt thc mt phin lm vic. Cc mc cn li Mng Internet, a phng tin, Cc cng c pht trin... cha cc trnh h thng hoc trnh ng dng m tn mc ni ln phn no ngha ni dung ca cc thnh phn . Cc chng tip theo s trnh by chi tit ni dung chnh yu ca mt s mc thng dng trong menu chnh. 2.2.2 n thanh GNOME S dng tnh nng ny khi khng cn hin th cc mc trn thanh GNOME na tng khng gian ri ca mn hnh nn. i vi thanh GNOME vin, khi kch chut th ton b di ca thanh thu vo nt n c kch. Khi thanh GNOME c n mun hin li n, chng ta ch cn kch chut tri vo nt n mt ln na. Nt n ng y vai tr ca mt nt n/hin theo ngha: n khi ang
Hnh 2.3. Nt n
Trang 11

KC-06-03CN

Hng dn s dng Giao din ha GNOME

hin hoc hin khi ang n. i vi thanh GNOME gc, nt n hot ng hi khc mt cht. Nu nhn nt n st vi mn hnh, thanh GNOME gc s n nh thanh GNOME vin, cn nu nhn nt n cn li th ton b thanh GNOME gc ny s chuyn i xng ti vin i din m khng n. Nh vy thc s n n, s phi nhn vo nt n st mp mn hnh. Chng Cu hnh thanh GNOME trnh by cch thc cho php thit t cch n t ng thanh GNOME. 2.3. Di chuyn v thm thanh GNOME Bt k mt thanh GNOME no c trn mn hnh nn u c th c di chuyn bng cch s dng vic kch nt chut gia ri ko thanh GNOME n ni m ngi dng mun t n trong mn hnh nn. Nu khng c mt nt chut gia (hoc h thng khng thit lp m phng nt chut gia), ngi dng cng di chuyn c thanh GNOME bng cch thay i v tr ca n trong hp thoi Thuc tnh ca panel. Chng Cu hnh thanh GNOME trnh by chi tit v cch thc ny. thm mt thanh GNOME mi vo mn hnh nn, hy gi menu bt v chn menu con To Panel mi trong danh sch. Hai la chn c hin ra ngi dng xc nh kiu ca thanh GNOME mi, l la chn Panel cnh hoc la chn Panel gc. Hai la chn ny c m t nh sau: Panel cnh - Khi to mt thanh GNOME vin vo mt cnh cha t thanh GNOME mn hnh, nu mi c mt thanh GNOME vin th cnh i din c s dng. Panel gc - Khi to mt thanh GNOME gc mi vo mt gc ri mn hnh. Sau khi c c thanh GNOME, chng ta s dng cch thc b sung cc tiu dng, ng dng, nt menu v ngn ko vo n. 2.4. B sung cc thnh phn vo thanh GNOME 2.4.1. B sung tiu dng thm mt tiu dng hy chn menu con Thm ng dng trong menu thanh. Mt danh sch mi gm cc menu c hin ra. T cc menu con ny, hy chn tiu dng cn b sung vo thanh GNOME. Chng Cc tiu dng thuc thanh GNOME s cung cp cc ni dung chi tit v cc tiu dng ca GNOME. V d, thm mt tiu dng ng h mi vo thanh GNOME, trc ht chng ta chn menu thanh. Trong menu thanh chn menu con Clocks v mt danh sch cc mc hin ra. Chn mt mc no , chng hn nh Clock and Maincheck, mt tiu dng
Hnh 2.4. Hp thoi to nt bt ng dng
Trang 12

KC-06-03CN

Hng dn s dng Giao din ha GNOME

xut hin ngay trn thanh GNOME. 2.4.2. B sung ng dng i vi cc ng dng ph dng nht nn t chng vo thanh GNOME to mi trng lm vic thun tin. Nu mun thm mt nt m ng dng vo thanh GNOME, chn mc Thm ng dng mi t menu thanh. Sau khi chn mc Thm ng dng mi, mt hp thoi c tn l To mt ng dng Launcher s hin ra cho php ta thit t nhng thuc tnh cho nt m ng dng mi ny (hnh 2.4). Trong hp thoi To mt ng dng Launcher, c th t tn cho nt m, thm dng ch gii, dng lnh chy ng dng, v nh ngha kiu ng dng. Cng c th nhn nt Biu tng v chn mt biu tng cho nt m t danh sch cc biu tng. Nu khng c biu tng no th mt biu tng mc nh s c chn cho nt m . Mt cch khc nhanh hn thm mt nt m ng dng vo thanh GNOME. Trc ht vo menu chnh v kch chut phi vo mc tng ng vi ng dng cn a vo thanh GNOME. Mt menu bt tng ng (khc vi menu thanh) c cha mc Thm chng trnh vo Panel s c hin ra. Nu la chn mc ny, GNOME s t ng thm mt nt m cho ng dng c la chn t menu chnh vo thanh GNOME. Khi kch chut phi vo mt mc trong thanh GNOME, mt menu c cha ba mc (Loi khi panel, Di chuyn ng dng, Cc thuc tnh) c hin ra cho php ngi dng loi b mc ny ra khi thanh GNOME, chuyn v tr ca mc hay thay i thuc tnh ca mc, mt cch tng ng. i vi mt nt m mi nn vo mc Cc thuc tnh la chn nhng thuc tnh mun thay i cho nt m ny nu thy cn thit. 2.4.3 B sung ngn ko Ngoi tiu dng, nt m ng dng v menu, thanh GNOME cn c th cha cc ngn ko (drawer). Biu tng nh sn cho mt ngn ko c dng ca mt chic ngn ko thng thng. Ni dung ngn ko tng t nh ni dung ca mt thanh GNOME c ngha l cng cha cc tiu dng, cc nt m ng dng, cc ngn ko con. Tuy nhin, khc vi thanh GNOME, ngn ko c sn mt u c nh vi thanh GNOME (di biu tng chic ngn ko nh ni), cn u Hnh 2.5. M ngn ko kia c mt nt n/hin. Nt n hin cho php ng v m ngn ko: khi cn s dng thnh phn ca mt ngn ko th cn m ngn ko ra ly (xem hnh 2.5), cn ni chung th nn ng ngn ko li m rng vng ri trn mn hnh nn. GNOME cho php to ra mt ngn ko mi nhm cc tiu dng, cc nt m ng dng. C hai tnh hung to mt ngn ko trn thanh GNOME: To mt ngn ko rng v to mt ngn ko vi ni dung l mt menu con sn c trong menu chnh. to mt ngn ko mi, trc ht vo menu thanh v chn mc Thm menu ngn ko t n. Mt ngn ko rng c to ra. Kch chut phi vo nt n/hin ca ngn ko ny np cc thnh phn ca n vo. T y mi thao tc vi ngn ko tng t
Trang 13

KC-06-03CN

Hng dn s dng Giao din ha GNOME

nh vi mt thanh GNOME. Vic a mt menu con sn c trong menu chnh thnh mt ngn ko c thc hin nh sau: m menu chnh, chn mc hin ra menu con tng ng, dng u tin ca menu con ny ging ht tn mc trn menu chnh c gi l dng tiu ; kch chut phi vo dng tiu th mt menu bt ra v la chn mc Thm ngn ko vo panel trong menu bt ny. Cch thm menu vo thanh GNOME tng t nh cch thm ngn ko. C th thm mt menu vo thanh GNOME bng cch nhn chut phi vo tiu ca mt menu v la chn Thm menu vo panel t menu con bt ra. Cng c th thm nhng th mc h thng vo thanh GNOME nh nhng menu bng vic ko mt th mc ra khi trnh qun l tp tin GNOME v th n vo thanh GNOME. 2.5. Chy cc ng dng trong GNOME C nhiu cch chy cc ng dng trong GNOME. Mt trong s nhng im mnh in hnh ca GNOME l GNOME cho php khi ng v iu khin cc ng dng bng mt giao din ha rt d s dng. t tiu dng vo thanh GNOME l cch n gin nht trong vic gi cc trnh ng dng ra thc hin song ch p dng c cho cc tiu dng. Tiu dng ng h (hnh 2.6) chy thng trc ngi dng bit c thi gian hin thi m h iu hnh qun l.

Hnh 2.6. ng h Applet

Nh bit, GNOME cho php chy ng dng t cc nt m ng dng trn thanh GNOME hoc s dng menu chnh chy nhng ng dng c GNOME np sn vo menu chnh (v c bin tp li khi s dng menu Editor; on Son tho menu trong chng Son tho menu chnh s trnh by v cch thc ny). Mt khc nh c gii thiu trong chng 1, nu ngi dng ang s dng trnh qun l tp tin GNOME, th GNOME cho php kch p chut tri vo nt bt tp tin kh thi bt k nu mun chy n. GNOME cn cho php s dng trnhchy-ng-dng chy bt k ng dng no. s dng n, hy chn mc Cc ng dng/Chy chng trnh... trn menu chnh. Mt hp thoi n gin hin ra (hnh 2.7) cho php nhp lnh tng ng vi trnh ng dng. V d, nu mun khi ng Hnh 2.7. Hp thoi trnh chy ng trnh bin son emacs, hin khng c trn menu chnh hoc trn thanh GNOME, chn dng mc Cc ng dng/Chy chng trnh... t menu chnh v nhp lnh emacs vo hp thoi v sau chn nt Run. Ngoi cch g lnh trc tip nh vy, GNOME cn cho php ngi dng s dng nt Duyt... trn hp thoi trnh-chy-ng-dng chn la tp tin ng dng thuc h thng tp tin chy.

Trang 14

KC-06-03CN

Hng dn s dng Giao din ha GNOME

2.6. Cch thc ra khi GNOME on 1.6 trong chng 1 gii thiu s b v cch ra khi GNOME. on ny trnh by chi tit hn v ni dung ny. GNOME c hai phng php rt tin li ra ngoi mi trng ho, l hoc s dng mc con Thot trong menu chnh hoc s dng nt Thot (nu c) trn thanh GNOME. Nn b sung nt Thot vo thanh GNOME chn la cho thun tin. c c nt Thot trn thanh GNOME, hy chn mc Thm nt thot t menu thanh. Phng php s dng mc con Thot trong menu chnh c trnh by ti on 1.6 (chng 1) cn cch s dng nt Thot trn thanh GNOME th tht l n gin: kch chut tri vo nt . Nh gii thiu trong on 1.6, hp thoi Thot s c hin th (hnh 2.8) khi p dng mt trong hai phng php ra khi GNOME. Thao tc s b trn hp hi thoi ny cng c gii thiu. Mt s gii thch b sung v cc la chn trn hp hi thoi Thot khi ra khi GNOME: chn nt Thot thot khi mt ng nhp - chn nt Tt my ng ton b h thng - chn nt Khi ng li khi ng li ton b h thng. Trong trng hp khng mun thot ra khi GNOME, hy chn nt Khng.

Hnh 2.8. Hp thoi logout

Bn trong hp thoi Thot cn c mt la chn cho php lu trnh ci t hin thi, l mc chn Ghi li cc thit lp hin ti m bo vic lu tr nhng chng trnh m, v cu hnh thanh GNOME trn h thng.

Trang 15

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Chng 3. Mn hnh nn trong GNOME

Mn hnh nn trong GNOME (sau y gi tt l mn hnh) c cung cp y nhng tnh nng hot ng trn mn hnh ho nh bt k h iu hnh khc. Cho php ngi dng ko-th tp tin, trnh ng dng hay th mc ln trn mn hnh cng nh ko chng vo trong cc ng dng tng thch vi GNOME. 3.1 S dng mn hnh S dng mn hnh rt n gin (tng t nh s dng thanh GNOME c trnh by chng 2) do cc thao tc i vi mn hnh l kh n gin, i loi nh thao tc ko cc ng dng c s dng thng xuyn ln trn mn hnh. Ngm nh trn mn hnh nt m th mc c nhn ca ngi dng c t sn di dng mt biu tng nh vi tn th mc (/home/[user name]). Trong nhiu trng hp, GNOME cng ngm nh l khi vo GNOME th ca s ng dng ca trnh qun l tp tin GNOME cng c t sn nhm cho php truy nhp n h thng tp tin trn h thng. Mi khi GNOME c khi ng, cc thit b c ni vi h thng m ngi dng c quyn truy nhp s c hin th trn mn hnh vi nhng biu tng tng ng. GNOME cho php ngi dng kt ni v truy nhp ti cc thit b thng qua nhng biu tng ny. Lu : Ch nhng thit b m ngi dng c quyn kt ni v truy nhp c mi c th c biu tng xut hin trn mn hnh. Nu ngi dng khng c php kt ni ti mt thit b no , th siu ngi dng cho php kt ni ti thit b bng cch sau: Trong trng hp linuxconf c thit t trn h thng th thc hin ng dng ny: chn thit b mun truy nhp trong mc Truy nhp a cc b. Trong mc Tu chn chn mc con Ngi dng c th kt gn. Thit b by gi s c kt ni ti mi ngi dng. Trong trng hp linuxconf cha c thit t trn h thng th siu ngi dng thc hin vic son tho tp tin fstab trong th mc /etc b sung vic truy nhp thit b i vi ngi dng bng cch thm thuc tnh ngi dng vo thit b . V d, cn cho php ngi dng lan c quyn kt ni CD-ROM. Trong trng hp , xem xt dng tng ng vi CD-ROM trong tp tin fstab. Ch , trong tp tin ny tng ng vi mi thit b l mt dng, mi dng c 6 ct v ct th t l danh sch ngi dng c php kt ni vi thit b . Dng tng ng vi CD-ROM c dng:
/dev/cdrom /mnt/cdrom iso9660 exec,dev,ro,noauto 0 0

Trang 16

KC-06-03CN

Hng dn s dng Giao din ha GNOME

th thm " ngi dng" vo ct th t:


/dev/cdrom /mnt/cdrom iso9660 lan,exec,dev,ro,noauto 0 0

Ty thuc vo h thng v mi trng lm vic, cn ch ti cc ni dung v bo mt khi cho php ngi dng quyn kt ni v truy nhp n cc thit b. Khi c php kt ni n thit b, hy kch chut phi vo biu tng ca thit b trn mn hnh. Mt menu bt nh c a ra, c th chn mc Mount thit b kt ni ti n hoc chn mc Eject thit b hy b kt ni (i vi CD l a a ra). Khi kt ni c, hy nhn p vo thit b hoc chn mc M t menu bt m v hin ni dung ca thit b trong trnh qun l tp tin GNOME. 3.2 Vng mn hnh Mt mn hnh c th c chia ra lm nhiu vng mn hnh v c gi l cc "mn hnh o". Vic chia mn hnh thnh cc vng nh vy cho php t chc tt h thng, to thun li cho ngi dng khi c nhiu tin trnh cng c thc hin ng thi. Vi vic c nhiu vng mn hnh, GNOME cho php ti cng mt thi im ngi dng c th m nhiu ng dng, mi ng dng c t trn mt vng mn hnh ring. GNOME nhn bit c nhng vng mn hnh cho d chng c kim sot bi cc phn mm gi l trnh qun l ca s (Window Manager) khc nhau. Nu ang s dng trnh qun l ca s ngm nh ca GNOME hoc trnh qun l ca s c cng c cu hnh ha, c th s dng cng c cu hnh ha. on Tiu dng trnh qun l ca s trong chng B iu khin trung tm GNOME cung cp nhng ni dung b sung v trnh qun l ca s GNOME. Lu : Hu ht cc trnh qun l ca s u cho php c th c nhiu mn hnh khc nhau, v trn mi mn hnh li c nhiu vng mn hnh khc nhau. Theo ngm nh, GNOME ch s dng nhng vng mn hnh ca mt mn hnh duy nht. Nguyn nhn y l mt s ng dng, v d nh s dng mt vi Motif, ngi dng c th gp phi vng mc khi thc hin tnh nng ko-th gia cc mn hnh. 3.3. Nhng menu mn hnh khc GNOME cho php thit t v s dng mt vi menu trn mn hnh nn. in hnh nht trong s l menu mn hnh c bt ra khi ngi dng kch chut phi vo bt k vng trng no trn mn hnh. Menu ni trn bao gm cc mc nh sau: Mi: Khi chn mc ny, mt menu con c hin ra vi cc mc con: Terminal - La chn ny thc hin vic m mt ca s trm cui Gnome (GNOME Terminal) mi thao tc theo ch giao din vn bn. Thc hin la chn ny s t ng hng ti th mc ~/. gnomedesktop. Th mc...- La chn ny to mt danh mc mi trn mn hnh lu gi cc tp tin. y l cch thc thun tin lm gn mn hnh.
Trang 17

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Launcher... - Cho php t mt nt m ng dng mi trn mn hnh. Khi chn mc menu ny, hp thoi Cc thuc tnh u vo ca Destop cho php xc nh ca ng dng cng nh nhng thuc tnh ca chng. Lin kt URL...- La chn ny cho php thit t mt a ch URL mi. Biu tng mt trang Web c dng phn bit vi cc i tng khc. Sp xp cc biu tng - Mc ny thc hin vic GNOME t ng sp xp nhng biu tng trn mn hnh. Khi chn mc ny, mt menu vi cc la chn Theo tn, Theo kiu file, Theo kch c, Theo ln truy nhp cui, Theo thi gian sa ln cui, Theo thi gian thay i ln cui c hin ra tng ng vi th t sp xp theo tn, theo kiu tp tin, theo di tnh theo byte, theo cc thi gian thao tc vi tp tin. Kch chut la chn cch sp xp. To ca s mi - Thc hin vic chy trnh qun l tp tin m thng tin u vo l th mc c nhn ca ngi dng (th mc hin thi l th mc ngi dng), c ngha l khi to mt ca s ng dng mi. Qut li th mc - Thc hin vic r sot li cc tp tin trong th mc ~/.gnome-desktop. Bt k mt tp tin mi no c tm thy s c t trn mn hnh di dng cc biu tng. Qut li cc thit b h thng - Thc hin vic r sot li nhng thit b c th kt ni trn my v hin th biu tng cho mi thit b mi c tm thy. To li cc Icon ngm nh - R sot v hin li cc biu tng ngm nh xut hin trn mn hnh. Thit lp hnh nh nn - Cho php ngi dng vo qu trnh thit t mt s c tnh i vi mn hnh nh chn nh nn, ch ngh mn hnh ... 3.4. Tnh nng ko-th trong GNOME C rt nhiu mo nh s dng mn hnh trong GNOME. Cc tnh nng ko v th c m rng ti nhiu vng ca GNOME lm cho n d dng kt ni GNOME theo nhiu cch. Di y l mt lot nhng mo nh s dng tnh nng ko-th trong GNOME. y l mt cch kh tt tm hiu v GNOME v qua y s bit cch dng GNOME vi y mi kha cnh ca n. Ko mt mu ln trn thanh GNOME - Cho php ko mt mu c chn t thanh mu n thanh GNOME v mu ca thanh GNOME s thay i. Ko mt nh pixmap ti b chn nh nn - Nu mun thay i nh nn bi mt nh no , c th ko nh t trnh qun l tp tin n nn mn hnh v nh s l nh nn. Ko mt ng dng - C rt nhiu ng dng tng thch vi GNOME chp nhn tnh nng ko-th. Nu mun m mt tp tin bn trong gnumeric (GNOME tng thch vi ng dng bng biu), c th ko tp tin t trnh qun l tp tin ln trn
Trang 18

KC-06-03CN

Hng dn s dng Giao din ha GNOME

gnumeric v n s m tp tin. Cho php ko URL c lu ln trn Netscape 4X m URL . iu ny rt tin li nu ang lm vic bn trong trnh qun l tp tin v mun m mt tp tin tht nhanh. Thm mt nt bm ng dng vo thanh GNOME - Nu mun thm mt nt bm ng dng vo thanh GNOME c th ko v th bt k tp tin no t trnh qun l tp tin hoc mn hnh nn ln thanh GNOME. Hp thoi To mt ng dng Launcher c hin th v cho php chn mt tn v mt biu tng cho nt m . Ko th tp tin - C nhiu cch s dng tnh nng ko-th gip qun l h thng cc tp tin. ng thi c th m hai ca s trnh qun l tp tin, la chn hai th mc khc nhau ri ko nhng tp tin gia hai ca s sao chp, di chuyn, hoc lin kt cc tp tin, hay ko nhng tp tin t trnh qun l tp tin n mn hnh nn d truy cp. S dng nt chut gia ko mt th mc ln mn hnh. Chn ty chn Lin kt y t menu bt ra to mt mi lin kt n mn hnh. iu ny s cho cch nhanh nht hin th th mc bng trnh qun l tp tin. Ko th th mc - c th ko mt th mc ra khi ca s ng dng ca trnh qun l tp tin GNOME v t n ln thanh GNOME. Mt nt menu mi c to ra cho php d dng truy cp ti cc tp tin trong th mc . Cho php ko-th bt k menu con no t menu chnh n thanh GNOME to mt nt-menu mi cho thanh GNOME. iu ny cho php truy nhp ti cc menu con c d dng hn. Lu : s dng c tnh nng ko-th chut, cn dng mt ng dng tng thch vi GNOME hoc mt ng dng Motif ca UNIX. GNOME tng thch vi Motif ko-th v th GNOME lm vic c vi nhiu ng dng c thit t. Tt c cc mc lu trn mn hnh c nh v trong th mc sau: /home/[user name]/.gnome-desktop/ Th mc ny bao gm c nhng ng dng tng thch vi chc nng ko-th ln cc ng dng khng tng thch vi chc nng ny. Nn ghi nh tc dng ca th mc ny lu mt mc trn mn hnh m khng th dng c tnh nng ko-th i vi ng dng tng ng. 3.5. Vt-GNOME Vt-GNOME c gii thiu nh mt khi nim c bn trong GNOME (xem on 3.1). Vt-GNOME l tiu dng thc hin vic hin th hin trng v cc vng mn hnh v cc ng dng ang c chy ti mn hnh hot ng. Vt-GNOME thng c thit t ngm nh trn thanh-GNOME, v vy v ph bin khi ngi dng lm vic vi GNOME c Vt-GNOME trn thanh-GNOME. Trn thanh-GNOME, vtGNOME c phn thnh hai phn: phn cc mn hnh v phn danh sch cc tin trnh. Hnh 3.1 cho mt hnh nh v d v Vt-GNOME. Phn mn hnh ( bn tri theo hnh 3.1, cn c gi l Desk Guide), cha ton b cc vng mn hnh c thit t, mi vng mn hnh c t trn mt ch nht. ch nht trn Vt-GNOME cho hnh nh thu gn ca vng mn hnh tng ng: cc ca s ng dng tr thnh nhng hnh ch nht b xu. Ti mt thi im, ngi dng
Trang 19

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Nt hin cc tin trnh

Vng cc mn hnh nhiu vng mn hnh


Hnh 3.1 Vt-GNOME

Danh sch cc tin trnh thuc mn hnh hot ng

ch lm vic vi mt vng mn hnh (tng ng vi chnh mn hnh nn hin thi) v mn hnh c gi l mn hnh hot ng. GNOME cho php ngi dng thay i mn hnh hot ng bng cch kch chut vo ch nht tng ng vi vng mn hnh cn hng ti. Sau tc ng , mn hnh nn ca GNOME s chuyn sang vng mn hnh hot ng c chn. Phn danh sch cc tin trnh ( bn phi theo hnh 3.1, cn c gi Tasklist) cha cc tin trnh ang thc hin ti mn hnh hot ng. Khi ngi dng thay i mn hnh hot ng th ni dung phn ny, ngha l danh sch cc tin trnh, cng thay i mt cch tng ng. GNOME cho php cu hnh Vt-GNOME trong bao gm c vic tro i v tr triphi ca phn mn hnh v phn danh sch cc tin trnh. on Thit t vt GNOME trong chng Cc tiu dng trong thanh GNOME trnh by ni dung chi tit v Vt-GNOME.

Trang 20

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Chng 4. Trnh qun l tp tin trong GNOME

4.1 Li gii thiu GNOME c mt trnh qun l tp tin (GNOME File Manager) cho php thao tc vi cc tp tin trn h thng trong mt mi trng ha tin li v rt mnh. Trnh qun l tp tin ny c bit n nh GMC ca GNU Midnight Commander. GMC da trn chng trnh qun l tp tin Midnight Commander (MC) v n c th chy c trn mt thit b u cui. Midnight Commander l mt tin ch vi nhiu kh nng phong ph m li rt d dng s dng, tng t nh tin ch Norton Commander trong h iu hnh MSDOS. GMC kt hp c nhng u im ca MC v ca mi trng ha trong GNOME. Nh c cp trong chng trc, trnh qun l tp tin GNOME cung cp tnh nng hot ng mn hnh cho GNOME. Trnh qun l tp tin GNOME s dng h thng ca s trong cng vic qun l cc tp tin trn h thng.

Hnh 4.1 Ca s ng dng ca Trnh qun l tp tin GNOME

Khi thc hin trnh qun l tp tin GNOME, vng mn hnh ca n xut hin c dng nh hnh 4.1. C hai ca s chnh bn trong vng mn hnh ny. Ca s bn tri l cy th mc biu din cc th mc c trn h thng theo cc mc tng ng. Ca s bn phi l ca s th mc trnh by ni dung ca th mc c chn bn ca s tri. Lu : Trong chng ny, v ph bin khng phn bit khi nim "nt m tp tin" vi khi nim "tp tin" tng ng. Khi ni ti cc thao tc kch chut, di chuyn... tp tin th iu c ngha l tc ng ti nt m tp tin song thc cht l tc ng ti tp tin thc s.
Trang 21

KC-06-03CN

Hng dn s dng Giao din ha GNOME

chn mt th mc trn cy th mc ch vic kch chut vo n, khi ni dung th mc chn s c hin th ca s bn phi. Nu c mt du cng bn tri tn th mc trong ca s cy th mc th l mt th mc c cha cc th mc con: kch vo xem nhng th mc con ca n v khi du cng s chuyn thnh du tr. V ngc li, nu kch chut vo du tr th cc th mc con ca th mc chn s n i v du cng xut hin tr li thay th du tr. Trong vng mn hnh ca trnh qun l tp tin, pha trn hai vng hin th chnh cn c bn thanh h tr cc thao tc ca ngi dng khi lm vic. Thanh trn cng l thanh vin kiu Clean c cc nt thu/phng/ng mn hnh gc v tn th mc c chn gia thanh. Dng th hai trnh by mt s nhm chc nng ca trnh qun l tp tin. Khi chn nhm chc nng no th danh sch chc nng con ca n c hin ra ngi dng chn la yu cu thao tc ln cc tp tin. Mi nhm chc nng tng t nh mt menu trnh by cc la chn theo yu cu ngi dng, v chng ta cng gi l mt menu. Dng th ba nh mt thanh cng c (tools bar) by sn mt s chn la in hnh nht, trong 4 thnh phn bn phi lin quan n ca s th mc, cn 5 thnh phn bn tri lin quan n ca s cy th mc. Dng th t cha tn ca mt ch dn tp tin hay ch dn trang Web ng sau t V tr:. Bn la chn in hnh lin quan n ca s th mc cho php chn la cch hin th danh sch cc thnh phn trong ca s th mc: hin th theo biu tng (icons) hay hin th theo kiu danh sch (vi ba phng thc: Ngn, Chi tit v Chn). Kch chut vo mt trong 4 la chn ny s thy ni dung ca ca s c trnh by ph hp vi l chn ca chng ta. Hin th theo biu tng l hin th mc nh v khi mi tp tin s c gn vi mt biu tng. Hin th theo danh sch ngn gn hin cc tp tin v cc th mc trong mt danh sch ch vi tn ca chng. Hin th theo danh sch chi tit hin ra danh sch cc tp tin cng vi mt s thng tin v cc tp tin . Hin th theo danh sch tu chn s cho php to mt danh sch hin th vi nhng thng tin v tp tin theo iu khin ca ngi dng. V d, nu mun tm nhng tp tin ln nht trong th mc c th kch vo tiu C file v s hin th cc tp tin theo th t v kch thc t ln ti nh. Kch thm mt ln na vo tiu C file, cc tp tin s c sp xp theo kch thc t nh ti ln ... 4.2. Di chuyn trong trnh qun l tp tin GNOME Nh gii thiu, ngay bn trn hai ca s chnh trong trnh qun l tp tin GNOME l mt hp vn bn V tr. Bn trong hp vn bn ny c th nhp ng dn nh v th mc m ngi dng mun t vo ca s th mc. Trnh qun l tp tin GNOME cng c trang b nhn vo cc site FTP. nhn mt site FTP cn ni ti Internet thng qua mt ti khon (account) hoc mt mng. Nhp a ch FTP vo trong hp V tr ang s dng, trnh qun l tp tin s kt ni ti website c a ch va nh vo. Hy nhp a ch FTP theo kiu sau: ftp://[ t a ch website]. pha trn hp V tr l nhng (5) nt nh hng c th s dng. Nhng nt ny vi nhng biu tng mi tn cho php di chuyn bn trong cc th mc c m lin k nhau. Nt tri s tr v th mc vo lc trc, nt gia a ln th mc mc trn trong cy phn cp th mc, v nt phi a tr v th mc tip sau .
Trang 22

KC-06-03CN

Hng dn s dng Giao din ha GNOME

4.3 La chn tp tin Vic la chn cc tp tin c thc hin khi kch chut vo tp tin hoc chn mt nhm tp tin trong trnh qun l tp tin. Biu tng ca tp tin (hoc ca cc tp tin trong nhm) c chn s chuyn sang mu khc phn bit vi cc i tng khng c chn. C nhiu cch chn nhiu tp tin cng mt lc. Cch th nht l r chut chn nhiu tp tin, cch ny c gi "vch ng" ("rubble band"). Thao tc ny s sinh ra mt ng ch nht chm k rt nh, v cc tp tin hay th mc nm trong ng ch nht c la chn (hnh 4.2). Cch th hai c dng chn nhiu tp tin k nhau, nhn chut v gi phm SHIFT trong khi chn tp tin u v cui ca dy lin k . Cch th ba c dng chn nhiu tp tin khng k nhau, c thc hin nh vic kt hp chut vi phm CTRL. Trnh qun l tp tin cn cho php la chn tt c cc tp tin trong mt th mc bng vic chn mc Chn tt c trong menu Hiu chnh, hay lc cc tp tin bng cch s dng mc Chn file trong menu Hiu chnh. S dng Chn file s xut hin hp thoi cho php nhp nhm tp tin mt cch kh rng ri. Trong trng hp ny, k hiu "*" l mt k t m t nhm, thay th cho mt chui k t bt k; k t "?" thay th mt k t bt k v c cp k t m t nhm "[" v "]". V d nh, nu ngi dng cn la chn tt c cc tp tin trong th mc hin thi m c tn tp tin bt u vi ch D, hoc ch F hoc ch T, c th g [DFT]*. Lu l tn tp tin trong Linux, cng nh cc h iu hnh thuc dng Unix khc, l c s phn bit ch hoa, ch thng.
Hnh 4.2 La chn "Vch ng"

4.4 Sao chp v di chuyn tp tin Hot ng ngm nh cho s ko v th tp tin gia trnh qun l tp tin v mn hnh th hin vic di chuyn tp tin. GNOME cn cho php s dng thao tc ko v th sao chp (copy) mt tp tin bng vic nhn phm CTRL trong khi ang ko tp tin . Cng c th ko mt tp tin t th mc trong ca s th mc v ko n ti th mc ch mong mun trong ca s cy th mc. Ch rng, khi vic ko ti ca s cy th mc, hnh ng mc nh s sao chp tp tin. Khi ko tp tin ti ca s cy th mc, s thy mt du cng xut hin nhc nh rng tp tin s c sao chp. S dng thao tc ko v th sao chp th mc ging nh sao chp tp tin. Cn ghi nh rng du cng biu hin rng th mc s c sao chp khng b di chuyn. Trnh qun l tp tin cho php nhn phm ALT cng vi thao tc ko tp tin n mt th mc (hoc kch chut gia trong khi ko tp tin) nhn mt menu trnh by cc la chn l Chuyn n y, Copy y, Lin kt y v Hu ko thc hin thao tc i vi tp tin.

Trang 23

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Hnh 4.3 Hi thoi di chuyn tp tin

Khi mc Chuyn n y c chn th mt hp thoi (hp thoi di chuyn) c hin ra (hnh 4.3) ngi dng g mt ng dn l ch cn di chuyn tp tin n. thc hin vic di chuyn kt hp vi vic i tn tp tin, hy nhp tn tp tin mi trong chui ng dn. Hp thoi Copy (hp thoi hin ra khi mc Copy y c chn) c hnh dng v cch thc lm vic ging nh hp thoi Di chuyn. Nu tp tin ang di chuyn l mt lin kt tng trng (symbolic link) ti mt tp tin thc s - trong mt vi h iu hnh lin kt o c gi l shortcut - th cn la chn Preserve symlinks trong mc Cc tu chn khc v iu m bo rng mi lin kt vn c bo ton d c s di chuyn ca tp tin . y l mt phng php tt v an ton di chuyn mt lin kt tng trng. 4.5 i tn tp tin Vic i tn tp tin trong ca s ca trnh qun l tp tin hoc trn mn hnh u c th c thc hin theo hai cch. Cch th nht l kch chut phi vo tp tin v chn nhng mc trong Cc thuc tnh t menu bt sau . Mc Tn tp cho php nhp tn mi cn i. Cch th hai l cch lm tt i tn tp tin, hy nhn p (tht chm) trn biu tng tn tp tin hoc trn mn hnh (nhy ln th nht cho tn tp tin sng ln sau nhy ln na). Khi , con tr chut s chuyn n mt dng son tho, v c th nhp tn mi theo ch son tho. Nhp tn mi xong nhn phm Enter kt thc vic nhp.

Hnh 4.4 Nhng thuc tnh tp tin

Trang 24

KC-06-03CN

Hng dn s dng Giao din ha GNOME

4.6. Chy ng dng t trnh qun l tp tin Trnh qun l tp tin cho php chy mt tp tin ng dng ngay ti ca s th mc bng vic nhn p chut trn nt tp tin . Khi , ng dng lin quan n tp tin s iu khin s hot ng ca tp tin: hoc trnh ng dng ca tp tin chy hoc trnh ng dng m tp tin l d liu c chy vi d liu c cung cp chnh l tp tin. Nu tp tin l th mc con, th th mc con c m v tr thnh th mc hin thi. Tuy nhin vi tp tin d liu, c th xy ra tnh hung l khng tm thy trnh ng dng tng ng vi tp tin do trc xa b hoc di chuyn i ni khc. Trong trng hp , trnh qun l tp tin cho php kch chut phi vo tp tin v chn mc M vi t menu bt ra. Hp thoi Open with c a ra vi mt danh sch cc trnh ng dng ngi dng xc nh Hnh 4.5 Hp thoi open with ng dng thch hp m tp tin. V d, nu mun son tho mt tp tin test.txt bng Emacs (mt trnh son tho vn bn ph dng), kch chut vo tp tin test.txt v chn mc Open with. Khi hp thoi Open with c m hy chn Emacs trong danh sch v nhn vo nt Ok, Emacs c thc hin v m tp tin test.txt. 4.7 Nhng thuc tnh tp tin v cc thao tc khc Vi bt k tp tin no, ch vic kch chut phi vo tp tin l c th chn nhng thuc tnh v nhng thao tc tc ng ln tp tin t menu bt ra theo cc la chn sau y (trong phn di y c gi l lnh): M - Lnh ny s m tp tin bng mt ng dng mc nh lin quan ti n. on Kiu iu b GNOME (GNOME Mime Types) trong chng B iu khin trung tm GNOME gii thiu chi tit hn v cch thc ny. M vi - Lnh ny m tp tin bng trnh ng dng do ngi dng chn. Cho php a tham s cho trnh ng dng trong hp hi thoi Open with nu cn phi c tham s. Xem - Lnh ny s m tp tin bng mt trnh duyt vn bn c bn.
Hnh 4.6 Nhng thuc tnh tp tin

Sa - Lnh ny s a ra mt trnh bin son tng thch vi kiu tp tin son tho tp tin.

Sao chp - Lnh ny s sao chp tp tin vo b nh m (clipboard) v sau c th dn (paste) vo mt ni khc. Xo - Lnh ny xo tp tin.
Trang 25

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Di chuyn - Khi chn lnh ny, hp thoi Di chuyn c m ra cho php ngi dng g v tr mun di chuyn tp tin n. Lin kt - Lin kt cho php to ra mt mi lin kt tng trng cho tp tin. Khi la chn Lin kt, mt hp thoi cho php nhp tn tp tin lin kt tng trng ti tp tin. Mi lin kt ny tng ng nh mt "shortcut" ti tp tin c chn. Cc thuc tnh - Khi Cc thuc tnh c chn, hp thoi Cc thuc tnh hin ra (xem hnh 4.6) cho php chnh sa hay xem nhng thuc tnh ca tp tin. Hp thoi bao gm ba la chn: Thng k, Cc chc nng v Cc quyn. Thng k - La chn ny hin ra v cho php thay i tn, kiu, kch thc v thuc tnh thi gian ca tp tin. Cc chc nng - La chn ny cho php hin ra thay i nhng ty chn hot ng cho tp tin. C th xc nh tp tin c m, nhn, v son tho nh th no. Nu cn m mt tp tin trong mt ca s terminal, c th chn mc Terminal cn chy. Nu m hp thoi Cc thuc tnh t biu tng ca tp tin trn mn hnh th s c th thay i biu tng cho tp tin trong nhn Cc chc nng. Cc quyn - La chn ny cho php thay i quyn truy nhp v quyn s hu mt tp tin nu ngi dng c quyn. Khi , c th cp quyn c, ghi, v thc hin cho ngi s hu, nhm s hu, v nhng ngi dng khc. 4.8 Thay i nhng ch dn ca trnh qun l tp tin

Hnh 4.7 Cc ch dn hin th tp tin

Trang 26

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Thit t cu hnh trnh qun l tp tin cho php nh sn cc quy tc lm vic ca trnh qun l tp tin v c rt nhiu cch thc thit t. Ngi dng c th thc hin cc cch thc ny theo cc bc nh sau: chn menu Thit lp v chn mc Cc la chn t menu ny. Khi kch chut tri vo mc ny, hp thoi Quyn u tin xut hin (hnh 4.7). Trong hp thoi Quyn u tin c 5 mc chnh: Hin th file, Xc nhn, H thng file o, Caching, Desktop v Chn hin th. 4.8.1 Ch dn hin th tp tin Mc Hin th file cho php thit t cch h thng hin th cc tp tin ti vng ca s th mc ca trnh qun l tp tin v mn hnh. Cc la chn chi tit sau y hin ra khi mc ny c chn: La chn Hin cc file sao lu - Quy nh h thng hin th c cc tp tin sao lu. La chn Hin cc file n - Quy nh h thng hin th tt c cc tp tin b che gm cc "tp tin du chm" (dot files, th mc hin ti v th mc cha) v nhng tp tin c bt u bi mt du chm. Cc tp tin cu hnh cng thng b che. Trn cc file th mc - Ty chn quy nh h thng hin th tp tin v th mc theo th t sp xp thay v theo th t ngm nh l th mc lun i trc tp tin. S dng cc mu shell thay v cc biu thc hp l Ngi dng c kinh nghim, qu quen thuc vi cch to ra cc biu thc s dng ty chn ny quy nh h thng h tr vic sp xp v chn lc.. Ngi dng cha c kinh nghim nn b qua ty chn ny.

Hnh 4.8. Ch dn v xc nhn

4.8.2. Ch dn s xc nhn Mc Xc nhn cho php ngi dng khng nh vic thay i nhng tnh nng c tin hnh trc khi tip tc cng vic. Khi chn mc ny, cc tu chn sau y hin ra (hnh 4.8): Xc nhn khi xo file - Tu chn ny quy nh h thng cn hin th mt thng bo trn mn hnh yu cu ngi dng xc nhn trc khi xa mt tp tin.
Trang 27

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Xc nhn khi ghi cc file - Tu chn ny quy nh h thng cn hin th mt thng bo trn mn hnh yu cu ngi dng xc nhn trc khi ghi mt tp tin. Xc nhn khi chy cc file - Quy nh h thng phi hin th mt thng bo trn mn hnh yu cu ngi dng s xc nhn trc khi chy mt tp tin. Hin th trng thi cc thao tc ang thc hn - Quy nh h thng hin th mt thanh cha cc thao tc nht nh thng xuyn c thc hin nh sao chp, di chuyn, xo tp tin ... 4.8.3. Ch dn h thng tp tin o Mc H thng file o cho php xc nh nhng ty chn cho h thng tp tin o (Virtual File System: vit tt v VFS). H thng tp tin o cho php thao tc vi nhng tp tin khng nm trn h thng tp tin cc b. C hai phin bn khc nhau ca VFS l ftpfs v tarfs. Phin bn ftpfs cho php lm vic trn cc site FTP, trong khi tarfs cho php truy nhp vo cc tp tin .tar (Tp tin .tar l khun dng lu tr UNIX chun). Khi mc ny c chn, cc ty chn say y hin ra (xem hnh 4.9):

Hnh 4.9. Ch dn VFS

Thi gian ch VFS - Quy nh khong thi gian (tnh theo giy) kt ni ti bt k mt VFS no m khng cn s kch hot. Mt khu FTP nc danh - Cho php xc nh mt mt khu ng nhp vo cc site FTP m khng mun cng b (s dng cho a ch email). Lun s dng FTP proxy - Cho php s dng mt dch v y nhim kt ni ti cc site FTP.
Hnh 4.10. Ch dn caching
Trang 28

KC-06-03CN

Hng dn s dng Giao din ha GNOME

4.8.4. Ch dn v caching Mc Caching cho php xc nh thuc tnh b m cache lm tng tc ca trnh qun l tp tin GMC. Cc tu chn sau y c hin ra (hnh 4.10): Np li nhanh cc th mc - Ty chn ny quy nh vic lu tr thng tin v th mc trong b m cache v th cho php ti nhanh hn. Lu l nu chn Np li nhanh cc th mc, c th s khng nhn thy nhng tp tin mi c thm vo th mc. Tnh ton tng trc khi copy file - Quy nh GMC cn xc nh s tp tin cn sao chp trc khi thc hin, v th GMC s a ra thng tin v qu trnh ang thc hin. Thi gian ch b m th mc FTP - Quy nh GMC cn lu thng tin ca cc site FTP c truy cp cha vt qu khong thi gian c chn y (tnh theo giy) vo b m. Cho php chn cc biu tng khi hin th - Quy nh v vic cho php ngi dng thay i biu tng ca tp tin trong ca s th mc bng cch kch chut phi vo tp tin (v chn ty chn Cc thuc tnh). Lun c th thay i biu tng ca cc mc trn mn hnh, nhng c th thay i nhng biu tng ca s ca th mc, phi bt ty chn ny. Lu : Nu bt tu chn ny th h thng lm vic chm hn. 4.8.5. Ch dn mn hnh (Desktop)

Hnh 4.11 Hp thoi ch dn mn hnh

Nh bit, mn hnh GNOME c trnh qun l tp tin kim sot. Mc Desktop cho php ch dn thay i cc thit t cho mn hnh. Khi chn mc ny, cc la chn sau y c hin ra (hnh 4.11): V tr biu tng - Ca s nh ny quy nh cc biu tng trn mn hnh c sp t ngm nh nh th no. thay i cch sp t cc biu tng,
Trang 29

KC-06-03CN

Hng dn s dng Giao din ha GNOME

ch vic kch chut ti vin ca s ni mun cc biu tng xut hin. S dng cc biu tng khng nn - Ty chn ny ngm nh c bt, quy nh cc biu tng c nhn din. Nu c mt vi l do no hoc c cc vn nh l mn hnh qu c, mt trnh ci t X server l, hay cc vn khc v ho, u c th dng ty chn ny lm cho cc biu tng ca chng trnh ng dng trn mn hnh d nhn hn. S dng ch khng nn - Ty chn ny ngm nh c bt, quy nh tn ng dng i km vi biu tng nhn din, tng t nh ty chn S dng cc biu tng khng nn. Auto icon placement - Quy nh vic t ng sp xp cc biu tng trn mn hnh. cho php ngi dng sp xp cc biu tng bng tay th phi tt ty chn ny. Snap icons to grid - Quy nh vic h thng cn trnh by cc biu tng theo hng li khi di chuyn chng lm gn mn hnh, v cho php to ra mt li cc biu tng t ng di chuyn ti thi im nh chut sau khi ko. 4.8.6. Ch dn cch thc hin th tu chn

Hnh 4.12 Hp thoi Chn hin th

Mc Chn hin th cho php thit t cch hin th ca cc tp tin trong trnh qun l tp tin. Khi chn mc ny, mt mn hnh vi hai ct chnh l Cho php cc ct v Hin th cc ct (hnh 4.12) c hin ra. Ct bn phi Hin th cc ct cha cc thuc tnh ca tp tin thc t c hin th (xem nt Chi
Trang 30

KC-06-03CN

Hng dn s dng Giao din ha GNOME

tit trong ca s th mc), cn ct bn tri Cho php cc ct cha tt c cc thuc tnh v tp tin c th c hin th. Ct Cho php cc ct gm tt c thuc tnh ca tp tin c th c hin th. Nu mun mt thuc tnh no thc t c hin th, hy chn n v nhn nt Thm, thuc tnh s c thm vo danh sch Hin th cc ct. Ct Hin th cc ct gm danh sch cc thuc tnh ca tp tin thc t c hin th. Nu mun xo b bt k mt thuc tnh no, hy nhn nt Xo. Cho php sp xp li nhng thuc tnh trong Hin th cc ct bng cch dng chut ko chng ti v tr mi. 4.9. S dng menu ca trnh qun l tp tin on ny m t ni dung cc mc menu ca trnh qun l tp tin v cch thc s dng chng. GNOME cho ngi dng cch thc lm ni mt menu bt k trn mn hnh bn trong mt ca s ring bit, hy chn hng nt t ti nh ca menu. 4.9.1. Mc menu File Menu File cha ng nhng mc lin quan n tp tin v cc hot ng mc cao hn. Menu ny cha cc la chn sau y: To ca s mi - La chn ny cho php m thm mt ca s ca trnh qun l tp tin. Mi - Khi mc ny c chn, mt danh mc vi cc mc con sau y c hin ra: Terminal - La chn ny cho php m mt ca s trm cui v t ng ly th mc hin thi l th mc hin th trn ca s chnh. Th mc - La chn ny to ra mt th mc con ca th mc c hin th trn ca s th mc. Mt hp thoi hin ra cho php nhp tn th mc mi. M - Mc ny m tp tin c chn. Sao chp - Khi chn la chn ny, mt hp thoi Copy xut hin nhp cc ni dung v ch sao chp tp tin. Xo - Xa tp tin c chn. Di chuyn - M hp thoi Chuyn cho php di chuyn/ i tn tp tin c chn ti ni theo quy nh. Cc hp thoi con tng ng c m ngi dng nhp ni cn di chuyn hoc tn mi i vi tp tin. Hin kch thc th mc - Mc chn ny hin th kch thc ca th mc theo kiu chi tit (Detail) hoc tu chn (Custom). Thi gian hin th ph thuc vo kch thc ca nhng th mc; c th mt mt thi gian th mi hin th c nhng th mc ln. ng ca s - ng ca s trnh qun l tp tin ny.
Trang 31

KC-06-03CN

Hng dn s dng Giao din ha GNOME

4.9.2. Mc menu Hiu chnh Mc menu Hiu chnh bao gm cc chc nng v son tho v la chn tp tin. Mc ny gm cc la chn sau: Chn tt c - Thc hin vic chn tt c cc tp tin trong ca s th mc. Chn file - M mt hp thoi n gin cho php xc nh mt mu m t nhm tp tin. V d, nu mun chn tt c cc tp tin bt u vi ch D hy nh D* v nhn nt Ok. La chn ngc li - o ngc s la chn cc tp tin hin ti. V d, nu ca s th mc c 10 tp tin trong c 7 tp tin c chn. Sau khi dng la chn ny th 3 tp tin cn li tr thnh c chn, cn 7 tp tin kia c tho g. Tm - La chn ny thc hin tm kim tp tin trong trnh qun l tp tin bng cch tm kim dn theo cc ch ci trong tn tp tin. Mi khi bt la chn ny, trn thanh trng thi y ca s s hin th t Tm kim: v cho php bt u nhp xu tm kim. V d, cn kim mt tp tin c tn "GNU " trong th mc c hin th ti ca s chnh hy nh ch "G", khi tp tin hoc th mc u tin bt u vi ch "G" s c nh v (song cha chn), g tip ch "GN" th tp tin hoc th mc bt u bng cm ch "GN" u tin s c nh v v c tip tc nh th. Cng c th thc hin tnh nng ny bng cch nhn CTRL-S. kt thc vic tm kim tp tin hay th mc th rt n gin hoc dng cc phm di chuyn hoc dng chut. Qut li th mc - La chn ny r sot li th mc hin thi trong trng hp nhng tp tin trong th mc c s thay i. 4.9.3. Mc menu Thit lp Mc ny cha mc con La chn c trnh by phn trc. 4.9.4. Mc menu B tr Mc ny lin quan n cch trnh by cc tp tin trong ca s ca trnh qun l tp tin v bao gm cc mc con sau y: Sp xp theo - Khi mc con ny c chn s hin ra mt hp thoi cho php la chn mt kha sp xp cc tp tin trong th mc hin thi t cc mc con sau: Tn: sp xp theo tn tp tin. Kiu file: sp xp theo kiu tp tin. C file: sp xp theo kch thc tp tin. Ln truy nhp cui: sp xp theo ln truy nhp cui cng. Ln sa i cui: sp xp theo ln sa cha cui cng. Thay i ln cui: sp xp theo ln thay i cui cng. Hin th b lc - Mc ny a ra mt hp thoi n gin cho php nhp tn tp tin mun hin th trong ca s th mc (cc tp tin khc th khng), y l
Trang 32

KC-06-03CN

Hng dn s dng Giao din ha GNOME

mt b lc trn mn hnh ha rt thun li chn tp tin, c bit trong ca s th mc c qu nhiu tp tin. V d, nu mun ch nhn thy nhng tp tin trong th mc m bt u vi ch D c th g D* vo trong hp thoi v n OK. Sau , nu mun nhn li tt c cc tp tin, cn m li hp thoi t b lc v g vo trong hp thoi k t *. Hin th Icon - Hin th cc tp tin trong ca s chnh di dng cc biu tng ln. Xem tm tt - Hin th cc tp tin trong ca s chnh nh mt danh sch sp xp theo tn tp tin. Chi tit - Hin th cc tp tin trong ca s chnh nh mt danh sch y mi thng tin ca mi tp tin. Hin th la chn - Hin th cc thng tin v tp tin trong ca s th mc theo cch ca ngi dng. Ni dung tng t v Chn hin th c trnh by phn trc. 4.9.5. Mc menu Cc lnh Mc menu Cc lnh cha nhng mc con sau y tng ng vi nhng thao tc i vi cc tp tin t trnh qun l tp tin: Tm file - Hp thoi tm kim tp tin c a ra cho php a thng tin v cc tp tin nhm tm kim chng trn h thng. Hiu chnh kiu mime - Mc chn ny c gii thiu trong ni dung v b iu khin trung tm GNOME, cho php a ra cc cch iu khin tp tin (Mime) trong GNOME. Kiu Mime xc nh trnh ng dng chu trch nhim x l i vi cc kiu tp tin. in hnh v kiu Mime l vi th mc th gi trnh qun l tp tin, vi tp tin ng dng th thc hin n, vi tp tin vn bn th gi trnh qun l vn bn... Chy lnh - Mc menu ny cho php chy mt lnh t GMC. Chy lnh trong Panel - Mc menu ny cho php chy nhng lnh c np trc hoc nhng lnh c ch r bn trong th mc hin thi. Nhng lnh nh vy c th tm thy trong cc chng trnh SUID hoc SGID. Thot - Ra khi trnh qun l tp tin GNOME. Lnh ny dng tt c cc tin trnh trong trnh qun l tp tin bao gm c ca s ng dng trong mn hnh GNOME. Nu thot ra bng chc nng ny, tt c cc tnh nng hot ng trn mn hnh s b mt. Nn ng ca s hin thi bng cch s dng mc ng ca s trong mc menu Tp.

Trang 33

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Chng 5. B cc tiu dng trong GNOME

5.1 Li gii thiu GNOME c sn mt b cc tiu dng v cho php ngi dng thm cc tiu dng nh vy vo Thanh-GNOME khi thy cn thit. Chng ny m t hu ht cc tiu dng trong b cc tiu dng ni trn. truy nhp c b cc tiu dng ny, hy chn Thm ng dng t menu thanh. Mt menu hin ra (gi l menu Thm ng dng) vi cc mc con c m t nh di y. 5.2 Nhm tiu dng gii tr (Amusement applets) Nhng tiu dng gii tr c thit k gip cho ngi dng rt nhiu cc tr gii tr lm cho vic s dng my tnh tr nn a dng v phong ph hn. Chn mc Amusements trong menu Thm ng dng nhn c mt danh sch cc tiu dng gii tr. 5.3. Nhm tiu dng kim sot (Monitor Applets) Chng trnh kim sot c thit k dng trong vic theo di h thng v nhng chc nng ca h thng. C th theo di nhng ti nguyn trong my cng nh theo di cc cng vic ang c tin hnh. s dng b cc tiu dng ny hy chn mc con Monitors trong menu Thm ng dng. Khi mc con ny c chn, mt s tiu dng sau y c hin ra ngi dng chn la. 5.3.1 Theo di tnh trng pin (Battery Monitor) Tiu dng theo di tnh trng ca pin (chn mc con Battery Monitor trong danh sch tiu dng ni trn) l mt tiu dng n gin, cho php nhn thy s thi gian cn hot ng c ca laptop (my tnh xch tay) vi ngun pin hin thi. 5.3.2 Theo di hot ng xc pin (Battery Charge Monitor) Tiu dng theo di tnh trng xc pin (chn mc con Battery Charge Monitor) hin th s phn trm hoc s in tch cn li trong pin ca laptop, v thi gian m laptop c th chy vi dung lng in . N cn cho bit laptop c ang c xc pin hay khng. Nu kch chut tri vo tiu dng , s hin ra mt th m trc ng l lng in xc v trc ngang l thi gian xc. V th nu laptop ang c xc pin th th s theo hng tng v nu ang chy bng pin th th s gim xung. Kch chut phi vo tiu dng s hin ra mt menu pop-up c th thay i cc thuc tnh ca n nh mu sc ... 5.3.3 Theo di tnh trng hot ng ca CPU/MEM Tiu dng theo di tnh trng hot ng ca khu vc trung tm (chn mc con CPU/MEM usage Monitor) l mt tiu dng cho bit trng thi hin Hnh 5.1 Tiu dng CPU/MEM thi ca CPU, b nh (Memory) v khng gian tro i (Swap Space). Tiu dng gm c ba thanh vi nhng mu khc nhau biu din cho mi trng thi s dng. Nu ang chy tiu dng trn Thanh-GNOME nm ngang th thanh trn cng l CPU, thanh gia l
Trang 34

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Memory, v thanh y l Swap Space (hnh 5.1). Nu ang chy tiu dng trn Thanh-GNOME thng ng th CPU l thanh bn tri, Memory l thanh gia, v Swap Space l thanh bn phi. Thanh trng thi ca CPU s dng ba mu chnh: Mu vng ch ngi dng hin thi. Mu xm ch h thng s dng ch khng phi ngi dng. Mu en cho bit CPU khng c s dng. Thanh trng thi b nh vt l hin thi bng mt trong s bn mu: Mu vng cho thy b nh ang c dng chung. Xm-vng cho thy b nh c s dng bi ng dng khc. Xm cho thy b nh c s dng di dng b m. Mu xanh lc cho thy b nh ang ri trn h thng. Thanh hin th tnh trng b nh tro i Swap cho bit tnh trng s dng phn vng Swap: Mu vng l phn ang c s dng. Mu xanh lc l phn cn ri. 5.3.4 Theo di tnh trng s dng CPU Tiu dng theo di tnh trng s dng CPU (chn mc CPULoad) l mt th n gin ch ra tnh trng s dng CPU hin thi, c ba mu c dng Hnh 5.2. Tiu dng CPULoad hin th: Mu vng ch ngi dng hin thi. Mu xm ch cng s dng ca cc thao tc do h thng s dng khng thuc v ngi dng. Mu en cho bit CPU khng c s dng. 5.3.5 Theo di tnh trng s dng MEM Tiu dng s dng b nh (chn mc con MEMLoad) cho mt th n gin ch ra trng thi s dng b nh hin thi thng qua bn mu: Mu vng cho bit v phn b nh ang c dng chung. Mu xm-vng cho bit v phn b Hnh 5.3. Tiu dng s dng b nh nh ang c dng cho ng dng khc. Mu xm cho bit v phn b nh c s dng di dng b m. Mu xanh lc cho bit v phn b nh vt l ri. 5.3.6. Theo di tnh trng s dng SWAP Tiu dng theo di trnh trng s dng b Hnh 5.4. Tiu dng v (chn mc SwapLoad) cho mt th n s dng b nh SWAP tnh trng s dng phn vng SWAP hin hai mu: Mu vng cho bit v phn SWAP ang c s dng, cc c mu xanh lc. 5.4. Nhm tiu dng a phng tin (Multimedia Applets) Cc tiu dng a phng tin (chn mc con Multimedia trong menu Thm ng
Trang 35

nh tro i gin ch ra thi thng qua phn cn ri th

KC-06-03CN

Hng dn s dng Giao din ha GNOME

dng) l mt tp hp cc tiu dng cho php dng a phng tin trn h thng. Ngi dng s tm thy cc tiu dng iu khin m thanh, video v a phng tin khc. Khi mc con ni trn c chn, mt danh sch con gm cc tiu dng sau y c hin th. 5.4.1 Tiu dng nghe a CD v b nghe a GNOME CD Tiu dng nghe a CD (chn mc CD Player) l mt b nghe a CD n gin c trn Thanh-GNOME. Khi c mt a CD m thanh trong CDROM, c th s dng cc nt Play/Pause, Stop, Forward, Backward v Eject iu khin a CD. Trn cc nt iu khin l mt vng nh hin th thi gian cn li trn rnh (track) v gia Hnh 5.5 Tiu dng CD Player hai nt Forward v Backward l s hiu ca rnh ang c kch hot. Lu : Ngi dng phi c quyn truy nhp CDROM th tiu dng ny mi thc hin thnh cng. Trong mt vi h thng, ngi dng c cp quyn truy nhp mt cch t ng khi ng nhp t thit b u cui. C ch ny c gi l pam_console. Nu h thng khng cp quyn truy nhp ti CDROM, cn thc hin cc bc sau y c cp quyn: Chuyn sang ngi dng root: $ su root Nhp mt khu ca root: $ Password: [root password] Thay i quyn truy nhp: $ chmod a+r /dev/cdrom Thot: $ exit Nu CDROM (trnh iu khin CDROM) khng c trong th mc /dev/cdrom, cn phi thay i ng dn trong cu lnh trn. Nu mun s dng nhiu tnh nng iu khin CD hn, hy kch chut phi trn tiu dng CD Player v chn mc Run gtcd t menu bt. B nghe a GNOME CD s chy. Khi tiu dng CD Player ang chy, khng cho php ngi dng iu khin vt l nt Eject trn CDROM tho a CD. Nu mun tho a CD ra, ngi dng phi s dng nt Eject trn tiu dng CD Player. Phn sau y trnh by chi tit hn v b nghe a GNOME CD c tn l gtcd, mt trnh ng dng cao cp hn tiu dng nghe a CD. a. Gii thiu v b nghe a GNOME CD B nghe a CD trong GNOME (GNOME CD Player - gtcd) l mt ng dng
Trang 36

KC-06-03CN

Hng dn s dng Giao din ha GNOME

ca GNOME c np ngm nh cng GNOME. y l mt b nghe a CD gip ngi dng nghe CD trn my tnh. b. S dng b nghe a GNOME CD B nghe a GNOME CD (xem hnh 5.6) c gi ra thc hin bng nhiu cch: Chn t mc Chy CD danh sch mc a phng tin ca menu chnh... B nghe a GNOME CD hot ng nh bt k mt b nghe a CD no khc vi cc nt iu khin nh: Chi/Tm dng ( ), Dng ( ), M khay a ( Hnh 5.6 B nghe a GNOME CD ), Tua ngc (1 bi) ( ), Tua i mt bi ( ), v nt dng ( ). Ba nt dng di cng theo th t t tri sang phi tng ng vi cc chc nng Son danh sch bi ht, Tu chn, Thot. tin theo di chng ta gi tn cc nt theo chc nng ca chng. Trn dng di cng, nt Quit c tc ng duy nht l ra khi b nghe a GNOME CD v chng ta ch vo hai nt chc nng cn li. Chc nng Tu chn Cho php thay i rt nhiu cc thuc tnh khc nhau bng cch nhn nt Tu chn, m thc cht y l chc nng chn la ch yu ca gtcd. Hp thoi c tiu gtcd xut hin vi ba mc: Tu chn, T hp phm v Thit lp CDDB (xem hnh 5.7). Khi chn mt trong ba mc , cc la chn tng ng xut hin ngi dng thc hin. Mc Tu chn - Trong hp thoi ny c th xc nh c:
Hnh 5.7 Hp thoi GNOME CD Player

Nhng vic b nghe a GNOME CD lm khi bt u (cc nt tng ng vi mc con Khi khi ng) v khi kt thc (cc nt tng ng vi mc con Khi thot) . V tr ca CDROM trn h thng t trong mc con Thit b CDROM, thng thng l th mc /dev/cdrom (v cho php ngi dng thay i). Chn mu hin th ca tn rnh v ta ca a CD (Mu Bi/Tiu ). Chn phng ch biu din tn rnh v ta ca a CD (Font Bi/Tiu ). Cho php ko ca s tiu ra khi b nghe a CD Player v lm ca s ni trn mn hnh, nu thch iu khin trn mt ca s tiu (Hin handles (cn khi ng li)).
Trang 37

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Thit t vic hin hoc khng hin cc dng ch gii khi di chut qua cc nt iu khin (Hin gi nhanh). Mc T hp phm - Trong nhn ny cho php thit t li cc phm tt lin quan n b nghe a GNOME CD. T hp phm cho php s dng b nghe a CD m khng cn s dng chut. Nu mun thay i mt trong nhng phm tt, hy chn chc nng v nhp kha mi trong hp Kck vo y thay i, nhn nt Kch hot ghi nhn nhng thay i . Mc Thit lp CDDB - CDDB (CD Database) l mt c s d liu chung lu gi thng tin v CD. Mi CD u c mt nh danh v c nhn bit bi b nghe a CD. Khi ngi dng chn mc CDDB th menu thit t cho CDDB c hin ra vi nhiu mc con lin quan n vic thit t my ch (Thit lp my ch), c s d liu cc b (CSDL ni b)... Nu kt ni ti Internet, cho php tm trn CDDB v tr li bt k thng tin no tm thy v nh danh ca CD m ngi dng cn bit (thng thng l ta ca CD, tc gi v tn cc rnh, cng c th c thm nhng thng tin ghi ch). Mi khi c c cc thng tin ny, b nghe a GNOME CD s lu gi chng trn cng dng cho ln truy nhp sau. Trong nhn CDDB Setting, c th thay i Thit lp CDDB v son tho CDDB cho c nhn ngi dng.

Hnh 5.8 Tiu dng bin tp rnh

Chc nng son danh sch bi ht Mt c tnh khc c b nghe a GNOME CD cung cp l b bin son rnh khi chn mc Son danh sch bi ht. Khi nhn nt Son danh sch bi ht trn ca s b nghe a GNOME CD, mn hnh b bin son rnh xut hin v cho php son tho thng tin rnh trong trng hp cc thng tin ny b sai hoc a CD hin ti khng c trong CDDB. B bin son rnh cng cho php ngi dng kim tra trng thi ca thng tin CDDB nh vic nhn nt Trng thi CDDB y ca b bin son rnh. Nu tn ti thng bo v trng thi thng tin t CDDB ch th mi thng bo nh vy u s c hin ra. 5.4.2 B trn m (Mixer) Tiu dng trn m (chn mc Mixer) l mt tiu dng n gin cho php iu khin m lng trn h thng. Tiu dng ny hot ng nu thit b trn m (mixer) c thit t v tn ti tp tin /device/mixer. C hai Hnh 5.9 Tiu dng trn m nt iu khin chnh trn tiu dng l Volume Slidebar v Mute. tng hoc gim m lng, hy s dng chut iu khin
Trang 38

KC-06-03CN

Hng dn s dng Giao din ha GNOME

thanh trt tng ng vi nt Volume Slidebar. tt m thanh trn h thng, hy nhn nt tt (mute) nh y tiu dng. Nu mun iu khin nhiu hn m lng h thng, kch chut phi vo tiu dng trn m Mixer v chn mc Run gmix t menu bt ca tiu dng ny. 5.5. Nhm tiu dng v mng Nhm cc tiu dng mng (chn mc Network trong menu Thm ng dng) cho php qun l (theo di, tng cng) vic thc hin cc cng vic trn mng hoc trn Internet. Vic qun l ca tiu dng mng rt ton din t vic kim tra th tn cho n vic theo di thi gian s dng Internet. Khi mc Network c chn, th mt danh sch cc mc con tng ng vi cc tiu dng mng sau y c hin ra ngi dng chn s dng. 5.5.1. Tiu dng kim sot th tn (Mailcheck) Tiu dng kim sot th tn (mc con Mailcheck) l mt tiu dng kim tra th t trn h thng v thng bo cho ngi dng bit nu c th mi. Tiu dng ny ch kim tra h thng th t ca ring ngi dng m khng thc hin vic kim tra i vi cc my ch khc v th t. truy nhp vo nhng thuc tnh i vi tiu dng kim sot th tn, hy kch phi chut vo tiu dng v chn mc Cc thuc tnh t menu bt. Hp thoi Cc thuc tnh kim tra th xut hin. Nu mun mt chng trnh c thc hin trc mi ln cp nht, hy g mt lnh vo trong mc Chy. iu ny c th c ch nu mun chy fetchmail (trnh tm np th t) nhn th ca t my ch khc. Cho php ngi dng xc nh mc thng xuyn i vi vic kim tra th t (Check for mail every), pht tn hiu m thanh khi c th v (Play a sound when new mail arrives) v la chn biu tng i vi tiu dng (animation). 5.5.2 Tiu dng iu khin Web (WebControl) Khi chn mc WebControl, tiu dng iu khin Web c thc hin cho php ngi dng a mt a ch URL vo hp thoi URL cung cp cho trnh duyt Web (thng thng l Netscape). Theo a ch URL c cung cp, trnh duyt Web t ng thc hin vic duyt Web. GNOME cho php ngi dng thay th ca s ang s dng bi mt ca s khc nh kch vo hp chn a ra ca s mi. xo a ch URL, hy nhn nt Qut. truy cp vo nhng thuc tnh, kch chut phi vo tiu dng iu khin Web v chn mc Cc thuc tnh t menu bt t tiu dng. Hp thoi Cc thuc tnh ca Web Control xut hin v cho php ngi dng chn la cch Hin th nhn URL v a ra cc tu chn ca s mi trn tiu dng. 5.5.3 Tiu dng n modem (Modem Lights) Tiu dng n modem c chy khi kch vo mc Modem Lights trong menu con Network. y l mt tiu dng rt tin li, thc hin vic khi ng khi kt ni v qun l vic kt ni qua modem ca ngi dng. Tiu dng c tn gi nh vy bi l do c hai n sng nh theo di hot ng trn modem. thit lp n modem, phi c mt kt ni mng ang lm vic trn h thng. kt
Trang 39

KC-06-03CN

Hng dn s dng Giao din ha GNOME

ni mng, cn kch chut phi trn tiu dng v chn menu Cc thuc tnh t menu bt ca tiu dng ny. Hp thoi Modem Lights Setting xut hin vi hai nhn bn trong l: General v Advanced. Khi nhn General c chn, hy nhp nhng script (chng trnh shell) c dng khi ng kt ni vo hp Connect command v nhng script c dng ngt kt ni vo hp Disconnect command. Nhn nt Kch hot v sau nhn nt n nh ti vin ca tiu dng th nhng script ny s chy. Nhn con Display lin quan n vic hin th cc thng tin kt ni. Mi khi c mt kt ni, cc n modem nh s nhy v thng tin trn Internet m ti xung c hin th trong hp en nh chnh gia tiu dng. Nhn Advanced lin quan n cc la chn cho modem v vic s dng ISDN hay khng. 5.6 Nhm tiu dng tin ch (Utility Applets) Nhm tiu dng tin ch (menu Utility) l mt tp hp cc tin ch chung c s dng trong mi trng lm vic GNOME ca ngi dng. 5.6.1 Tiu dng ng h (Clock applet) Tiu dng ng h (mc con Clock) l mt tiu dng c ti mc nh khi ci t GNOME ln u tin. truy nhp thuc tnh ng h, kch chut phi trn ng h v chn mc menu Cc thuc tnh t menu bt ca tiu dng. Hp thoi Clock Properties xut hin cho php ngi dng xc nh ch hin th l 12 gi hay 24 gi. 5.6.2 Tiu dng my in (Printer Applet)

Hnh 5.10 Nhng thuc tnh ca tiu dng my in

Tiu dng my in (mc con Printer Applet) l mt tiu dng c biu din bi mt biu tng c hnh chic my in nh vi t Print trn Thanh-GNOME. Nu ko mt tp tin ti tiu dng my in th tiu dng ny s in tp tin . thit lp thuc tnh cho tiu dng, cn kch chut phi vo tiu dng v chn mc menu Cc thuc tnh t menu bt ra v hp thoi Cc thuc tnh xut hin (hnh 5.10), cho php ngi dng xc nh tn my in v lnh in (Print Command) trong hp thoi ny. Vi a s cc h thng, lnh in s l lpr.

Trang 40

KC-06-03CN

Hng dn s dng Giao din ha GNOME

5.6.3 Tiu dng kt ni thit b (Drive Mount) Trn cc h thng thuc dng Unix, sau khi lp mt thit b lu tr vo my, phi thng bo cho my tnh bit vic lp t chng c php s dng. Thao tc ny thng c gi l kt ni (mount) a. Tiu dng kt ni thit b (mc con Drive Mount) l mt tiu dng gip ngi dng hoc siu ngi dng c th lp t cc thit b bng cch kch vo biu tng trn Thanh-GNOME. lm c vic trn, cn phi thit lp thit b mun truy nhp m ngi s dng c th thit t. Nu tp tin linuxconf c ci trn my th siu ngi dng d dng thit lp c thit b cho php ngi dng c quyn truy nhp. u tin, la chn thit b mun truy nhp trong Truy nhp cc thit b cc b. Trong nhn Tu chn, hy chn tu chn Ngi dng c th kt gn. T lc tr i, thit b c th c kt gn vi tt c ngi dng. Trong trng hp khng c linuxconf, siu ngi dng cn phi son tho li th mc /etc/fstab cung cp quyn truy nhp thit b cho ngi dng. iu ny c thc hin bi vic thm truy nhp ngi dng ti c t ca thit b (drive specification). V d, tp tin fstab c ni dung nh sau:
/dev/cdrom /mnt/cdrom iso9660 exec,dev,ro,noauto 0 0

Thm ngi dng mi c tn lan vo ct th t:


/dev/cdrom /mnt/cdrom iso9660 lan,exec,dev,ro,noauto 0 0

By gi c th lp t cc thit b m khng cn phi c quyn ca siu ngi dng.

Hnh 5.11 Tiu dng kt ni thit b Vi cc iu kin trn, ngi dng c th chy tiu dng kt ni thit b ln ThanhGNOME bng cch chn mc Drive Mount t menu con Utilities trong menu Thm cc ng dng. Lc , hnh nh ca thit b trn Thanh-GNOME trn g nh mt a mm (xem hnh 5.11). Tiu dng kt ni thit b lun c ngm nh cho php truy nhp a mm. C th thay i iu ngm nh ny bng cch kch chut phi vo tiu dng v chn mc Cc thuc tnh t menu bt ca tiu dng. Hp thoi Thit lp mount a xut hin cho php xc nh cc thit b mun lp t v v tr lp t ca n. Ty chn u tin cho php xc nh khong thi gian (tnh theo giy) gia cc ln cp nht tiu dng. Trong sut qu trnh cp nht, tiu dng s kim tra trng thi ca thit b nhn bit nu thit b c lp t v hin th tiu dng tng ng. Ty chn th hai cho php xc nh cc biu tng s c hin th. C bn loi biu tng: a mm, CDROM, a nn, v cng. Sau khi la chn xong biu tng, phi
Trang 41

KC-06-03CN

Hng dn s dng Giao din ha GNOME

xc nh ng v tr lp t cho thit b trong hp V tr mount. Ty chn cui cng xc lp trong hp Thit lp mount a l S dng kim tra tnh trng t ng mount. Nu h thng ang s dng c cc tin ch autofs gip cho vic lp t t ng cc thit b, tiu dng kt ni thit b c th gy nhiu i vi autofs v trong trng hp nh vy, cn phi c ty chn ny. Nu h thng khng s dng autofs (trng hp ph bin) th ng la chn ty chn ny v iu s lm cho h thng qu ti v hot ng chm hn nhiu.

Hnh 5.12. Thit t kt ni thit b

5.6.4. Vt-GNOME Vt-GNOME c gii thiu trong chng 1, l mt tiu dng cho php thy tt c mn hnh o v nhng ng dng trong mn hnh hot ng. Nu mt ca s "bin mt" khi mn hnh khi thu nh chng thnh cc biu tng, hy thm mt Vt-GNOME trn Thanh-GNOME.

Hnh 5.13 Hp thoi thit t thuc tnh Vt-GNOME

Trang 42

KC-06-03CN

Hng dn s dng Giao din ha GNOME

GNOME cho php ngi dng la chn cch thc hin th Vt-GNOME trn ThanhGNOME bng cch s dng hp thoi GNOME Pager Settings (hnh 5.13). nhn c hp thoi ny, trc ht kch chut phi vo Vt-GNOME v chn mc menu Cc thuc tnh trong menu bt ra t tiu dng ny. Hp thoi Thit lp GNOME Pager cha nhn Pager v nhn Danh sch tc v. Nhn Pager cho php thay i cc thit t cho phn vng mn hnh (Pager) v nhn Danh sch tc v cho php thay i cc thit t cho danh sch cc ng dng ang chy trn mn hnh hot ng (Tasklist). Nhn Pager - gm cc la chn sau y: Hin Pager - Cho php hin th phn mn hnh (Pager) hoc khng. Nu khng hin th phn mn hnh, cn phi s dng hin th phn cc tin trnh (Tasklist). V tr cc trang sau danh sch tc v - Cho php i v tr phn mn hnh vi danh sch cc tin trnh t tri sang phi hoc t nh xung y ph thuc vo v tr Thanh-GNOME. rng ca cc trang nh - Cho php xc nh rng ca cc mn hnh nh (nu c). Chiu cao ca cc trang nh - Cho php xc nh chiu di ca cc mn hnh nh (nu c). rng ca cc trang ln - Cho php th xc nh rng ca cc mn hnh ln (nu c). Chiu cao ca cc trang ln - Cho php xc nh chiu di ca cc mn hnh ln (nu c). Nhn Danh sch tc v - gm cc la chn sau y: Hin nt danh sch tc v - La chn ny cho php hin th mt nt nh c hnh mi tn hng ln trong Vt-GNOME, khi kch chut vo nt th mt danh sch cc tin trnh trn tt c cc mn hnh s c a ra. Hin danh sch tc v - La chn ny cho php hin th danh sch cc tin trnh hoc s dng ch mt phn mn hnh. Hin cc biu tng ca nt - La chn ny cho php a ra biu tng trn cc nt danh sch cc tin trnh. Tc v no hin - Cho php xc nh nhng ng dng no s c m v m vo lc no trong danh sch cc tin trnh. Ngi dng c th chn c tt c cc loi tin trnh nh: cc tin trnh thng thng, cc tin trnh ti gin, tt c tin trnh trn mi mn hnh, hay tt c cc tin trnh ti gin trn mi mn hnh. Hnh hc - La chn ny cho php thay i hnh dng ca phn danh sch cc tin trnh. C th c danh sch cc tin trnh lun c hin th vi kch thc ti thiu hoc thay i rng ca danh sch cc tin trnh theo chiu thng ng hoc nm ngang.
Trang 43

KC-06-03CN

Hng dn s dng Giao din ha GNOME

5.6.5 Tiu dng a ra nhanh cc ng dng (Quicklaunch) Tiu dng a ra nhanh cc ng dng (mc Quicklaunch), chng ta gi l tiu dng Quicklaunch, l mt tiu dng nh to mt vng ngi dng t cc nt bt (i lc c gi l nt bt nhanh) gi li cc ng dng m ngi dng thng xuyn cn n. Khi cn thit, ngi dng ch vic kch vo nt tng ng chy ng dng. Tnh nng ko-th thit lp trn tiu dng Quicklaunch l rt d dng v nhanh chng. thm mt nt bt vo Quicklaunch, th nt bt phi c hoc trn menu chnh, hoc trn Thanh-GNOME, hoc trn mn hnh. Mi khi c nt bt, GNOME cho php ngi dng ko-th nt bt ln Quicklaunch. Chy ng dng trn Quicklaunch l cng vic rt n gin v ngi dng ch cn kch vo nt bt.

Hnh 5.14. Tiu dng Quicklauncht

ko mt nt bt t menu chnh, ngi dng cn vo menu chnh v di chut ti ng dng mun c, nhn chut tri (nhng khng th) v ko ng dng ti Quicklaunch v th. ko mt nt bt t Thanh-GNOME hoc t mn hnh vo Quicklaunch th u tin cn di chuyn chut ti nt bt , sau nhn v gi nt chut tri ko nt ti Quicklaunch ri th. Mt cch thng thng hn b sung nt bt vo Quicklaunch c m t nh sau. Ngi dng cn kch chut phi vo tiu dng, la chn mc Properties thay i bt k nhng thuc tnh no lin quan n nt bt trong tiu dng ny. Mt hp thoi xut hin phc v cho vic b sung ng dng.

Trang 44

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Chng 6. B lp Lch GNOME

6.1 Li gii thiu B lp lch GNOME l mt ng dng lp lch tuy n gin song rt c ch i vi cng vic hng ngy. Ngi dng chn mc Lch trong menu con Cc ng dng/Cc tin ch ca menu chnh lm vic vi b lp lch GNOME. Khi b lp lch GNOME thc hin, mn hnh (ca s ng dng) ca b lp lch GNOME xut hin (hnh 6.1). Trong mn hnh b lp lch, nu khng k thanh vin, t trn xung di l dng nhm chc nng, thanh cng c, bn la chn cch hin th v di cng l bng hin th tng ng theo cch hin th chn. C bn bng lch tng ng vi bn cch hin th theo Ngy, Tun, Thng, v Nm. Mi cch hin th khng nhng cho php nhn thi gian tng ng m cn cho php t trc v xem li cc cuc hn trong bt k bng no. Ngi dng kch vo mt trong cc nt Xem theo ngy, Xem theo tun, Xem theo thng v Xem theo nm chn cch hin th mong mun: Bng hin th tng ng c hin ra ngi dng s dng. Cc nhm chc nng hoc thanh cng c c tc dng h tr ngi dng s dng b lp lch GNOME mt cch hiu qu.

Hnh 6.1 Lch GNOME

6.2. S dng lch GNOME S dng lch GNOME kh n gin v a s cc nhim v c th c thc hin t bt k cch hin th no: Ngy, Tun, Thng hoc Nm. Mt trong nhng c tnh quan trng nht l bt k thi gian no, ngi dng cng c th kch chut phi vo mt ngy c th v thm mt cuc hn mi. C nhiu c tnh khc s c m t chi tit khi gii thiu v mi cch hin th. 6.2.1 Xem theo ngy (Day view) Khi chn mc Xem theo ngy, bng ngy xut hin. Bng ngy c xem l cch hin th hu ch nht trong lch GNOME trong khi bng ny hot ng ch nh mt thit b bm gi.
Trang 45

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Bn tri ca bng ngy l danh sch gi cho ngy hin ti. Mu xm nht lit k nhng gi khng lm vic. Cho php thay i mu ca nhng gi c d tnh cng vic thng qua mc con Mu trong hp thoi Tu chn (mc 6.4).. Lu : Cho php ngi dng s dng mt mo nh thm mt cuc hn mi vo Xem theo ngy l kch v ko chut trong danh sch lit k gi "trn" mt vi gi. Sau nhn Enter v g cuc hn vo hp trn . Cch ny cho php ngi dng b qua hp thoi To cuc hn mi. Bn phi ca bng ngy l mt lch nh hin th y cc ngy trong Hnh 6.2 Xem theo ngy thng. Cho php ngi dng s dng cc nt tin v nt li trn thanh menu pha trn thay i thng hoc nm ca lch nh v thng. Vic nhn p chut vo bt k ngy no trong lch thng nh s thay i khung cnh ngy hin thi ti ngy c th c chn . bn di lch thng nh l danh sch Danh sch vic cn lm. Danh sch vic cn lm l mt danh sch n gin cho php lu gi tt c cc cng vic c lp lch. thm mt mc vo danh sch Danh sch vic cn lm, ngi dng nhn nt Thm. Mt hp son tho s c hin ra cho php nhp tn cc cng vic. Mi ln kch vo mt mc bn trong Danh sch vic cn lm, dng Sa v Xo qun tr mc c kch. 6.3.2 Xem theo tun (Week View) Khi chn mc Xem theo tun, bng tun xut hin. Bng tun gm by ngy trong tun hin thi vi m t chi tit cc cng vic trong tng ngy. Cho php ngi dng thm mt cuc hn vo mt ngy bt k trong tun bng cch kch chut phi vo ngy v xut hin nt menu bt To cuc hn mi. Khi kch chut tri vo nt menu ny th menu To cuc hn mi hin ra ngi dng nhp thng tin v cuc hn mi ny. Cng c th s dng hin th tun chn ngy hin thi c th. Khi kch p vo bt k ngy no trong tun th b lp lch chn ngy l ngy hin thi trong bng Xem theo ngy.

Trang 46

KC-06-03CN

Hng dn s dng Giao din ha GNOME

gc tri pha di ca Xem theo tun c mt lcch thng nh. Cho php ngi dng dng nt tin hoc li trn thanh menu ny thay i thng hoc nm ca lch thng nh, hay s dng lch thng nh dnh chuyn n nhng ngy c th. Vic kch p vo bt k ngy no trong thng s thay i tun hin thi ti tun cha ngy c chn.

Hnh 6 3 Xem theo tun

Hnh 6 4 Xem theo thng

6.2.3 Xem theo thng (Month View) Khi chn mc Xem theo thng chn cch thc hin th thng bng thng xut hin (hnh 6.4). Bng thng a ra ton b cc ngy trong thng vi nhng m t ngn gn v cc cng vic trong tng ngy thuc thng vi mu hin th c khc bit. Thay i mu hin th thng thng qua mc con Mu trong hp thoi Tu chn (mc 6.4). Cho php ngi dng b sung mt m t ngn gn v mt cuc hn vo mt ngy trong hin th thng khi kch chut phi vo ngy v chn mc Cuc hn mi trong ngy t menu bt ra: Mn hnh To cuc hn mi hin ra ngi dng a thng tin v cuc hn trong ngy c chn. Trong menu bt ni trn cn c ba mc "Nhy ti..." cho php ngi dng chuyn bng lch. 6.3.4 Xem theo nm (Year View)
Hnh 6.5 Xem theo nm
Trang 47

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Khi chn mc Xem theo nm, bng nm xut hin (xem hnh 6.5). Bng nm hin th ton b cc ngy trong nm m khng c m t d nh cng vic no c hin th. Ging nh bng thng, bng nm cng cho php thit lp cc mu nh trong bng thng thng qua mc con Mu trong hp thoi Tu chn (mc 6.4). xem chi tit cc cuc hn trong mt ngy no , hy kch chut phi vo ngy , chn mc Nhy ti ngy ny. b sung mt d nh mi vo mt ngy trong bng nm, ngi dng kch chut phi vo bt k ngy no trong bng nm v chn mc To cuc hn mi trong ngy t menu bt ra. 6.3. Ghi nh thi im ca mt d nh C nhiu phng php to mt d nh mi trong b lp lch GNOME, nhng cch d nht l nhn nt To mi trn thanh cng c. Hp thoi To cuc hn mi cho php thit t nhng thuc tnh ca mt gp d nh. Hp thoi ny c hai nhn la chn l Chung v Lp li. Nhn Chung - La chn Chung c dng xc nh r thi gian cho d nh cng nh thit lp thi gian gi nh (reminder) ca c nhn. Khi chn nhn Chung xut hin 4 vng khc nhau l Tm lc, Thi gian, Bo thc v Phn loi. + Vng Tm lc - Hp Tm lc cho php nhp cc m t v d nh v cc m t ny s c hin th trong bng tun v bng thng. + Vng Thi gian - Vng ny cho php xc nh khong thi gian (ngy v gi) bt u v kt thc ca mt d nh. xc nh ngy bt u v kt thc, c th chn nt Lch mt lch nh s hin ra cho chn ngy. Bn cnh l mt nt nh, khi c nhn s hin th gi trong ngy cho chn gi bt u v kt thc ca mt d nh. V ng vi mi gi trong danh sch li c mt menu nh cho php chn n mt phn t gi (v d nh 09:15, 09:30). + Vng Bo thc - Vng Bo thc cho php thit lp mt thng bo nhc nh v mt d nh. C bn nt cho php t bn kiu bo hiu khc nhau l: Hin th, m thanh, Chng trnh v Gi th. Bo hiu c thc hin ng vo thi im c thit t. Hin th: hin th mt thng bo ln mn hnh. m thanh: chi mt tp tin m thanh. Chng trnh: chy mt chng trnh. Gi th: gi email n ngi dng xc nh. Khi chn cc nt ni trn, ngi dng cn nhp thi gian thc hin bo hiu (tnh theo pht) v cc thng tin cn thit khc ti cc hp tng ng. Nhn Lp li - La chn Lp li cho php ngi dng xc nh mc thng xuyn ti din ca mt d nh. La chn ny gm vng Lut c lp
Trang 48

KC-06-03CN

Hng dn s dng Giao din ha GNOME

li (bt buc) v mt s vng khc ph thuc vo vic d nh ang xem xt c ti din hay khng.

Hnh 6.6. Ch dn thit t b lp lch GNOME

Vng Lut c lp li: y l thuc tnh u tin cn phi thit t nu mun cc d nh c ti din theo mt quy lut no . Ngi dng la chn kiu thng xuyn theo cc nt Khng, Hng ngy, Hng tun, Hng thng v Hng nm. V vi mi kiu chn, ngi dng cn iu chnh nhng thuc tnh ti din cho kiu chn . Nu chn nt Khng th chn nt ng khng nh v kt thc, ngc li khi chn mt trong cc nt khc th cc vng mi c hin th v ng ch l hai vng Ngy kt thc v S kin c bit. Cc vng hin th khc tu thuc vo tng mc thng xuyn. Vng Ngy kt thc cho php xc lp quy tc dng vic ti din d nh hoc cho d nh c ti din mi mi. Trong vng S kin c bit, cho php to ra nhng ngoi l cho qu trnh ti din ca d nh: trong mt ngy c th (kch p vo mi tn ngy) v kch nt Thm s kin c bit bin tp cc ngoi l . 6.4. Thit lp b lp lch GNOME Lch GNOME c th c s dng rt a dng v lun tn ti cng c to lch theo mun. GNOME cho php thit t thuc tnh ca lch GNOME bng cch s dng cc ch dn cho b lp lch. lm iu , trc ht chn mc Thit lp trn thanh nhm chc nng, sau la chn mc con La chn. Kch chut tri vo mc
Trang 49

KC-06-03CN

Hng dn s dng Giao din ha GNOME

con ny th hp hi thoi Tu chn xut hin (hnh 6.6) cho php a cc ch dn cho b lp lch GNOME. Hp thoi Tu chn c chia ra lm 3 nhn: Hin th thi gian, Mu, and Nhng vic cn lm. Nhn Hin th thi gian - Nhn ny c chia thnh ba mc chnh: nh dng thi gian, Tun bt u vo, v Khong thi gian. nh dng thi gian - Cho php chn ch hin th gia 12 gi (AM/PM) hoc 24 gi . Tun bt u vo - Cho php xc lp ngy bt u trong tun l Ch nht hoc Th hai. iu ny s nh hng n dng v ca lch khi biu th di dng ngy v tun. Khong thi gian - Cho php chn thi gian bt u v kt thc trong ngy. Nhng gi ngoi khong c chn s b m trong bng ngy. Nhn Mu - cho php thay i mu mc nh trong Lch. C by mu ty bin: Trnh by, mc, Ngy ri, Cuc hn, Ngy quan trng, S th t ngy, v S th t ngy hin ti. Mi la chn c mt hp la chn mu nh bn cnh. Khi nhn vo hp ny, mt hp thoi chn mu s hin th cho chn mu. Mi ln chn mt mu th mu lch nh bn phi ca bng s c hin th tng ng nh c chn. Nhn Nhng vic cn lm - Bng ny cho php nh ngha nhng ct no s c thy ti Nhng vic cn lm trong bng ngy. Lu : Mi ln thay i trong hp thoi Tu chn, cn nhn vo nt Kch hot khng nh s thit t .

Chng 7. Hng dn s dng gnome-Terminal

7.1 Gii thiu Gnome-terminal (c th gi l b m phng trm cui GNOME) l trnh h thng thc hin vic m phng mt trm cui c sn trong GNOME. N cung cp cch thc
Trang 50

KC-06-03CN

Hng dn s dng Giao din ha GNOME

lm vic vi shell ngay trong mi trng GNOME. Gnome-terminal h tr mu hin th (xem mc cc bin mi trng bit thm chi tit) cng nh h tr chut cho cc ng dng. Theo ngm nh Gnome-terminal c ci sn trn Thanh-GNOME nh mt nt bt, ngi dng kch p chut tri chy ng dng ny. Gnome-terminal cung cp cho ngi dng mt mi trng lm vic vn bn, ngi dng s dng cc lnh shell a yu cu ca mnh trong ca s ng dng ca Gnome-terminal. Vng rng nht trong ca s ny l mt mn hnh vn bn m phng vi du nhc shell. Ngay trn vng mn hnh vn bn l mt thanh menu (cn gi l menu chnh) ca Gnome-terminal gm 4 menu l Tp, Chnh sa, Thit lp v Tr gip. Menu Thit lp cn c c bit quan tm v y l ni ngi dng a cc thit t mi i vi Gnome-terminal. Gnome-terminal cng c gi thc hin theo cc cch nh mt trnh ng dng thng thng. 7.2 S m phng trm cui (Emulation) Gnome-terminal c thit k m phng chng trnh xterm c cung cp bi X Consortium, (xterm l mt chng trnh m phng gn nh hon chnh terminal DEC VT102). Gnome-terminal cng h tr phn m rng cho VT102 c cung cp bi xterm thng qua cc escape sequence - k t iu khin c bit gm mt du "/" v mt k t khc (v d: /n - l k t iu khin xung dng). Chng trnh xterm l mt bc tin trong lp trnh. Phin bn gn y ca xterm c hp nht trong Gnome-terminal, bao gm vic m phng cc k t iu khin c bit ca trm cui mi hn DEC VT220. 7.3 Cu hnh trm cui (menu Thit lp) Khi ngi dng vo mc La chn t menu Thit lp, hp thoi Cc thuc tnh xut hin cho php ngi dng cu hnh cc tu chn c th cu hnh. 7.3.1 Nhng ty chn chung Hu ht cc ty chn u d hiu, tuy nhin c mt s ty chn cn phi c gii thch chi tit hn nh trnh by di y. Lp terminal Thit t cu hnh cho cc lp trm cui. Cn chn la tt lp trm cui vic thit t c hiu qu. Cc k t la chn theo t nh ngha mt danh sch cc k t (hoc cc lp k t) c xem nh k t t (word characters), cn cc k t khng thuc vo nh ngha ny c coi l cc ngn cch t. Vic nh ngha ny c s dng khi ngi dng mun c cc thao tc t trong vn bn. Trang 51

KC-06-03CN

Hng dn s dng Giao din ha GNOME

7.3.2 Cu hnh mu sc Gnome-terminal h tr y nhng mu m rng c s dng trong xterm. Nhng ty chn ny cho php iu khin nhng mu . Bng mu Gnome-terminal h tr 4 bng mu gm: Linux console, xterm, rxvt v Custom (mu ty bin). Mi bng mu cho php nh ngha v cng v mu sc cho s kt hp mi su mu ANSI c h tr bi cc trm cui ny. Nu mong mun chn mu theo thch vi tt c 16 mu (8 mu m, v 8 mu nht) c th c ty bin bng cch kch vo b chn mu. Cch b tr mu Khi cc ng dng ang chy trong Gnome - terminal khng c yu cu v mu sc, Gnome-terminal cho php b qua cc mc nh cho mu nn v mu ch trn nn ca trm cui. Nhng ty chn sau y l sn c: ch trng/nn en, ch en/nn trng, ch xanh lc/nn en, ch en/nn vng nht, v ty bin. Mu nn v mu ch ca trm cui s ph thuc vo mu c chn. Mu nn mt trc/mt sau cho php la chn mu nn v mu ch (ring v khc vi mu mu) theo mun. ng thi, ngi dng c th ko mt mu (trong hp hnh ch nht di bnh xe mu) t bt k b chn mu no trong GNOME hoc trong ngun mu v th n vo trong trm cui. Nu ngi dng th mu trn vng trng, n s thit t mu nn, nu ngi dng th mu trn mt c cha k t, n s thay i mu ch. Mu tu bin cng s t ng thay i thit t mu ch hoc mu nn mi. 7.4 Nhng lp trm cui Gnome-terminal cho php c c nhng c trng cu hnh khc nhau ph hp vi nhng mc ch s dng khc nhau (nhng mu nn khc nhau, s tn ti, khng tn ti hoc v tr ca nhng thanh cun...). thit t nhng c trng cu hnh trn, m hp thoi Cc thuc tnh t menu Thit lp ca Gnome-terminal. La nhng ty chn thch hp (iu s lm thay i cu hnh trm cui ang m, v th c th xem trc chng thay i nh th no), v trc khi ng hp thoi Cc thuc tnh, phi nhp tn mi vo vng Lp terminal. kch hot mt lp c bit vo lc khi ng chng trnh, c th s dng cc ty chn dng lnh -- tclass. 7.5 Nhng ty chn ca lnh tclass Lnh tclass c cc tu chn lnh sau y kch hot mt lp trm cui. --background mu Tu chn ny cho php t mu nn cho trm cui lc khi ng. Mu c th l bt k mu no c h thng cc ca s chp nhn. --tclass tn-lp Xc nh tn lp trm cui c dng cu hnh trm cui lc khi
Trang 52

KC-06-03CN

Hng dn s dng Giao din ha GNOME

ng. --command lnh, -e lnh Cho php chy lnh ti thi im khi ng. --execute lnh cc-i-s, -x lnh cc-i-s Thc hin lnh vi cc-i-s khi khi ng. Khng c i s no ngoi cc i s cc-i-s c x l bi trm cui. Dng lnh ny ging nh dng lnh xterm -e. --font font-ch Thit t font ch ca trm cui l kiu font-ch. --foreground mu Thit t mu ch trn trm cui l mu. --geometry=mode-mn-hnh Xc nh s hng v s ct k t trong trm cui theo mode-mn-hnh (v d nh: --geometry=80x40 s to ra mt trm cui vi mn hnh tm mi ct v bn mi hng k t). Ch : Lin kt ti ti liu gnome-libs nhn c c t v modemn-hnh. --login Gnome-terminal chy shell theo kiu ng nhp (chy tt c cc script khi to ng nhp trong kiu ny). -- nologin Gnome-terminal ch chy mt shell m khng chy bt k mt script khi to ng nhp no. -- noutmp Xc nh trm cui v shell tng ng khng cn phi c ng k trong c s d liu h thng ca nhng ngi dng ng nhp vo trong my tnh. -- utmp Cho php ngi dng mun trm cui ny c ng k trong c s d liu h thng ca nhng ngi dng ng nhp vo trong my tnh (c s d liu utmp). iu ny l ngm nh. --title tiu-, -t tiu- Gnome-terminal s s dng tiu- cho tiu ca ca s. --termname tn-trm-cui Cho php Gnome-terminal s dng tn-trm-cui nh gi tr ca bin mi trng TERM. Cho php s dng nhiu ty chn ng thi. V d, trn mt my tnh c ci trnh
Trang 53

KC-06-03CN

Hng dn s dng Giao din ha GNOME

duyt web Lynx, nu ngi dng a ra cu lnh: Gnome-terminal --title Web --command lynx th mt Gnome-terminal khi to Lynx v c thanh tiu l Web s c m. 7.6 Cch s dng chut v con tr Trong mt s on trc y chng ta xem xt vic s dng chut trong mi trng ha. Trong on ny, chng ta xem xt mt s thao tc vi chut khi lm vic trong cc trm cui. Chut c dng sao chp, chn on vn bn, dn vn bn... t nhng trm cui hoc nhng ng dng khc, hay l m mt menu. Nu ch c hai nt chut, th X server s c mt phng php m phng nt chut gia v mt cch c th lm l nhn ng thi hai nt tri v phi (Song v nguyn tc, cn xem ti liu v X server c thng tin chnh xc). 7.6.1 S la chn Gi thit l ngi dng thun tay phi v lm vic vi chut ba nt chun (Nhng ngi thun tay tri s s dng nt chut phi thay cho nt chut tri ...). Nt chut tri c s dng bt u mt s la chn. Khi kch chut mt ln v ko, th cc vng k t s c la chn. Nu vng k t ra ngoi khong nhn thy th ca s mn hnh s cun cho php nhn thy ni dung cn la chn. Khi kch p nt chut tri th s la chn theo t. Nhn p chut (khng th) v ko s m rng s la chn. Khi kch nt chut tri ba ln v gi, th ton b cc dng s c chn khi ko chut ln hoc xung. Nt chut gia c th c s dng m rng s la chn. n gin ch cn cun ti ni mun m rng s la chn ti, v kch nt chut phi trong khi con chut vn cn trn thanh cun. Tm li, nu kch chut mt ln, hai ln hay ba ln th kt qu tng ng s l s la chn theo k t, theo t v theo dng. Trong tt c cc trng hp, vic nh nt chut s t ng sao chp vn bn c chn vo b nh m, v c th c dn ti nhng ng dng khc. Ch rng bt k mn hnh u ra no cng s thit t li cc la chn nhng khng lm mt cc thng tin trn b m. 7.6.2 Dn vn bn Khi nhn nt chut gia, th vng c la chn hin thi s c dn vo trong ca s. iu ny c s dng sao chp hay di chuyn vn bn trong nhng ng dng khc nhau. 7.6.3 Loi chut c bnh xe Nu c loi chut c bnh xe (tc l c thm hai s kin c gn cho hai nt chut 4 v 5), th c th s dng bnh xe cun b m ln v xung. 7.6.4 Menu iu khin (control menu) Con tr cng c s dng a ra mt menu iu khin, menu ny c s dng
Trang 54

KC-06-03CN

Hng dn s dng Giao din ha GNOME

khi mun thit lp li mt trm cui, hoc hin li menu chnh, nu n c n. hin menu iu khin, hy gi phm CTRL ng thi nhn nt chut phi. 7.6.5 Truy nhp URL (Launching URL's) Gnome-terminal cho php chn la mt URL t dng vn bn bng cch di chuyn tr chut qua n. URL ny s c gch chn v con tr chut c hnh mt bn tay. Nu m menu iu khin trong khi tr vo mt URL, th c ty chn mi l M trong trnh duyt s c thm vo menu cho php ti URL vo trong mt b duyt. a ra ngay c URL, hy nhn nt chut tri trong khi gi phm CTRL. 7.6.6. Tnh nng ko - th Tnh nng ko-th c th c s dng cho mt s thao tc bn trong trm cui. Ko tp tin (Dragging files) Nu mt tp tin c ko vo trong trm cui, th tn y ca tp tin s c dn vo trong ca s. URL c th cng c th vo ca s theo cch ny. Ko mu (Dragging colours) Mt mu c th c ko t cc ng dng GNOME khc, hoc t b chn mu vo trong mn hnh. Nu th mu ln mt k t, th mu ch trn trm cui s c thit t, nu khng th mu nn s c thit t. 7.7 Cc menu Gnome-terminal cung cp mt s c tnh iu khin thng qua menu chnh, v mt menu iu khin khi nhn nt chut phi v gi phm CTRL (i khi khng cn thit phi gi phm CTRL m menu bt). 7.7.1 Menu Tp Khi vo menu Tp, cc la chn sau y xut hin: Terminal mi Cho php m mt trm cui m phng mi. y l mt cch hiu qu to ra nhiu trm cui c x l bi cng mt chng trnh v mt tin trnh (PID: proccessing index). Mi trm cui m phng s khi ng shell con (sub-shell) ca ring mnh. n thanh menu Cho php n thanh menu trn ca s trm cui nhm to ra mt trm cui mi gn hn, nh hn. Thanh menu c th c hin th li bng cch gi phm CTRL v nhn nt chut phi. ng terminal ng trm cui hin thi v cc trm cui khc c m thng qua vic s dng la chn Terminal mi trong trm cui . Nu y l trm cui cui cng c ng th s thot ra khi chng trnh Gnometerminal.
Trang 55

KC-06-03CN

Hng dn s dng Giao din ha GNOME

7.7.2 Menu Chnh sa Hin ti menu Chnh sa c la chn Dn thc hin chc nng dn vn bn. Dn Dn cc thng tin c la chn hin thi hoc cc thng tin trong b nh m vo trm cui. Cng c th thc hin thao tc ny bng cch s dng nt chut gia. 7.7.3 Menu Thit lp Menu Thit lp gm mt s mc con sau y cho php thit t cu hnh cho trm cui. La chn... a ra mt ca s cho php thit t cc thuc tnh cho trm cui nh c gii thiu on 7.3. Thit lp li terminal Cho php thit t li cc tham s cho trm cui. Tu chn ny s khng xo sch mn hnh hoc lm di chuyn con tr, nhng bt k trm cui tip theo no a ra s c thit t li font v cc thuc tnh mc nh. Thit lp Thit t li cc tham s cho trm cui ng thi cng xo sch mn hnh. Tt c cc font v cc thuc tnh u c thit t li. B la chn mu... Cho php s dng tnh nng ko-th thay i mu trong trm cui. 7.7.4 Menu Tr gip Menu Tr gip cung cp s tr gip trc tip cho ngi dng khi ang lm vic trong mi trng trm cui. Cc la chn sau y xut hin khi ngi dng vo menu ny. GNOME terminal users guide ... a ra ti liu Hng dn s dng gnome-terminal. Thng tin... Mt s thng tin v ti liu. 7.7.5 Menu iu khin Menu iu khin l mt menu bt ca Gnome-terminal, xut hin khi ngi dng nhn nt chut phi ng thi nhn phm CTRL. Menu iu khin c dng nh mt short-cut ca menu chnh, hoc dng khi menu chnh c n. Trong menu iu khin c mc sau: Terminal mi M mt ca s trm cui mi. La chn
Trang 56

KC-06-03CN

Hng dn s dng Giao din ha GNOME

a ra ca s xc nh cc thuc tnh cho trm cui. Hin thanh menu n hoc hin thanh menu chnh, ph thuc vo trng thi hin thi ca n. Thit lp li terminal Thit lp li cc thuc tnh ca trm cui m khng xo mn hnh. Thit lp Thit lp li cc thuc tnh ca trm cui v xo mn hnh. M trong trnh duyt Nu con tr chut i qua mt URL khi menu iu khin c m, th ty chn ny s chy mt b duyt xem URL . S dng CTRL - nt chut tri l mt cch i tt ti mc menu ny. 7.8 Cc bin mi trng (Environment) Nhng bin mi trng sau y c thit lp trong Gnome-terminal: TERM Bin ny mc nh c thit lp trong xterm. Mt s ng dng c th nhn cc gi tr xterm - colour, colour - xterm hoc xterm debian h tr mu. Cn phi thay i s thit lp ny nu ng dng ca c mu hin th khng nhn mt trong nhng gi tr trn. C th thit t li thng qua ty chn lnh --termname. COLORTERM Bin ny c thit lp ti Gnome-terminal. Nhiu ng dng (c bit l nhng ng dng da trn ngn ng Slang) s dng bin ny xc nh cc mu h tr cho trm cui. WINDOWID Bin ny lu gi b nh danh (identifier) v mi trng X Window phin bn th 11 (X11 Window). Cc ng dng i khi s dng bin ny sa i ni dung ca X11 Window hoc cung cp nhng hiu ng c bit.

Chng 8. Cu hnh thanh GNOME v menu chnh

8.1 Cu hnh thanh GNOME 8.1.1.Li gii thiu Thanh-GNOME rt d cu hnh, n c trang b nhiu cng c ha gip vic thit t cu hnh. Chng ny cung cp nhng ni dung v vic cu hnh ThanhTrang 57

KC-06-03CN

Hng dn s dng Giao din ha GNOME

GNOME. 8.1.2. Cu hnh thuc tnh chung ca cc Thanh-GNOME cu hnh Thanh-GNOME hy kch chut phi vo Thanh-GNOME v chn mc Cu hnh chung. Cng c th kch chut vo nt menu chnh, chn mc Thanh panel ri chn mc con Cc thuc tnh chung. Hp thoi Cu hnh panel chung xut hin cho php thit t nhng thuc tnh s nh hng ti tt c cc Thanh-GNOME ang s dng cng nh bt k ThanhGNOME no c thm sau ny (hnh 8.1).

Hnh 8.1 Hp thoi cu hnh tng th thanh GNOME

Hp thoi Cu hnh panel chung cha su nhn gip cu hnh nhng thuc tnh ca Thanh-GNOME: Hot hnh, Biu tng ca ng dng, Biu tng ngn ko, Biu tng menu, v Biu tng ng nhp li, Cc loi khc. Cc nhn ny c ngha nh sau y. a. Nhn Hot hnh Khi chn nhn Hot hnh trn hp thoi Cu hnh panel chung xut hin cc vng nh sau ngi dng chn la: Nt Thit lp hot hnh
Trang 58

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Nt bt/tt vic cho php ngi dng cu hnh theo nhn Hot hnh. Ch khi nt ny c nhn th cc vng cn li ca nhn mi hin th cho php ngi dng cu hnh theo iu khin ca cc vng khc trong nhn Hot hnh. Ngm nh l bt. T ng n tc hot hnh Nu t ch n Thanh-GNOME mt cch t ng th ty chn ny s iu khin tc hin hoc n ca Thanh-GNOME nh di chuyn nt chuyn trn thanh tng ng. Explicit-Hide Animation Speed iu khin tc n khi kch vo nt n hai u Thanh-GNOME nh di chuyn nt chuyn trn thanh tng ng. Drawer Animation Speed Nu ngi dng s dng mt ngn ko trn Thanh-GNOME th tu chn ny cho php iu khin tc xut hin ca menu Ngn ko nh di chuyn nt chuyn trn thanh tng ng. T ng n thi gian gi chm ti thiu (ms) Nu t ch t ng n cho Thanh-GNOME th la chn ny cho php iu khin khong thi gian tr thanh n nh di chuyn nt chuyn trn thanh tng ng. Thanh-GNOME s khi ng vic m thi gian khi con tr chut khng cn ch vo n na. Thanh-GNOME s xut hin li nu nh trong khong thi gian ni trn, tr chut i qua phn cn li ca Thanh-GNOME. Khong thi gian c o bng mili-giy. T ng n c ti thiu (pixels) Nu t ch t ng n cho Thanh-GNOME th s im nh hin th ca Thanh-GNOME khi n s c xc nh qua tu chn ny nh di chuyn nt chuyn trn thanh tng ng. b. Nhn Biu tng ca ng dng Nhn ny cho php cu hnh biu tng cc nt bt trn Thanh-GNOME. Nhn ny gm cc vng la chn nh sau:

Tiu c thit lp Nt bt/tt ny cho php ngi dng to nh nn (tile) cho cc biu tng trn Thanh-GNOME. Ngm nh l bt theo cho php ngi dng s dng cc la chn v tiu . Tn file tile (ln) Tn tp tin nh khi ni. Tn file tile (xung) Tn tp tin nh khi chm.
Trang 59

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Hai la chn v tn tp tin trn y cho php ly tn v ng dn ca tp tin nh c s dng lm nh nn ni ca biu tng trng thi ni (khi khng kch hot v khng nhn chut; trng hp ln) hoc lm nh nn chm ca biu tng trng thi chm (khi c kch hot v nhn chut; trng hp xung). C th nhn vo nt Duyt tm kim tp tin nh. s dng hai la chn ny, nt Tiu c thit lp phi c bt. rng m (ch cho tile) Cho php xc nh chiu rng ca vin xung quanh mt biu tng nh di chuyn nt chuyn trn thanh tng ng. iu ny rt c ch nu nh mt biu tng che mt nh nn. C th t vin kch thc nh hn cho biu tng c th nhn thy nh nn. Chiu su Xc nh lm ca mt biu tng khi c n nh di chuyn nt chuyn trn thanh tng ng. s dng ty chn ny, nt Tiu c thit lp phi c bt. c. Nhn Biu tng ngn ko Nhn ny cho php cu hnh biu tng cc ngn ko trn Thanh-GNOME. Nhn ny gm cc vng la chn nh sau vi ngha hon ton tng t nh ni vi nhn Biu tng ca ng dng nhng thay cho nt bt l ngn ko. Tiu c thit lp Nt bt / tt cho php to nh nn cho cc ngn ko. Ngm nh l bt ngi dng s dng cc la chn v tiu . Tn file tile (ln) Xc nh tn v ng dn tp tin lm nh nn ni ca ngn ko trng thi ni. Tn file tile (xung) Xc nh tn v ng dn tp tin lm nh nn ni ca ngn ko trng thi chm. rng m (ch cho tile) Xc nh chiu rng vin xung quanh ca biu tng ngn ko. Chiu su Xc nh lm ca biu tng ngn ko khi c n. d. Nhn Biu tng menu Nhn ny cho php cu hnh biu tng ca nt menu chinh trn Thanh-GNOME. Nhn ny gm cc vng la chn nh sau vi ngha hon ton tng t nh ni vi nhn Biu tng ca ng dng nhng thay cho nt bt l nt menu chnh (C th p dng cho cc menu khc trn Thanh-GNOME). Tiu c thit lp

Trang 60

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Nt bt / tt cho php to nh nn cho nt menu chnh. Ngm nh l bt cho php ngi dng lm vic vi cc la chn tiu tip theo. Tn file tile (ln) Xc nh tn v ng dn tp tin lm nh nn ni ca nt menu chnh trng thi ni. Tn file tile (xung) Xc nh tn v ng dn tp tin lm nh nn ni ca nt menu chnh trng thi ni. rng m (ch cho tile) Xc nh chiu rng vin xung quanh ca biu tng nt menu chnh. Chiu su Xc nh lm ca biu tng nt menu chnh khi c n. e. Nhn Biu tng ng nhp li Nhn ny cho php cu hnh biu tng ca nt Thot trn Thanh-GNOME. Nhn ny gm cc vng la chn nh sau vi ngha hon ton tng t nh ni vi nhn Biu tng ca ng dng nhng thay cho nt bt l nt Thot. Tiu c thit lp Nt bt / tt cho php to nh nn cho nt Thot. Ngm nh l bt cho php s dng cc la chn tiu tip theo. Tn file tile (ln) Xc nh tn v ng dn tp tin lm nh nn ni ca nt Thot trng thi ni. Tn file tile (xung) Xc nh tn v ng dn tp tin lm nh nn ni ca nt Thot trng thi chm. rng m (ch cho tile) Xc nh chiu rng vin xung quanh ca biu tng nt Thot. Chiu su Xc nh lm ca biu tng nt Thot khi c n. f. Nhn Cc loi khc Nh c gii thch, mi khi chut i qua mt mc trn Thanh-GNOME th mt ch gii (mt b ch thch) hin ra gii thiu c im ca mc cho ngi dng, cc ch gii nh vy c gi l cc tooltip. Nhn ny cho php cu hnh tooltip cho cc mc trn Thanh-GNOME. Nhn ny gm cc la chn nh di dy. thit lp ch thch Nt bt / tt cho php thit lp thng tin hin tooltip i vi nhng mc trn Thanh-GNOME. Ngm nh l bt s dng cc la chn tip theo. Hin cc biu tng nh
Trang 61

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Nt bt / tt vic cho php hin biu tng nh trn menu chnh. Hin cc nt ... Nt bt / tt vic cho php hin du ba chm (...) trn cc mc ca menu chnh. Hin menu ko xung bn ngoi cc panel Nt bt / tt vic cho php hin menu thanh bn ngoi Thanh-GNOME. iu ny l hu ch khi mn hnh nh. Gi cc menu trong b nh Nt bt / tt vic cho php gi nhng menu ca ngi dng ti b nh trong v th khng phi r sot li khi thm nhng mc mi. iu ny c th lm tng tc ca GNOME, nhng cng c th gy ra vic mt cc mc mi c thm vo menu. S di chuyn Nt bt/tt vic cho php nhng nt bt trn Thanh-GNOME c th chuyn i v tr vi nhng biu tng khc khi di chuyn. Di chuyn t do (trnh gy nhiu cho cc tiu dng khc) Nt bt/tt vic cho php c tnh gi nguyn v tr sp xp hin thi ca cc biu tng trn Thanh-GNOME (tr khi ang di chuyn chng). y l mt c tnh tt s dng khi ngi dng a chung cch sp xp hin thi ca cc biu tng trn Thanh-GNOME. Raise panels on mouse-over Nu ang s dng trnh qun l ca s khng tng thch vi GNOME, th trnh qun l ca s s khng hiu mi quan h ca n vi Thanh-GNOME. c th l l do khin Thanh-GNOME b bao trm bi nhng ng dng. Nt Raise panels on mouse-over l nt bt / tt vic cho php c c tnh ny v Thanh-GNOME s t ng nng ln khi di chut qua. Gi cc panel theo sau cc ca s Nu s dng mt trnh qun l ca s tng thch vi GNOME, trnh qun l ca s s hiu mi quan h ca n vi Thanh-GNOME. Nt Gi cc panel theo sau cc ca s l nt bt / tt cho php c c tnh ny, trnh qun l ca s v GNOME s cho php nhng ng dng xut hin trn Thanh-GNOME. iu ny c th hu ch trn nhng mn hnh nh. Close drawer if a launcher inside it is pressed Theo mc nh th ngn ko c m khi la chn mt mc bn trong n. C th l phin phc khi ngn ko lun m cho n khi ng n bng cch kch chut. Nt Close drawer if a launcher inside it is pressed l nt bt / tt chc nng ngn ko s t ng ng li ngay sau khi chn mt mc bn trong n. m ng dng La chn cho php thay i khong cch (padding) gia nhng biu tng v tiu dng trn Thanh-GNOME.
Trang 62

KC-06-03CN

Hng dn s dng Giao din ha GNOME

8.1.3. Cu hnh thuc tnh ca mt Thanh-GNOME Thuc tnh ca mt Thanh-GNOME c th c xc nh mt cch ring r, phn bit vi cc thanh-GNOME khc. thay i cu hnh ca mt Thanh-GNOME ang hot ng, chn mc Cc thuc tnh t menu thanh.. Hp thoi Thuc tnh ca panel s hin th. Trong hp thoi ny c th thay i nhng thuc tnh cho ThanhGNOME ang hot ng. Hp thoi Thuc tnh ca panel c hai s la chn cho php thit t cc thuc tnh ca Thanh-GNOME c kch hot. Ty thuc vo kiu Thanh-GNOME c kch hot l Thanh-GNOME vin hay Thanh-GNOME gc m hp thoi Thuc tnh ca panel c th cha hoc l Panel cnh v Nn hoc l Penel gc v Nn. Ni dung hai la chn ny c m t nh di y.

Hnh 8.2 Hp thoi nhng thuc tnh ca thanh GNOME

a. Kiu ca Thanh-GNOME (Panel cnh/Panel gc) Mc con ny c hai la chn nh m t di y: V tr Thay i v tr xut hin ca Thanh-GNOME trn mn hnh, bng cch chn mt trong cc v tr c th t Thanh-GNOME loi ny ( nh, cnh; bn phi, bn tri, y trn hoc y di), v tr hin ti c mu khc cc v tr cn li. Thanh-GNOME s thay i v tr mi khi nhn nt Kch hot. Tu chn ti thiu Gm nhng nt bt / tt cho php hoc n Thanh-GNOME bng cch s dng nt n hai u Thanh-GNOME (Thit lp nt n) hoc cho Thanh-GNOME t ng n khi chut khng di qua n (T ng n) cng nh lm n / hin k hiu mi tn hai u Thanh-GNOME (Thit lp hng mi tn ca nt n).
Trang 63

KC-06-03CN

Hng dn s dng Giao din ha GNOME

b. Nhn Nn Nhn Nn c ba ty chn cho php chn mt trong ba kiu nn cho Thanh-GNOME: nn tiu chun, nn Pixmap, hoc nn mu, trong khi bt mt kiu ny th cc kiu cn li t ng tt. Nn chun cho Thanh-GNOME c xc nh bi th vin chun GTK ang chy ti thi im . Ty chn Pixmap cho php chn mt hnh nh nn cho Thanh-GNOME. Ty chn mu cho php xc nh r mt mu nn c th cho Thanh-GNOME. Tng ng vi hai kiu nn Pixmap v Mu c ba la chn File hnh nh, Scale image to fit panel v Mu nn c m t nh di y. Lu : Mt cch d hn thay i nn ca Thanh-GNOME l ko v th mt tp tin hnh nh t trnh qun l tp tin ln trn Thanh-GNOME, nn ca Thanh-GNOME c t ng thay i bng hnh nh . File hnh nh Khi chn mt nh Pixmap lm nn cho Thanh-GNOME th vng ny s l ni chn tn tp tin v hin th hnh nh c s dng. C th nhn nt Duyt tm tp tin nh mun s dng. Scale image to fit panel Khi chn mt nh Pixmap lm nn cho Thanh-GNOME th c th Thanh-GNOME khng cha ht nh . Ty chn ny cho php thay i kch thc nh nn cho ph hp vi Thanh-GNOME. Mu nn Khi chn mt mu no cho Thanh-GNOME, nt ny s a ra mt hp thoi cho php xc nh mu c s dng. 8.2. Son tho Menu chnh 8.2.1. Li gii thiu Menu chnh l mt kho cha cc ng dng c trong h thng v nt menu chnh c ngm nh t trn Thanh-GNOME. Menu chnh c th c cu hnh ph hp vi nhng cng vic quen thuc ca ngi dng. Menu chnh c chia ra thnh hai loi: cc menu h thng v cc menu ngi dng. Trnh Son tho menu sn sng cho php thm nhng ng dng mi vo menu chnh nhng khng th thm nhng ng dng vo menu h thng nu khng phi l siu ngi dng (root). Chng ny s gii thiu cc cch cu hnh menu
Trang 64

Hnh 8.3 Hp thoi v cc thuc tnh ca Menu

KC-06-03CN

Hng dn s dng Giao din ha GNOME

chnh vi nhng ng dng m mun s dng thng xuyn. 8.2.2. Cu hnh Menu chnh Cho php ngi dng thay i nhng thuc tnh ca menu chnh hoc bt k menu no khc c trn Thanh-GNOME bng cch nhn chut phi trn nt menu v chn Cc thuc tnh t menu bt. Hp thoi Cc thuc tnh menu s c a ra bin tp menu tng ng. Mc chn u tin trong hp thoi Cc thuc tnh menu l kiu menu, cho php chn kiu cho menu hoc l menu chnh hoc l menu thng.

Hnh 8.4 Menu Editor

Nu kiu menu chn l menu chnh th vng Menu chnh cho php la chn cc menu con cho menu chnh theo cc nt bt / tt. Nhng nt ny cng cho php chn nhng ng dng l thnh phn trong menu chnh, trong menu con, hoc khng nm trong menu chnh: Menu h thng - Nt bt / tt vic a nhng menu ng dng mc nh trong GNOME vo menu chinh hoc menu con. Menu ngi dng - Nt bt / tt vic a nhng menu thm cho ngi dng vo menu chnh (hoc menu con) bng cch s dng chc nng Son tho menu. Mc menu khc - Nu ang s dng Red Hat Linux th nt ny bt / tt vic a Red Hat menu cha ng tp hp cc ng dng m n ngm nh vo menu chnh hoc menu con. KDE menu - Nu ang dng mi trng KDE Desktop th nt ny bt / tt vic a cc ng dng c cha trong menu KDE vo menu chnh hoc menu con. Debian menu - Nu ang s dng Debian Linux th nt ny bt / tt vic a Debian menu cha ng tp hp nhng ng dng m n ngm nh vo menu chnh hoc menu con.
Trang 65

KC-06-03CN

Hng dn s dng Giao din ha GNOME

8.2.3 S dng cng c Son tho menu Son tho menu l mt cng c cu hnh cho menu chnh, rt tin li trong vic thit lp h thng vi nhng yu cu ring ca ngi dng. Son tho menu c khi ng khi chn thnh phn H thng trong menu chnh ri chn mc Cu hnh h thng/To menu. Trnh Son tho menu c chy v xut hin hp thoi To menu (hnh 8.4). Mn hnh To menu c chia thnh hai vng chnh. Vng bn tri cha ng menu trong trng thi mc nh. Vng bn phi cha ng mt hp thoi c hai nhn cho php thm nhng ng dng mi vo menu. Ti vng tri c hai menu con, mt cho menu ngi dng (user menu) v mt cho menu h thng (system menu). Menu ngi dng dnh cho ngi s dng hin thi v menu h thng dnh cho mi ngi s dng h thng. Nhng gi tin ng dng (prepackaged) c nh v trong menu h thng. Bn trong danh sch menu vng bn tri, c th m v ng cc th mc v xem ci g trong menu hin thi bi vic kch vo nhng du cng nh bn cnh cc menu. 8.2.4. B sung mt menu mi Khi thm mt menu mi, n s c thm vo mc menu chn trn cy th mc trong vng tri. Nu khng c mt menu no c chn trn cy th mc, th menu mi s c t ln nh cy menu. Sau khi thm mt mc menu mi, hy nhp thng tin cho menu thng qua hp thoi vng bn phi. Khi thng tin c nhp y , nhn nt Ghi v mc menu mi s c chn vo v tr chn trn cy menu vng tri. Lu : Khng th thay i nhng menu h thng tr phi c quyn truy nhp root. Mt ngi dng bnh thng ch c thm vo, xa v son tho cc menu ngi dng. 8.2.5 Ko-th trong Menu chnh Son tho menu cng h tr tnh nng ko-th trong menu chnh, iu ny lm cho cng vic ca d dng hn. Nu mun t mt mc menu ln trn Thanh-GNOME, c th ko v th t menu n Thanh-GNOME, Son tho menu s t mt nt bt vi tp hp tt c nhng thuc tnh thch hp. Nu khng mun s dng tnh nng ko-th, cng c th kch chut phi trn mc menu v chn Thm chng trnh vo panel t menu thanh a ng dng ln Thanh-GNOME.

Chng 9. Trnh qun l ca s

9.1. Gii thiu v trnh qun l ca s Trnh qun l ca s (Window manager) l mt phn ca ng dng iu khin ca s bn trong mi trng X Window. V tr, kch thc hay giao din ca bt
Trang 66

KC-06-03CN

Hng dn s dng Giao din ha GNOME

k ca s no u c qun l bi trnh qun l ca s. iu ny khng ging vi cc h iu hnh khc, v cch thc GNOME giao tip vi trnh qun l ca s cng khc vi mi trng giao din mn hnh ha khc. Trnh qun l ca s l mt trnh iu khin nhng thuc tnh ca ca s cng nh cc tnh nng hot ng trn ca s. Hin thi c mt vi trnh qun l ca s c xem l tng thch vi GNOME. Tng thch vi GNOME tc l c th chy c vi GNOME, nhn bit c GNOME cng nh nhng ng dng ca GNOME. GNOME khng ph thuc vo bt k mt trnh qun l ca s no. iu c ngha l nhng b phn chnh trong mi trng mn hnh nn s khng thay i khi thay i cc trnh qun l ca s. GNOME lm vic vi trnh qun l ca s a ra mt mi trng lm vic d nht c th c. GNOME khng b nh hng v cch xp t ca s nhng n nhn cc thng tin t trnh qun l ca s v s xp t . Vt-GNOME ch lm vic c vi mt trnh qun l ca s tng thch vi GNOME. Trong chng ny trnh by cc ni dung v Enlightenment, mt in hnh trong cc trnh qun l ca s tng thch hon ton vi GNOME. Ngoi cc trnh qun l ca s tng thch vi GNOME, cn c nhiu trnh qun l ca s khc ch mi tng thch c vi mt s phn, thm ch cn ang c sa i c th tng thch vi GNOME. Mt vi trnh qun l ca s tng thch vi phin bn hin ti ca GNOME l: Enlightenment - http://www.enlightenment.org Sawmill-http://www.dcs.warwick.a9.uk/~john/sw/sawmill/index.html Window Maker - http://www.windowmaker.org Icewm - http://www.kiss.uni-lj.si/~k4fr0235/icewm/ AfterStep - http://www.afterstep.org/ FVWM - http:// www.fvwm.org/ 9.2 Thay i trnh qun l ca s Nh ni trn tn ti nhiu trnh qun l ca s tng thch vi GNOME. GNOME cho php thay i trnh qun l ca s ang c s dng vo bt k lc no bng cch s dng mc Qun l ca s trong nhm chc nng Mn hnh nn khi vo menu Trung tm iu khin GNOME. Mc Qun l mn hnh chng B iu khin trung tm GNOME s cung cp nhng thng tin chi tit v chc nng ny.

Lu : Nn nh rng trnh qun l ca s c chn s dng c th khng tng thch vi GNOME v nu s dng mt trnh qun l ca s nh vy s khng c li vi mt s c tnh ca GNOME.

Trang 67

KC-06-03CN

Hng dn s dng Giao din ha GNOME

9.3 Trnh qun l ca s Enlightenment 9.3.1 Mt s nt s b Nh c gii thiu, GNOME l mt mi trng ha khng ph thuc vo bt k mt trnh qun l ca s no iu khin cc ng dng v c tnh tng tc gia cc ng dng , v th GNOME c th lm vic vi rt nhiu trnh qun l ca s khc nhau. Cc ng dng c iu khin bao gm trnh qun l phin lm vic, cc thit t mn hnh, cc trnh tng tc vi nhng ng dng nh Vt-GNOME ... Trnh qun l ca s mc nh cho nhn Linux-2.14 l Enlightenment. Trong Enlightenment c mt b cng c gip cu hnh trnh qun l ca s. Chng ta s dng cng c cu hnh c sn trong GNOME cu hnh Enlightenment v n c coi l trnh qun l ca s ngm nh ca GNOME. 9.3.2 Cng c cu hnh trong Enlightenment C hai cch chy cng c cu hnh cho Enlightenment (vit tt l E-conf). Cch th nht, s dng B-iu-khin-trung-tm-GNOME. Thc hin vic m v s dng trung tm iu khin GNOME bng cch hoc kch chut vo nt m ca B-iu-khin-trung-tm-GNOME - thng c hnh ci nh kho - trn thanh-GNOME hoc vo menu chnh (menu c m khi kch vo nt-menuchnh) kch chut tri vo mc H thng, v sau li kch chut tri vo mc Trung tm iu khin GNOME trong mc Cu hnh h thng. Khi ca s ca B-iu-khin-trung-tm-GNOME hin ra, hy chn mc Qun l ca s t nhm Mn hnh nn v mn hnh chn cu hnh theo Enlightenment hin ra do Enlightenment l ngm nh trong GNOME. Hy nhn nt Chy cng c cu hnh cho Enlightenment chy E-conf. Cch th hai, c th chy E-conf bng vic kch nt chut gia trn mn hnh v khi mt menu pop-up xut hin th la chn mc Enlightenment Configuration.

Hnh 9.1 cho Hnh 9.1 Cc tu chn c bn ca Enlightenment mt hnh trng cu hnh Enlightenment. E-conf c chia thnh nhiu thnh phn iu khin cc hiu ng v chc nng bn trong Enlightenment. Danh sch cc thnh phn ny c hin th ti gc trn bn tri ca E-conf. Chng bao gm: Basic Options,
Trang 68

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Desktops, Behavior, Audio, Special FX, Backgrounds, Themes v Shortcuts. Bn phi ca E-conf l vng lm vic ca mi thnh phn iu khin khi mt trong chng c chn. a. Cc ty chn c bn (thnh phn Basic Options) Basic Options cho php xc nh cch thc Enlightenment iu khin s chuyn ng v tiu im ca cc ca s trn mn hnh. Phn bn phi gii thiu cc phng php iu khin ca s. Km theo mi phng php iu khin ca s l mt mu ca s nh m t hiu qu ca phng php . Tuy nhin, chng ta nn chn mt phng php v thay i ca s, nu thy thch hp th khng nh n, ngc li th tip mt phng php khc. C ba vng cu hnh l Phng php di chuyn, Phng php v Keyboard focus follows tng ng vi vic iu khin cch hin th ca s khi di chuyn ca s, thay i kch thc ca s v hin th ca s trung tm. Phng php di chuyn Vng ny iu khin cch hin th ca ca s khi di chuyn chng trn mn hnh bng chut. C th chn mt trong cc nt tu chn Opaque (m c), Lined (vch mu), Box (hp), Shaded (bng), Semi-Solid (na m c), v Translucent (trong m). Tc di chuyn ca s theo cch hin th ca s khc nhau l khc nhau v ph thuc vo tc ca my tnh. Phng php Vng ny s iu khin cch hin th ca s khi thay i kch thc cc ca s. C th chn mt trong cc nt tu chn Opaque, Lined, Box, Shaded v Semi-Solid. Tc thay i kch thc ca s theo cc cch hin th ca s khc nhau l khc nhau v cng ph thuc vo tc my tnh. Keyboard focus follows Vng ny dng iu khin cch thc chn ca s hot ng. Ca s hot ng l ca s c th c iu khin bi bn phm, thng c mu khc vi cc ca s khc. C th chn mt trong nt bt/tt Mouse Pointer, Sloppy Pointer v Pointer Clicks. Mouse Pointer - Tr chut di qua ca s no th ca s s l ca s hot ng. Nu tr chut ra vng mn hnh trng th khng c ca s no l ca s hot ng. Sloppy Pointer - Cng c ngha tng t nh Mouse Focus nhng khc ch nu di chut ra vng mn hnh trng th ca s hot ng vn c gi nguyn cho n khi di chut n mt ca s khc. Pointer Clicks - Vi la chn ny phi tht s kch vo mt ca s th ca s mi tr thnh ca s hot ng. Cho php lu li tt c nhng la chn cu hnh va thit t chng l ngm nh cho h thng bng cch nhn nt Reset all settings to system
Trang 69

KC-06-03CN

Hng dn s dng Giao din ha GNOME

defaults and exit pha di ca ba vng cu hnh ni trn. b. Mn hnh nn (thnh phn Desktop) Nh bit, GNOME h tr vic s dng nhiu vng mn hnh, hoc nhiu mn hnh nn, v cc trnh qun l ca s s iu khin chng. Cc cng c cu hnh mn hnh nn theo thnh phn Desktops ca Enlightenment cho php thay i s vng mn hnh v s mn hnh nn cn s dng trong mi trng lm vic. Chc nng Desktops ca E-conf c hai cng c chnh cho php thay i s vng mn hnh hoc s mn hnh (hnh 9.2). Cng c u tin cho php thay i s lng vng mn hnh nh la chn Kch c mn hnh o ca chc nng Desktop. iu cho php chn s lng vng mn hnh trong GNOME. Gi l nhiu vng mn hnh nn nhng tht ra ch l mt mn hnh nn ln c chia thnh nhiu vng nh hn. Mi vng nh th c gi l mt vng mn hnh nn v cho php t mt ca s ng dng ring bit. Li th ca vic s dng nhiu vng mn hnh nn l tnh nng ko-th trn mn hnh s c thc hin gia cc vng mn hnh nn hon ton tng t nh khi chng c thc hin trong cng mt ng dng. thay i s vng mn hnh, hy s dng hai thanh trt ngang, dc trong Kch c mn hnh o.

Hnh 9.2 Mn hnh nn

Cng c th hai cho php thit t s lng mn hnh nn ring bit mun s dng trong GNOME khi la chn chc nng Cc mn hnh o. Khc vi vng mn hnh nn, cc mn hnh nn ni y l nhng mn hnh ring bit hon ton, c th coi nh chng thuc cc trm cui khc nhau. Cng c ny cng c mt thanh trt cho php xc nh s mn hnh nn mun s dng. Cch tt nht c th nhn thy s vng mn hnh hoc s mn hnh l hy chy Vt-GNOME. Vt-GNOME s cho thy s vng mn hnh hoc s mn hnh v v tr ca nhng ng dng ang chy trong mi vng mn hnh hoc mn hnh. Cng c th s dng Vt-GNOME chuyn t vng mn hnh ny n vng mn hnh khc, hoc
Trang 70

KC-06-03CN

Hng dn s dng Giao din ha GNOME

t mn hnh ny ti mn hnh khc. Ngoi hai cng c chnh ni trn, GNOME cn mt s cng c khc rt hiu qu. Mt trong chng nh vy l cng c thit t thi gian tr khi chuyn i vng mn hnh hay mn hnh nh s dng cng c Edge flip resistance -. Tc dng ca cng c ny l thit t thi gian tr trc khi chuyn sang mt vng mn hnh khc (thng thng, khi s dng cc vng mn hnh, c th chuyn n mt vng no bng cch di chut n cc gc ca mn hnh theo hng vng cn chuyn ti). c. Cch ng x (thnh phn Behavior) Thnh phn Behavior ca E-conf cho php thit lp cc ng x (hnh vi) ca Enlightenment bao gm cc hot ng trng im v hn hp trong Enlightenment (hnh 9.3). Hai nhm ny c thc hin nh chn cc nhn Advanced Focus v Miscellaneous. Advanced Focus Nhn ny cho php thay i nhng thuc tnh lin quan n nhng ca s hot ng. Tng ng vi mi nhn chn, mt danh sch cc nt bt / tt tu chn sau y c hin ra chng ta thit t. All new windows that appear get the keyboard focus - Vic bt nt ny cho php khi khi ng mt ng dng mi, c th s dng bn phm iu khin ng dng khi n xut hin m khng cn phi s dng n chut.

Hnh 9.3 La chn ng x Enlightenment

All new pop-up windows get the keyboard focus - Bt nt ny cho php s dng bn phm trong cc ca s bt. Nu bt tu chn ny th tu chn All new windows that appear get the keyboard focus s b tt. Mt v d v mt
Trang 71

KC-06-03CN

Hng dn s dng Giao din ha GNOME

ca s bt l mt thng bo li c th nhn c trong mt ng dng. Only new popup windows whose owner is focused get the keyboard focus - Ty chn ny cho php s dng bn phm trong ca s bt mi m vi iu kin l ng dng a ra ca s s dng bn phm t trc. Raise windows when switching focus with the keyboard - Nu s dng cc phm-nhn (keystrokes) thay i ca s hot ng th ca s s c a ln trn cc ca s khc. Send pointer to windows when switching focus with the keyboard - Khi s dng nhng phm nhn thay i ca s hot ng, th con tr chut s hin th ti ca s . Miscellaneous Nhn ny cho php thc hin cc hot ng Enlightenment hn hp c m t theo cc ty chn di y. Tooltips ON/OFF & timeout for tooltip pop-up - Tu chn cho php tt/bt v xc nh khong thi gian (tnh theo giy) hin th cc b ch gii cng c (tooltip) trn ca s c iu khin bi Enlightenment. B ch gii cng c l mt ca s thng tin nh c hin ra khi di chut n mt (cc) thnh phn trong mt ng dng. Hy s dng thanh trt xc nh thi gian mun b ch gii cng c hin th sau khi di tr chut ln mt thnh phn c Enlightenment iu khin. Automatic raising of windows after X seconds - Ty chn ny cho php xc nh khong thi gian (tnh theo giy) chuyn t ca s hot ng ny sang ca s hot ng khc khi di chut n. Transient pop-up windows appear together with leader - Nu cc ng dng m cc ca s bt nh mt tnh nng thng thng, th tu chn ny cho php cc ca s bt c hin th trn ca s chnh. L iu ch li khi lung cng vic b ngt bi ca s bt th ca s ng dng v ca s bt khng ln nhau trong khi ng dng ang lm vic. Switch to where pop-up window appears - Ty chn ny cho php t ng a con tr chut v kh nng iu khin bng bn phm n bt k ca s bt no xut hin trn mn hnh. Display icons when windows are iconified - Tu chn ny cho php khi thu nh ca s th nt m hin c ca ca s ng dng s c hin th ln mt nn mi c to. Nu ang s dng Vt GNOME th khng cn phi s dng ty chn ny v Vt GNOME cho php truy nhp ti nhng ng dng c thu nh. Place windows manually - Nu mun nh v mt ca s mi, ty chn ny cho php chut iu khin vic nh v ca bt k ca s mi no.
Trang 72

KC-06-03CN

Hng dn s dng Giao din ha GNOME

d. m thanh (thnh phn Audio) Thnh phn ny cho php bt / tt cc s kin m thanh trong Enlightenment. e. Hiu ng c bit (Special FX) Thnh phn Special FX trn E-conf cho php iu khin nhiu hiu ng c bit m Enlightenment c th s dng iu khin cc ca s. Nu my tnh c tc chm th nn v hiu ha nhng c tnh trn trong mc ny.

Hnh 9.4 Hiu ng c bit Enlightenment

Trong thnh phn hiu ng c bit, cc mc tu chn di y cho php iu khin cc hiu ng c bit tng ng. Windows Sliding Methods - Vng ny iu khin hnh thc hin th ca cc ca s khi chng trt trong ln hin th u tin. c th s dng ty chn ny ca s phi c c tnh trt l c tnh cho php (xem tu chn Windows slide in when they appear). C th chn cc nt Opaque, Lined, Box, Shaded v Semi-Solid. Windows slide in when they appear - Ty chn ny cho php chn tc trt ra mn hnh ca cc ca s ng dng. tt hoc bt c tnh trt, hy nhn nt Enable cnh thanh trt. Thanh trt ny iu khin tc trt ca ca s v c tnh theo s im nh/giy. Windows slide about during window cleanup Ty chn ny cho php iu khin cc hiu ng c bit ca cc ca s trt bn trong khi chn mc menu Cleanup Windows t cc menu Enlightenment. tt hoc bt n, hy nhn nt Enable cnh thanh trt. Thanh trt ny iu khin tc trt ca ca s v c tnh theo s im nh/giy. bit thm thng tin v tnh nng Cleanup Window, hy xem mc Cc menu ca chng ny (mc 9.3). Desktops slide in when changing desktop - Nu s dng nhiu mn hnh th ty chn ny s lm cc mn hnh trt trong khi chuyn ti mt mn hnh mi. tt hoc bt n hy nhn nt Enable cnh thanh trt. Thanh trt ny iu khin tc trt ca
Trang 73

KC-06-03CN

Hng dn s dng Giao din ha GNOME

ca s v c tnh theo s im nh/giy. Window shading speed - Ty chn ny cho php bt/tt cch thc thu gn mt ca s nh vic nhn p trn thanh tiu ca ca s . Lc ny ca s ca s trng nh mt thanh tiu trn mn hnh. Nhn p li vo thanh tiu , ca s s c tr li trng thi ban u ca n. Nt Enable cho php bt/tt cch thc. Thanh trt cnh nt Enable s iu khin tc thc hin ca tu chn ny, tc c o bng im nh/giy. Drag bar - Mt s b chn kiu giao din ca s trong Enlightenment c mt thanh ko cho php trt vo vng mn hnh hoc mn hnh tip theo. Nu khng mun iu , ng chn ty chn ny. Ngoi ra, c th xc nh v tr ca thanh ko trn mn hnh khi chn ty chn ny. Animate Menus - Ty chn ny cho php iu khin cch hin th ca cc menu ca Enlightenment. Nhng menu s tr nn sng ng nu chn ty chn ny bng cch nhn nt Enable. Reduce refresh - Ty chn ny t cc menu vo trong b nh tng tc hin th chng. Tc hin th ph thuc vo kch thc ca cc menu trong b nh. f. nh nn (backgrounds) thit t nn cho mn hnh, chn thnh phn Backgrounds ca Enlightenment. Lu : Nu s dng Enlightenment thit t nh nn th s khng th s dng cc thuc tnh nn trong b iu khin trung tm GNOME. Ngi dng mi lm quen vi GNOME hoc Enlightenment khng nn s dng c tnh ny. Thit t nh nn (Setting the Background). B chn nh nn cho Enlightenment hot ng theo cch hin th ra mt s cc tp tin nh nn c la chn sn trn vng bn phi. Nu mun thit t nh nn mi cho mn hnh, trc ht hy chn mn hnh mun t nh nn. Nt trn nh, bn cnh vng lu cc tp tin nh c chn sn, s cho php chn mn hnh mun thit t, v d, mun chn nh nn cho mn hnh th nht, hy nhn vo nt v chn Desktop 0. Ch : Mn hnh c nh s bt u t 0 theo s hiu ca mn hnh nn (k hiu l Desktop 0, Desktop 1, ...). Nu s dng vng mn hnh trn mn hnh no th mn hnh l mn hnh Desktop 0. Sau khi chn c mn hnh, hy thit t nh nn cho mn hnh . chn mt mu, hy chn hp cha hnh nh/ mu trong s cc hp nh nn vng bn phi hoc chn nt Khng nn khng cn nh nn. Nu khng thch nhng nh nn sn , c th to ra mt nh nn mi.
Trang 74

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Hnh 9.5 Nn ca Enlightenment

Ch : Nu chn nt Khng nn cho mt mn hnh, th cc ng dng khc hoc b iu khin trung tm GNOME s thit t nh nn cho cc mn hnh ring ca chng. To mt nh nn mi (Creating a New Background): to ra mt nh nn mi, trc ht hy nhn nt Thm mi... thm mt hp nh nn mi vo vng hin th nh nn bn phi. Cng c th sa li mt nh nn bng cch chn hp nh nn mun sa v nhn vo nt Hiu chnh. Hp thoi Background Edit s c hin th cho php thit t li nh nn. Hp thoi Background Edit (hnh 9.6) c ba nhn th hin ba loi nh nn khc nhau: Solid Color, nh nn v Overlayed Logo. - Solid Color - Nhn ny n gin l mt b chn mu, trong c cc thanh trt cho php iu chnh mu sc theo mun (hnh 9.6). Sau khi chnh xong hy nhn nt Xong la chn mu .
Hnh 9.6 t mu nn

- nh nn - Nhn ny cho php la chn mt nh c trn h thng thit t nh nn cho mn hnh (hnh 9.7). Hy nhn nt Duyt tm hnh nh v nhn nt Xong
Trang 75

KC-06-03CN

Hng dn s dng Giao din ha GNOME

xo bt k s la chn no. Khi xc nh c nh nn, c th quyt nh hnh nh c th c lp trn khp mn hnh, gi nguyn kch thc, hay c cc i ha theo chiu ngang hoc chiu dc. - Overlayed Logo - Nhn ny cho php xp chng mt nh trn nh nn thit t trong nhng nhn khc (hnh 9.8). nh c th c tm bng nt Duyt v loi b vi nt Xong.
Hnh 9.7. Chn nh nn

Khi chn xong nh, c th chn v tr hin th ca hnh nh thng qua mt danh sch cc v tr trn mn hnh. Cng c th quyt nh gi nguyn kch thc ca nh hay cc i ha nh theo chiu ngang hoc dc. Khi hon thnh vic sa i, hy nhn nt Xong quay li E-conf.

Hnh 9.8 Overlayed Logo

g. B chn kiu giao din ca s (Themes) Enlightenment l mt trnh qun l ca s kh quen dng i vi h iu hnh Linux khng phi ch v giao din p m cn v tnh d s dng ca n. C nhiu kiu giao din ca s c Raister v nhiu ngi dng Enlightenment trn khp th gii to ra. C th vo web-site ti a ch http://e.themes.org tm hiu thm v cc kiu giao din ca s c lu tr trong .

Hnh 9.9. B chn kiu giao

Cc kiu giao din ca s trong Enlightenment, c cha trong cc tp tin c tn bt buc phi kt thc bng xu .etheme. Vi kiu c th c xy dng cho nhng n bn Enlightenment c v v th chng khng lm vic c vi cc phin bn mi nht. Hy chc chn rng ang c mt phin bn thch hp. Khi tm thy mt kiu giao din ca s ng c trong Enlightenment, hy t n vo trong th mc ~/ .enlightenment/themes/. Lc , tt c cc tp tin .etheme
Trang 76

KC-06-03CN

Hng dn s dng Giao din ha GNOME

trong th mc ny s c th c la chn thng qua cc b chn kiu giao din ca s. Hy chn kiu giao din ca s t danh sch trong vng Current theme selection v nhn nt Apply trn y ca E-conf thit t n. h. Cc phm tt (Keyboard Shortcuts) Mc ny cho php thay i nhng phm tt c s dng iu khin cc ca s, khi ng nhng lnh, di chuyn gia cc ca s, cc vng, v cc mn hnh. Cc phm tt bao gm cc phm iu khin kt hp vi mt phm bt k. Mc cc phm tt (hnh 9.10) c chia thnh hai vng chnh l List of keyboard shortcuts v Edit current selected keyboard shortcut.

Hnh 9.10 t cc phm tt trong Enlightenment

Trong List of keyboard shortcuts, c th nhn thy nhng phm tt c nh ngha v la chn cc phm tt sa li. thm nhng phm tt mi hy nhn nt New v xa cc phm tt bng nt Delete. Vng Edit current selected keyboard shortcut l ni cho php nh ngha cc phm tt. s dng vng ny, phi chn phm tt mun sa i, hoc chn mt phm tt mun b sung sau khi nhn nt New. Mi khi mt phm tt c chn, cho php thay i nhng phm to phm tt hoc thm ch l cc chc nng m phm tt thc hin. thay i nhng phm iu khin c s dng cho mt phm tt, hy nhn nt Modifier v thc hin nhng s sa i. Nhng phm iu khin l nhng phm ALT, CTRL, v SHIFT. Phm tt c th l s kt hp ca mt hay nhiu phm iu khin vi mt phm k t bt k. Cng c th thay i k t kt hp bng cch nhn nt Change bn cnh hp nh ngha Key. Khi , mt thng bo ngn c a ra yu cu nhn phm mun thay i. Hy nhn phm v nh ngha v phm tt s c thay i. gn phm tt mi vi mt hot ng, hy chn hot ng trong vng Action to perform. C mt vi phm nhn mun s dng cho mt hot ng cn phi c nh ngha. V d, nu mun s dng mt phm tt chuyn ti mt mt mn hnh no
Trang 77

KC-06-03CN

Hng dn s dng Giao din ha GNOME

, c th chn Goto Desktop. V trong Options for Action, c th nh ngha mn hnh mun chuyn ti bng cch nhp s hiu Desktop. 9.3.3 Menu trong Enlightenment Nh tt c cc trnh qun l ca s khc, Enlightenment c thit k s dng trn mt mi trng c ha hoc khng. iu ny c ngha l c mt vi chc nng trong Enlightenment cho php thc hin cc thao tc nh khi to cc ng dng, di chuyn gia cc mn hnh v.v. Enlightenment cung cp nhng menu a ra cc ng dng v thc hin cc nhim v. Nhng menu ny c s dng trn mn hnh hoc bn trong mt ca s bt k a ra nhiu chc nng khc nhau. A. Nhng menu trn mn hnh (Enlightenment Desktop Menus) truy nhp nhng menu mn hnh, hy kch nt chut gia trn mn hnh. Menu mn hnh s cung cp hng lot cc ng dng c ci t trn h thng. C th c mt vi ng dng m Enlightenment t trn menu cha c ci t. Cc mc trong menu ca Enlightenment gn ging nh trong menu chnh ca GNOME. Thm vo , c th a ra cc cng c cu hnh cho Enlightenment hoc thay i cc kiu giao din ca s. Cc menu mn hnh Enlightenment c thit t theo cc la chn sau y: GNOME Apps - Menu ny cng ging nh menu Application trn menu chnh ca GNOME. User Apps - Menu ny ging nh menu User menus trn menu chnh ca GNOME (menu ny cha ng bt k ng dng no thm vo). Other Programs - Menu ny bao gm cc ng dng m ngi to ra Enlightenment hoc b giao din ca s ang c s dng qui nh. C th c hoc khng c nhng ng dng ny trn my tnh. Desktop - Menu ny bao gm cc mc lm thay i mt s cc c tnh ca mn hnh. Menu ny gm cc mc con sau y: Cleanup Desktop - Mc ny s sp xp li cc ca s trn mn hnh ca theo mt th t c sn. N rt hu ch nu gp rc ri khi tm mt ng dng do s hn n trn mn hnh. Go to Next Destop - Mc ny cho php chuyn n vng mn hnh/mn hnh tip theo. Go to Previous Desktop - Mc ny cho php chuyn n vng mn hnh/mn hnh trc . FX Ripples - Mc ny cho ngi dng mt s gii tr mang tnh hi hc. Themes - Mc ny cho php tm kim th mc lu tr ca cc kiu giao din ca s c thit t trn my tnh. Enlightenment Configuration - Mc ny cho php a ra cng c cu hnh cho Enlightenment.
Trang 78

KC-06-03CN

Hng dn s dng Giao din ha GNOME

About Enlightenment - Mc ny a ra mt ca s nh cha ng cc thng tin gii thiu v Enlightenment. Help - Mc ny a ra ti liu hng dn v Enlightenment. Restart Enlightenment - Mc ny s khi ng li Enlightenment. Nu ang s dng GNOME th khng nn chn mc ny v thay vo , hy s dng Thot. B. Cc menu cho ca s Enlightenment Menu ca s cho php xc nh cc c tnh cho ca s trong Enlightenment. C hai cch nhn c cc menu ny. Nu menu c to sn, hy nhn nt chut phi trn thanh tiu ca ca s, menu cho ca s s c hin th trn thanh tiu . Mt cch khc l gi phm ALT ng thi nhn chut phi, menu cho ca s s xut hin ti v tr tr chut. Ngi dng c th s dng nhng phm tt mc nh hay c thit t li trong Enlightenment Configuration Tool iu khin menu cho ca s. Cc mc con trong menu cho ca s tc ng n cc ca s ng dng: Close - Mc ny ng ca s. Annihilate - Mc ny dng ng dng nu gp rc ri khi ng ca s. Iconify - Mc ny biu tng ha ca s ng dng. Nu ang s dng VtGNOME, mc ny s ti gin ca s v a vo vng cc ng dng trn VtGNOME. Nu khng chy Vt-GNOME, la chn ny cho php s ti gin ca s ca thnh biu tng ca ng dng. Raise - Mc ny s a mt ca s ln trc cc ca s khc trn mn hnh. Lower - Mc ny s a mt ca s xung di tt c cc ca s khc trn mn hnh. Shade/Unshade - Mc ny s thu gn mt ca s thnh mt thanh tiu hoc tr v dng ban u ca n. Stick/Unstick - Mc ny cho php ngi dng xc nh mt ca s s lun c hin th trn cc vng mn hnh hoc cc mn hnh. Desktop - Nhng mc con trong Desktop cho php di chuyn mt ca s ti vng mn hnh khc. C th la chn cc mc con: Move to Area Right: di chuyn sang vng bn phi, Move to Area Left: di chuyn sang vng bn tri, Move to Area Above: di chuyn ln vng trn; Move to Area Below: di chuyn xung vng di. Window Size - Mc ny cho php thay i kch thc ca s vi cc la chn thay i nh sau: Height: thay i theo cao, Width: thay i theo chiu rng,
Trang 79

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Size: thay i theo c chiu rng ln chiu cao.

Chng 10. B iu khin trung tm GNOME

10.1 Li gii thiu B iu khin trung tm GNOME (the GNOME Control Center) cho php cu hnh nhiu b phn trong h thng bng cch s dng mt tp hp nhng cng c gi l Ctiu dng (Capplet). Cc C-tiu dng ny l nhng chng trnh nh hot ng
Trang 80

KC-06-03CN

Hng dn s dng Giao din ha GNOME

theo cch thc lin kt ng, c nhng vo cc trnh ng dng v v vy c mt kt ni linh hot ti tp hp cc ng dng nhn trong GNOME hoc nhng ng dng khc. Chng ny gii thiu cc C-tiu dng thng dng nht v b iu khin trung tm GNOME c th bao gm nhiu C-tiu dng hn v iu ph thuc vo nhng ng dng c thit t trn h thng. B iu khin trung tm GNOME c chia thnh hai mc chnh l menu cc C-tiu dng c th cu hnh v khng gian lm vic chnh. lm vic vi B iu khin trung tm GNOME, ch vic chn mt C-tiu dng t menu bn tri v kch chut vo n. Mi ln la chn, khng gian lm vic s thay i, cho php cu hnh cc mc.

Hnh 10.1 Mn hnh B iu khin trung tm GNOME

chy B iu khin trung tm GNOME, m khng chn bt k mt C-tiu dng c bit no, hy chn mc con Trung tm iu khin GNOME t mc H thng/Cu hnh h thng trong menu chnh. Cho php khi ng mt C-tiu dng bng cch chn n t menu cc C-tiu dng c th cu hnh v sau son tho chnh C-tiu dng ny. 10.2 Nhm C-tiu dng mn hnh 10.2.1 Cc C-tiu dng thuc tnh nn Hnh 10.2 trnh by mt s ni dung v vic la chn thuc tnh nn mn hnh. Cho php chn nn ca vng mn hnh hoc l mt mu nn ng nht hoc l mt hnh nh no . Khi chn nn mt mu ng nht, c th la chn mu nn l n sc (Soild) hoc giao thoa gia hai mu (Gradient). Khi chn kiu giao thoa hai mu Gradient, c th chn kiu giao thoa theo chiu dc hoc kiu giao thoa theo chiu ngang. Khi chn kiu nn l mt hnh nh, cho php tm mt tp tin nh lm nn bng cch s
Trang 81

KC-06-03CN

Hng dn s dng Giao din ha GNOME

dng nt Duyt. Khi tm chn c mt nh nn, cn phi quyt nh v vic hnh nh c tri u trn mn hnh (nt So le), c t ng tm (nt Chnh gia), phng to nh nhng gi nguyn kh nh hay phng to nh theo kch thc mn hnh. Khi chn thay i nhng thuc tnh nn xong, c th nhn nt Th ti y ca mn hnh B iu khin trung tm thc hin thay i. Nu mun thit t li nn theo mt cch khc, c th v hiu ha C-tiu dng ny bng cch chn mc chn B la chn mn hnh nn.

Hnh 10.2 C-tiu dng nhng thuc tnh nn

10.2.2. C-tiu dng v ch bo v mn hnh Trong C-tiu dng ny c th thay i nhng thuc tnh ca ch ngh mn hnh trong GNOME. C-tiu dng ny cha mt danh sch cc ch ngh mn hnh sn c v mt mn hnh demo. Di hai hp thoi ny l mt tp hp nhng cng c cho php thay i nhng thit t cho cc thuc tnh chung ca ch ngh mn hnh (hnh 10.3). Nu thch thit lp nhng ch ngh mn hnh ring, hy nhn nt Thit lp ngu nhin bn di danh sch Bo v mn hnh.

Trang 82

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Cc thit lp bo v mn hnh - Trong mc ny, C-tiu dng cho php thay i thi gian, mt khu, v nhng thuc tnh qun l ngun in ca mn hnh. Hp Bt u sau: Ngi dng c th quyt nh ch ngh mn hnh s phi ch bao lu trc khi bt u bng cch nhp s pht vo hp. Nt Yu cu mt khu: t ch yu cu mt khu khi quay tr li mn hnh. Mt khu ng nhp ca ngi dng l mt khu c thit lp cho ch ngh mn hnh. Hp Tt mn hnh: Cho php thit t thi gian ch tt mn hnh nh s dng tnh nng ngt ngun in mn hnh - nu mn hnh c h tr tnh nng ny (tnh t thi im bt u ngh mn hnh) bng cch nhp thi gian vo hp.

Hnh 10.5 Mn hnh C-tiu dng trnh qun l ca s

10.2.3 B chn kiu giao din ca s Cc C-tiu dng mn hnh theo mc La chn theme cho php la chn kiu giao din ca s GTK mun s dng (hnh 10.4). i km vi mi kiu giao din trong GTK l mt tp hp cc cng c cung cp nhng nt, thanh cun, hp chn ... cho cc ng dng. V vy hu ht cc ng dng GNOME s thay i b ngoi ca chng nu thay i kiu giao din. thay i giao din ca s, chn mt kiu t danh sch Cc Theme kh dng trn vng tri ca khng gian lm vic chnh. Nu chn T ng xem trc, s
Trang 83

KC-06-03CN

Hng dn s dng Giao din ha GNOME

thy kiu giao din trng nh th no trong ca s Xem trc bn di. Nhn nt Th y ca s b iu khin trung tm thit t kiu giao din c la chn.

Hnh 10.4 Mn hnh C-tiu dng kiu giao din ca s

C mt vi kiu giao din ca s c np cng vi GNOME khi ci t. Nu thch nhiu kiu giao din hn, c th tm trn Internet ti a ch http:// gtk.themes.org, v khi tm thy v ti xung mt kiu, hy nhn nt Ci theme mi thm mt kiu giao din mi. Tn ti mt trnh duyt tp tin cho php tm thy cc kiu giao din va mi ti xung. Nhng tp tin cha kiu giao din ca s c dng l tar.gz hoc .tgz (cn gi l tarball). Mi khi tm thy mt tp tin, nhn OK v GNOME s t ng ci t kiu giao din. Sau kiu giao din va c ci t xut hin trong danh sch Cc theme kh dng. Cc kiu giao din mi c bung vo th mc .themes, s c lit k trong ca s Cc theme kh dng khi khi ng b iu khin trung tm GNOME vo ln tip theo. thay i phng ch s dng trong kiu giao din hin thi, hy s dng hp kim Font ngi dng. Mt hp thoi chn phng s cho php la chn phng, kiu, v kch thc ca phng. 10.2.4. C-tiu dng trnh qun l ca s Nh c gii thiu, GNOME khng ph thuc vo bt k mt trnh qun l ca s no, do C-tiu dng ny cho php chn trnh qun l ca s mun s dng. C-tiu dng trnh qun l ca s khng xc nh nhng trnh qun l no c sn, nhng n cho php nh ngha chng l ci g, v chng u.C-tiu dng trnh qun l ca s c mt danh sch cc trnh qun l ca s m c th chn t (hnh 10.5). Trnh qun l ca s no ang s dng u c ch thch bi t Hin hnh. Nu mun thm mt trnh qun l ca s mi vo danh sch, c th n nt Thm. Hp thoi Thm trnh qun l ca s mi s xut hin (hnh 10.6).
Trang 84

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Trong hp thoi Thm trnh qun l ca s mi, c th xc nh tn ca trnh qun l ca s (Tn), lnh chy trnh qun l ca s (Lnh), v lnh a ra mi cng c cu hnh cho php trong trnh qun l ca s .

Hnh 10.6 Hp thoi Add New Window Manager

Nu bit r rng trnh qun l ca s l tng thch hon ton vi GNOME v c th c qun l theo phin lm vic, hy chn nt Trnh qun l ca s l phin qun l. Nu nh khng chc chn, cn phi nghin cu k ti liu v trnh qun l ca s. Nhn nt ng khi chc chn hoc nhn nt Hu b trong trng hp ngc li. Mi khi mt trnh qun l ca s c b sung th n s xut hin trong danh sch cc trnh qun l ca s. thay i thuc tnh ca mt trnh qun l ca s c thit lp trong hp thoi Thm trnh qun l ca s mi, chn trnh qun l ca s t danh sch v nhn nt Hiu chnh. Cho php xa mt trnh qun l ca s trn danh sch bi vic la chn n v nhn nt Xo. Nu mun thay i trnh qun l ca s hin thi, hy chn trnh qun l t danh sch chnh v nhn nt Th.

Trang 85

KC-06-03CN

Hng dn s dng Giao din ha GNOME

chy cc cng c cu hnh cho mt trnh qun l ca s, hy xc nh trnh qun l ca s mun nh hnh v nhn nt Chy cng c cu hnh cho <tn trnh qun l ca s>. 10.3 C-tiu dng trnh son tho ngm nh C-tiu dng son tho ngm nh cho php la chn trnh son tho (editor) ngm nh khi s dng GNOME. iu ny cho php cc ng dng, chng hn nh Trnh qun l tp tin, gi chnh xc trnh son tho khi m nhng tp tin lin quan n vic son tho. Tt c cc trnh son tho c sn u nm trong danh sch chn la (hnh 10.7). C-tiu dng ny tng t nh C-tiu dng kiu Mine nhng c s dng trong nhm cc ng dng nht nh. 10.4 Cc kiu iu khin tp tin (mc Cc kiu mime) Mime l t vit tt ca Multipurpose Internet Mail Extensions. Mime c pht trin trc ht cho php email c th c nhiu dng d liu khc nhau.

Ckiu

tiu dng Mine Hnh 10.8 Nhng kiu iu khin tp tin trong GNOME GNOME cho php xc nh cch m cc dng tp tin khc nhau (hnh 10.8). Trong GNOME c th xc nh c nhng kiu m tp tin (mime) nht nh theo bt k cch no m mun. V d, nu s dng tp tin .sgml thng xuyn v lun mun s dng Emacs son tho chng, c th xc lp kiu m tp tin .sgml l tp tin .sgml lun lun c m bi trnh son tho Emacs. thm mt kiu m tp tin mi, hy nhn nt Thm. Hp thoi Add New Mime
Trang 86

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Type xut hin cho thm mt kiu m tp tin mi. sa li mt kiu sn c, hy chn kiu cn sa v nhn nt Hiu chnh. Hp thoi Set Actions cho php xc nh biu tng cho kiu m tp tin, cc thao tc Open, View v Edit. 10.5. Nhm C-tiu dng a phng tin 10.5.1 C-tiu dng chung bn phm

Hnh 10.9 C-tiu dng chung bn phm

C-tiu dng chung bn phm cho php thay i m thanh pht ra t CPU khi c mt li bn phm hoc c thng bo cn gi. m lng - cho php thay i cng thc t ca ting chung. Tn s - cho php thay i cao ca ting chung, ngm nh l 440Hz Thi gian - cho php thay i trng ca m thanh c pht ra. Kim tra - cho php nghe th ting chung bn phm hin thi. 10.5.2 C-tiu dng m thanh C-tiu dng m thanh cho php thit t m thanh h thng cho nhng phin lm vic ca GNOME. C hai kiu la chn C-tiu dng m thanh l Chung v m thanh cc s kin (hnh 10.10).

Trang 87

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Hnh 1010 C-tiu dng m thanh

Chung - c hai ty chn trong Chung l m thanh cho GNOME v cho nhng s kin. chn khi ng m thanh server, ngi dng phi chc chn rng thit b m thanh ca GNOME (ESD) c chy trong mi phin lm vic ca GNOME. Chn la m thanh cho cc s kin cho php tp tin m thanh thit t trong m thanh cho cc s kin cho mt s kin, s c chy khi s kin xy ra thc s. Hai la chn ny cho php qun l c cc phin lm vic ca GNOME v lu gi m thanh thit t d ng nhp hay thot ra ngoi. m thanh cho cc s kin - La chn ny cho php xc nh m thanh cho mi s kin trong GNOME hoc thay i nhng m thanh (hnh 10.10). thit lp mt m thanh cho mt s kin trong GNOME, hy chn s kin trong danh sch phn cp bn tri v nhn nt Duyt tm tp tin m thanh mun thit t. Khi chn c tp tin m thanh, hy nhn nt Chi kim tra m thanh. 10.6 Nhm C-tiu dng thit b ngoi vi Cc C-tiu dng trong nhm ny ca b iu khin trung tm cho php cu hnh cc thit b phn cng bao gm bn phm v chut. 10.6.1 C-tiu dng thuc tnh bn phm C hai s thit t ng thi cho bn phm trong C-tiu dng ny. Cho php thay i nhng thuc tnh qua hai mc con T ng lp v Keyboard Click (hnh 10.11).
Trang 88

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Hnh 10.11 C-tiu dng thuc tnh bn phm

T ng lp - Cho php khi gi mt phm th lp k t ca phm theo mt nhp v tr c thit t trong C-tiu dng ny. Keyboard Click - Cho php pht ra mt m thanh nh khi nhn mi phm. 10.6.2 C-tiu dng thuc tnh chut C-tiu dng nhng thuc tnh chut cho php tro i nt chut tri v nt chut phi v xc nh nhng thuc tnh Cc nt chut v Hnh ng chut (hnh 10.12).

Hnh 10.12 C-tiu dng thuc tnh chut


Trang 89

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Bn tri v Bn phi: Hai nt bt loi tr nhau ny cho php chn hoc nt chut tri hoc nt chut phi lm nt kch chn mc. Tng tc - Cho php thay i tc di trn mn hnh ca chut theo t l vi di chuyn chut bn ngoi. Threshold - Cho php thit t tc di chuyn ca chut ti thi im bt u di chuyn, trc khi thc hin gia tc c xc nh theo Tng tc. 10.7 C-tiu dng trnh qun l phin lm vic v trnh qun l phin lm vic 10.7.1. C-tiu dng trnh qun l phin lm vic C-tiu dng qun l phin lm vic cho php ngi dng iu khin trnh qun l phin lm vic (the GNOME Session Management). Trnh qun l phin lm vic bao gm nhng chng trnh khi ng khi ng nhp, lu cc yu cu GNOME ca ngi dng mt cch t ng hoc thi im khng nh ra khi GNOME. Cc la chn sau y c a ra (hnh 10.13):

Hnh 10.13 C-tiu dng qun l phin lm vic

Nhc khi logout - Nt ny cho php b qua hp thoi xc nhn khi thot ra khi GNOME. T ng ghi cc thay i cho phin - Nt ny cho php trnh qun l phin lm vic lun lu li nhng thay i ca phin lm vic trong GNOME khi mun ra ngoi. Nu ty chn ny khng thit lp, ngi dng vn yu cu c GNOME lu li cc thay i trong phin khi xc nhn trong hp thoi ra khi phin. Non-session-managed Startup Programs- Vng ny cho php khi to cc ng dng khng c qun l theo phin lm vic (non- session managed applications) bt c khi no chy GNOME.

Trang 90

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Lu : Nhng chng trnh khng tng thch vi GNOME th khng c qun l v nh vy s khng c khi ng li nu khng c lit k tu chn ny. b sung mt chng trnh mi vo Non-sessionmanaged Startup Programs nhn vo nt Add. Mt hp thoi n gin s hin ln cho php ch r lnh a ra ng dng v quyn u tin no m ng dng s nhn. Quyn u tin cho a s cc ng dng u bt u l 50. Nu c mt ng dng m cn khi ng trc nhng ng dng khc, ging nh trnh qun l ca s th cn phi t quyn u tin l mt s nh hn. Ty chn ny dnh cho nhng ngi dng thnh tho. Nu cha quen thuc vi Quyn u tin, cn phi gi nhng ng dng chy vi mt quyn u tin l 50. Duyt cc chng trnh ang chy hin hnh - Cho php xem nhng ng dng ang chy. C th ng nhng ng dng nu mun v nhng ng dng ny s c loi b t phin GNOME. Nhng ng dng trong danh sch ny phn ln l nhng ng dng mc cao hn v khng cn ng. Tuy nhin, nu ngi dng khng mun chy mt b phn ca GNOME, nh Thanh-GNOME chng hn, th nn ng n ngay v ngn n t khi khi ng n khi GNOME bt u chy. Lu : Ty chn ny ch dnh cho nhng ngi dng thnh tho. Khng nn s dng cng c ny ng nhng ng dng mun s dng cho ln ng nhp vo GNOME tip theo. 10.7.2 Trnh qun l phin lm vic A. Li gii thiu Cc phn trc y gii thiu s b v qu trnh qun l phin lm vic (session management) trong GNOME. Vic qun l cc phin lm vic l mt cng c rt hu ch khi s dng GNOME v cc ng dng ca n. Mt ni dung chnh ca vic qun l cc phin lm vic l lu tr cng vic mi khi thot ra khi GNOME. iu chng ta quan tm l phin lm vic trong GNOME s c lu ngay sau khi thot ra khi GNOME m khng cn quan tm xem n c lu nh th no.
Trang 91

Hnh 10.14. Mn hnh ng nhp phc hi phin lm vic

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Mt trong nhng c tnh hu ch nht ca vic qun l phin lm vic l kh nng khi ng li nhng ng dng m trc khi thot khi GNOME. Ngi dng s thy nhng ng dng xut hin li trong cng v tr trn mn hnh nh lc trc khi thot ra ngoi. Nu c nhng ng dng nht nh m mun khi ng bt c khi no ng nhp, d chng khng c m ti phin lm vic cui cng, c th thm chng vo C-tiu dng trnh qun l phin. Lu : Khi ni v vic qun l cc ng dng d liu, th tc l ni v tng lai ca GNOME. lu tr chnh xc cc ng dng d liu, phi s dng mt ng dng GNOME hon ton tng thch. Vo thi im ny, cha c bt k mt trnh qun l phin lm vic no m bo mt cch y s an ton d liu ca ngi dng. Cng c mt vi trnh c coi l nh vy nhng nn cn thn v kh nng ca chng v v vy khng nn s dng trnh qun l phin lm vic lu d liu trong cc ng dng. B. Thit t li GNOME Session Mt c tnh tt ca trnh qun l phin lm vic trong GNOME (GNOME Session Manager) l kh nng phc hi c mt phin lm vic sch (clean session) khi c mt li no xy ra. lm iu ny phi gi ng thi hai phm CTRL v SHIFT khi ng nhp vo GNOME. Mt hp thoi c hin ra vi hai tu chn khc nhau khi phc li cc phin lm vic ca GNOME. Ty chn u tin l Start with default program cho php loi b tt c thit lp cu hnh cho phin lm vic lin quan n cc ng dng. Ch xa b d liu trn cc ng dng ang chy khi thot ra khi GNOME m khng thay i bt k thng tin no c thit lp trong C-tiu dng trnh qun l phin lm vic ca B iu khin trung tm GNOME. Ty chn th hai l Reset all user settings cho php thit lp li tt c cc ng dng GNOME, v cc thng tin v cu hnh. N s ph hy bt k nhng cu hnh no to trn Thanh-GNOME, Trnh qun l tp tin, C-tiu dng trnh qun l phin v bt k ng dng GNOME no. Ty chn ny s khng loi b nhng tp tin trn mn hnh. Lu : Nhng ty chn ny dnh cho nhng ngi dng thnh tho v ch c s dng trong trng hp c vn vi trnh qun l phin. C th mt d liu cho nhiu ng dng nu s dng tnh nng hot ng do nhng ty chn ny cung cp. 10.8. Nhm C-tiu dung giao din ngi dng Nhm C-tiu dng giao din ngi dng cho php thay i cch xut hin ca nhng ng dng tng thch vi GNOME. C th nhn bit c nhng ng dng c ci t trc cng vi GNOME hoc nhng ng dng c xy dng bng GTK (GIMP Toolkit).

Trang 92

KC-06-03CN

Hng dn s dng Giao din ha GNOME

10.8.1 C-tiu dng v ngm nh trong ng dng

Hnh 10.15. Nhng mc nh trong ng dng Capplet

Cc C-tiu dng ngm nh trong ng dng (Capplets Application Defaults) cho php thay i nhng kha cnh giao din ngi dng nht nh ca cc ng dng tng thch vi GNOME. C-tiu dng ny c cc la chn sau y: C th g b v xo cc menu - Nt bt/tt cho php ngm nh nhng thanh menu trong cc ng dng ca GNOME c th c m ra t v tr thng thng ca chng v c t bt c ni no ngay trong ng dng hoc trn mn hnh. Cc menu c gc ni - Nt bt/tt cho php ngm nh nhng thanh menu khng c vin bao quanh. Cc menu c th tt - Nhng menu con c cc hng nt t bn trong cho php a chng ra bn ngoi trn mt ca s nh ring bit. Cc mc menu c biu tng - Nt bt/tt cho php mt s mc menu trong nhng ng dng c dng l nhng biu tng. Thanh cng c tng tc khi c th - Nt bt/tt. Mt s ng dng c cc thanh trng thi ti y ca s v ring bit vi ca s chnh ca ng dng ny. Nu thch nhng ng dng tch thanh trng thi vo bn trong mt ca s khc, c th bt ty chn ny. Thc qu trnh trng thi nm bn phi - Nt bt/tt. Trong mt s ng dng, khi thc hin mt thao tc no s c mt thanh hin th tin trnh ca thao tc (progress meter) trn thanh trng thi ca chng. Ngm nh l bt nt ny cho php nhng thanh hin th nm pha bn phi ca thanh trng thi. C th xo b v g thanh cng c - Cho php ngm nh nhng thanh cng c trong cc ng dng ca GNOME c m t v tr thng thng ca chng v c t bt c u bn trong ng dng hoc trn mn hnh. Nu khng mun s dng c tnh ny, c th tt n.
Trang 93

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Cc thanh cng c c gc ni - Cho php ngm nh nhng thanh cng c khng c vin xung quanh, cng c th tt c tnh ny. Cc nt thanh cng c c gc ni - Nt bt/tt cho php ngm nh nhng nt trn thanh cng c trng thi t nhin l khng c vin xung quanh, tuy nhin chng s c vin khi di chut qua chng. Nu mun chng khng c vin trong mi thi im, hy bt tnh nng ny ln. Cc thanh cng c c ng chia i - Mc nh cc nt trn thanh cng c c nhng dng k ngn cch gia chng. Nu khng mun nhng dng k , hy tt tnh nng ny i. Cc thanh cng c c cc nhn vn bn - Mc nh nhng nt trn thanh cng c c nhng hnh nh v dng ch thch xc nh chng. Nu quen thuc vi cc nt v khng cn n dng ch thch, c th tt c tnh ny. 10.8.2 C-tiu dng hp thoi C-tiu dng nhng hp thoi s gip thay i nhng gi tr mc nh c thit t cho hp thoi trong cc ng dng tng thch vi GNOME. Hp thoi l mt ca s c a ra bi mt ng dng nhm h tr thc hin mt cng vic no cn thit cho ng dng. V d, hp thoi Print s xut hin khi nhn nt Print cho php thit t nhng ty chn cho vic in n v khi ng qu trnh in.

Hnh 10.16 C-tiu dng Hi thoi

C nhng ty chn sau trong hp thoi C-tiu dng ny: Cc nt hp thoi - La chn s dng cc nt mc nh, t cc nt trn cc vin, cn tri v t cc nt bn tri, cn phi v t cc nt bn phi ... Cc nt hp thoi c biu tng - Mt vi nt hi thoi (v d OK) c th c cc biu tng trn chng (ngm nh nhng ng dng cung cp cc biu tng c bt). Nu khng thch, c th tt c tnh ny. Dng thanh trng thi thay hp thoi khi c th - C nhng ng dng cho php s dng thanh trng thi thay v mt hp thoi. Cc ng
Trang 94

KC-06-03CN

Hng dn s dng Giao din ha GNOME

dng trn s s dng nhng hp thoi cung cp thng tin khi c yu cu tng tc no v pha ngi dng. V tr hp thoi - Cho php la chn cch thc xut hin ca cc hp thoi khi c s dng, hoc l t hp thoi chnh gia mn hnh, hoc th chng ti v tr tr chut (c th trnh qun l ca s quyt nh thay hoc chnh ngi dng t nh ngha n khi cu hnh ca trnh qun l ca s). Cc mo hp thoi - C th thit t cc ch thch cho hp thoi ch gii (tooltip) xut hin khi chut di qua mt nt hoc b phn ca hp thoi. C th chn nhng ch thch c iu khin nh nhng ca s khc, hoc cho trnh qun l ca s quyt nh cch hin th chng. Thay cc hp thoi trn ca s ng dng khi c th - Cho php t hp thoi qua nhng ng dng khi c th, iu ny s gip gi nguyn cch thc t chc ca s trn mn hnh. Nu quen dng nhng h iu hnh khc, c th mun gi la chn ny nh theo cch cc h iu hnh khc iu khin nhng hp thoi. 10.8.3 C-tiu dng MDI MDI l t vit tt ca Multiple Document Interface (Giao din ti liu phc hp). C-tiu dng MDI cho php thay i ch MDI cho nhng ng dng GNOME. MDI a ra cch thc lm sao hin th nhiu ti liu hn trong nhng ng dng GNOME.

Hnh 10.17 C-tiu dng MDI

Kiu mc nh ca MDI trong cc ng dng GNOME thng thng l nhng nhn hoc notebooks. Cc mc di y cho php ngi dng thay i cc nhn . Default MDI Mode - Ngoi Notebook, cn c cc nhn Toplevel v Modal. Notebook l kiu nhn mc nh, Toplevel hin th cc ti liu c kch hot trn nh cho n khi n c ng,
Trang 95

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Modal ch c mt toplevel c th cha ng bt k ti liu no vo bt k mt thi gian no, tuy nhin ch c duy nht mt ti liu c hin th. Nu tng s dng Emacs Modal th iu ny tng t nh cch m Emacs iu khin nhng b m. MDI notebook tab position - Nu chn s dng kiu Notebook, c th quyt nh v tr (left, right, top, bottom) cc nhn xut hin trong nhng ng dng ca mnh. C th t chng ti bn tri, bn phi, nh, hoc ti y cc ng dng.

Trang 96

KC-06-03CN

Hng dn s dng Giao din ha GNOME

chng 11. Tng quan v h thng X Window

H thng X window (di y vit l X Window System) l h thng h tr giao din ha cho cc my tnh chy UNIX ni chung. N c thit k a n cho ngi s dng mt mi trng giao tip ha vi h thng cc ca s, biu tng... nhm to ra cch thc thao tc d dng hn vi my tnh cho ngi s dng, trn ton b h thng my tnh. X Window System ban u c thit k bi Hc vin cng ngh Massachuset (MIT) vo nhng nm 1980, sau hng X Consortium Inc. thc hin nghin cu, pht trin X Window System trong mt thi gian, v hin nay X Window System vn l nhn hiu thng mi ca h. Tuy nhin theo mt s ngun tin gn y, X Window System c chuyn cho t chc Open Source Software tip tc pht trin. Khng nh mt s h iu hnh khc l tch hp cht ch giao din ha ngi dng vi h iu hnh, X Window System l mt h thng c lp vi h iu hnh, do vn ci t, bo tr v nng cp l ring r v d dng hn. Mt khc X Window System hot ng trn phm vi rng (trn ton h thng mng), vi cc my tnh rt khc nhau v chng loi phn cng cng nh phn mm (h iu hnh)... v c bit c mt s phin bn ca X Window tun theo tha thun bn quyn ca GNU (v d XFree86) nn vic pht trin n cng ngy cng tr nn d dng. n thi im hin nay, X Window ch cn li l mt chun thit k, mt ci tn chung nh UNIX. 11.1. Kin trc ca X Window System X Window System c thit k theo kin trc client-server, m theo X Window server l mt phn m nh gn, c tnh n nh cao, m nhim vic cu hnh v giao tip vi cc thit b phn cng c lin quan n vic hin th ha nh thit b mouse, keyboard, video card, monitor, v my in trong mi trng ha (cc driver modules).v.v.. N s tip nhn cc yu cu v ha nh hin th cc hnh nh (bit4map), hin th cc khung ca s, cc ng v ho (graphic), cc on vn bn vi cc kiu font ch khc nhau (thc ra vic hin th font cn do mt chng trnh khc m nhim: X font server, c cp n trong mt phn ring di y).., cng nh cc yu cu v input nh nhp d liu, hay tip nhn cc c nhn chut. Cc yu cu ny do cc X client l cc chng trnh ng dng gi n t nhiu ngun, c th l trn cng mt my tnh, hoc trn cc my tnh khc trn mng. M cng v vy, n h tr rt nhiu knh truyn thng nhm trao i thng tin vi cc X client. Trn c h thng my tnh c th c mt hoc nhiu X server, v trn mt my tnh cng c th c mt hoc nhiu X server. Tuy nhin, thng thng, trn cc trm lm vic u c ci X server nhm em n mt kh nng hin th ha nhanh chng (phn cng h tr hin th ha gi y cng khng cn l vn ln). Do X khng c giao din chun - khng c mt chun quy nh v hnh dng, kch c.. cc i tng ha nh khung ca s, thanh cun, nt lnh... cc cch thc tip nhn s kin.v.v.. nn khi cc X client yu cu hin th, n cn cn ti s gip ca mt
Trang 97

KC-06-03CN

Hng dn s dng Giao din ha GNOME

chng trnh gi l window manger. Chng trnh ny m nhn li vic yu cu hin th theo mt chun giao din m n ra, chnh v vy m c rt nhiu cc chun giao din khc nhau cng tn ti trn mt h thng X. Thm ch, vi mi mt window manager li c km theo mt hoc nhiu kiu giao din khc nhau gi l cc b chn kiu giao din (theme). Thit b hin th 1 (monitor, mouse, keyboard..)

X client 1

X client 2

Thit b hin th 2 (monitor, mouse, keyboard..)

X server 1

X server 2 My in H iu hnh, cc driver thit b (trn mt hoc nhiu trm lm vic)

Hnh 11.1. M hnh kin trc ca X Window System

C nhiu kin khc nhau v v tr ca window manager trong biu trn, c quan im cho rng trnh qun l mn hnh nh mt client c lp ca X server (ngang hng vi cc chng trnh ng dng), cn quan im khc li cho rng trnh qun l mn hnh nm gia cc chng trnh ng dng v X server. Quan im ph dng cho rng trnh qun l mn hnh l client trc tip ca X server, cc chng trnh ng dng phi thng qua n chuyn yu cu v nhn yu cu. Phn v trnh qun l mn hnh cng c cp n chi tit hn cc on sau. 11.2. Cc chng trnh v tin ch c bn i km X Window System Nu thng k cc ng dng chy cn c X th s l mt con s v cng ln, cha k cc tin ch gip cu hnh X server .v.v.. Do vy, chng ti ch cp n mt s tin ch c bn theo ngha l lun i km X Window System trong cc bn phn phi ca n (thc t mi ch l cc tin ch i km vi XFree86 Version 11 Release 6). XFree86 V11 R6 c cc thnh phn c bn sau: Phn li : X server (c coi nh l cc driver iu khin hin th ha). xfs (X font server): qun l ti nguyn font. xdm (X display manager): qun l vic ng nhp h thng cho
Trang 98

KC-06-03CN

Hng dn s dng Giao din ha GNOME

cc trm lm vic c X Window. xinit: khi to X khi h thng khi ng. xterm: m phng mt console cho thao tc h thng ti du nhc h v trong mi trng X (terminal emulator for X Window). Cc c s d liu h tr a ngn ng. Cc chng trnh qun l vic truy cp, qun l mail, my in, keyboard nh xkeyboard, xprint, ... Cc font ch theo cc bng m ISO8859-1..., nhiu nh dng (format) khc nhau, c fixed (pcf) v scalable font (Type1..) Cc th vin h tr cho lp trnh ... Cc molule h tr phn cng cho cc loi card mn hnh, cc thng tin v cc loi mn hnh, bn phm, chut my tnh, my in... Cc cng c cu hnh phn cng nh Xconfigurator, XF86Setup,... V cn rt nhiu thnh phn khc (nu ch in ring index ca cc chng trnh cng c th ln ti nhiu trang). Ngoi ra ngi dng c thoi mi trong vic thao tc vi cc ca s ca cc ng dng, h thng cn cn thm mt trnh qun l ca s. 11.3. Mt s khi nim 11.3.1 Tn hin th (display name): Mi X server c mt ci tn, gi l tn hin th, theo khun dng sau :
hostname:displaynumber.screennumber

Tn hin th ny c cc chng trnh ng dng dng gi X server, ng thi cung cp thng tin cho X server bit n cn hin th mn hnh no trong trng hp c nhiu mn hnh. hostname: Tn h thng m X server chy, nu tn ny khng c chng trnh ng dng a ra th ngm nh l X client v X server chy trn cng mt h thng (localhost). Tn ny l mt tn my tnh theo quy c ca UNIX: mt a ch IP hay mt domain name. displaynumber: Thut ng display y phi hiu l mt b cc thit b mn hnh, bn phm, con chut ... nhm hin th kt qu cho ngi dng v gip ngi dng nhp d liu. Trn cc my tnh PC, thng thng ch c mt display, nhng trn cc h thng a ngi dng ln, mt my tnh c th c nhiu display, cho nhiu ngi dng s dng cng lc. Mi display c gn mt con s (bt u t 0). y l thng tin khng th thiu trong displayname. screennumber: Trn mi display, c th c hai hoc nhiu mn hnh (multimonitor) cng hin th mt lc, chia s mt bn phm, con chut. Mi mn hnh s c nh s, t s 0. Theo chun POSIX, tn hin th ngm nh thng c t trong bin mi trng DISPLAY, bin ny c khi to trc phin lm vic X. Tuy nhin nu mun dng X server trn mt h thng t xa, chnh ngi dng phi t li bin ny. Nh hin
Trang 99

KC-06-03CN

Hng dn s dng Giao din ha GNOME

nay, a s cc chng trnh chy trn X u cho php a vo tham s displayname thay cho gi tr ngm nh. 11.3.2. iu khin truy cp (access control) X server s dng mt vi kiu iu khin truy cp nh Host Access, MIT-MAGICCOOKIE-1, XDM-AUTHORIZATION, SUN-DES1, MIT-KERBEROS-5, XDM s khi to cc iu khin truy cp cho X server, ng thi t cc thng tin v quyn truy cp trong mt tp tin m ngi dng c th xem c (tp tin .Xauthority trong th mc ch ca ngi s dng). Trong c danh sch cc host c quyn kt ni ti X server, nhng thng thng nn trng mt X client no c quyn truy cp r rng mi c th kt ni ti b phn iu khin c (thm mt host vo danh sch ny dng chng trnh xhost). 11.3.3. Cc c tnh v hnh hc (geometry specifications): Mc d v tr v kch thc ca ca s ng dng c chng trnh qun l ca s m nhim nhng hu ht cc chng trnh ng dng chy trong X u c tham s v kch thc, v tr hin th trn mn hnh, nhng tham s gi l cc c tnh hnh hc. Mt mu v chui tham s c quy nh nh sau : -geometry WIDTHxHEIGHT+XOFF+YOFF WIDTHxHEIGHT l hai con s ch kch thc ca ca s ng dng (chiu rng & chiu cao), tnh bng pixel. XOFF/-XOFF l con s ch khong cch gia mp tri/phi ca s ng dng vi bin tri/phi ca mn hnh. YOFF/-YOFF l con s ch khong cch gia mp trn/di ca s ng dng vi bin trn/di ca mn hnh. Tham s ny ch l mt cp gm hai s, v d +XOFF+YOFF hoc +XOFF-YOFF hoc -XOFF-YOFF ... Nu cc tham s ny c gi km chng trnh ng dng th iu c tc dng b qua s qun l ca trnh qun l ca s v kch thc v v tr. Ngoi ra cn c rt nhiu tham s tu chn khc khi khi ng X server nh cung cp c s d liu v mu (rgb database) cc thng tin v host, thng tin v quyn truy cp, thng tin v phn gii, chi tit xin xem trang man v X server... Nh trn ni, vic qun l trc tip cc ca s thuc v nhim v ca chng trnh window manager, do vy m trong mi trng X Window c rt nhiu kiu giao din khc nhau. Mi kiu giao din c cch hin th cc ca s ring, cch thc getfocus ring, hnh dng v din mo cc i tng ha hon ton khc nhau... Mt s trnh qun l ca s hay c dng trong Linux l twm, fvwm, afterstep, sawmill, enlightenment. Trong cc bn phn phi Linux hin nay, khng ch c X Window System m cn km theo cc chng trnh nhm to mt mi trng giao din thng nht nh KDE, GNOME.. cc chng trnh ny cng vi X Window lm thnh mt h giao din ha hon chnh, thng nht.. Phn sau y s gii thiu v mt s thnh phn c bn ca Window System nh xdm, X font server, xterm.
Trang 100

KC-06-03CN

Hng dn s dng Giao din ha GNOME

11.4. Chng trnh qun l hin th (X display manager) XDM - X Display Manager, theo mt cch hiu no t pha ngi dng, th n l mt chng trnh dng ng nhp h thng trong mi trng ha. Mi trng ha X Window c th c khi to theo hai cch: ng nhp h thng xong mi khi ng X, theo cch ny, ti du nhc h thng, ngi dng c th dng lnh startx khi ng vo mi trng ha. X c t ng khi ng khi h thng khi ng, theo cch ny, trong tp tin /etc/inittab s c nhng ch nh v cp chy (runlevel) ngm nh thch hp, trong c mt lnh chy xdm. Trong cc h thng c nhiu chng trnh xdm khc nhau (nh vi RedHat Linux 6.2, n c xdm, gdm, kdm cng lm mt chc nng tng t nhau), mt shell script s c chy trc chn chng trnh (predm), xdm s khi ng X server, xc lp mt s thng tin mi trng lin quan, chy chng trnh qun l ca s ngi dng (twm, sawmill hoc enlightenment...). 11.4.1. Hot ng ca XDM xdm khng ch l tin ch cung cp cho ngi dng kh nng ng nhp h thng trong mi trng ha m n cn khi to, qun l cc phin lm vic vi X (Xsession) ca mi ngi dng t cc my tnh khc trn mng. Khi lm vic vi mi trng X Window c rt nhiu nhng thng tin ring ca tng ngi dng c ghi li, v d nh trnh qun l ca s m h s dng, kiu nn desktop ang hin th, cc i tng trn Thanh-GNOME, trn desktop... cc thng tin c gi l cc thng tin ca mt Xsession. N c xdm khi to sau khi ngi dng ng nhp thnh cng. C hai phng thc ch yu ngi dng c th nhn c mt du nhc ng nhp h thng: X server query (X server yu cu) v XDM server managed (do chnh xdm qun l) X server query Truyn thng gia xdm v mt X server c th (mt trm lm vic c ci t X Window) c tun theo giao thc XDMCP - X Display Manager Control Protocol. iu ny cho php mt ngi dng c th ng nhp vo mt Xserver bt k bng cch gi mt thng tin n cho xdm ca Xserver , i loi nh: ti c mt ngi cn ng nhp vo Xserver ca bn, hy trao cho ti mt du nhc ng nhp. ng nhp kiu ny cng c mt trong ba hnh thc sau: Yu cu trc tip (direct query): Xserver yu cu s a ra mt ci tn hin th ca Xserver c yu cu, xdm ca Xserver c yu cu nu nhn c s gi tr li mt du nhc ng nhp trn chnh Xserver yu cu. Gi yu cu kiu pht thanh (broadcast): Xserver yu cu s gi mt yu cu ng nhp n cho ton b cc my tnh trn mng, my tnh no c xdm ang chy m nhn c thng tin u tin, n s gi du nhc ng nhp cho Xserver gi yu cu. Gi yu cu gin tip (indirect query): Xserver gi n mt my tnh no (thng qua mt hostname c th) mt yu cu v cc host c th ng nhp, my tnh ny tr li mt danh sch cc host nh vy v ch mt s la chn. Xserver yu cu s la chn mt trong s v my tnh nhn c yu cu s khi to mt kt ni cho Xserver vi my tnh cn ng nhp (bn thn n ch lm trung gian). My tnh th 3 kia s gi mt du nhc ng nhp n cho Xserver yu cu ban u.
Trang 101

KC-06-03CN

Hng dn s dng Giao din ha GNOME

ng nhp do XDM qun l Trong trng hp h thng gm mt server ng dng (application server) cng lm vic vi cc trm cui (c th c a cng hoc khng). Th mi thao tc thc t c chy trn server ng dng. Mi trm cui s gi yu ng nhp n server ng dng v server ny thng qua xdm s khi to mt mi trng X trm cui v cung cp mt du nhc ng nhp h thng cho ngi dng pha trm cui. lm c iu ny, ngoi vic t cc kt ni vt l v cc kt ni logic mc h iu hnh, Xserver trn server ng dng cn phi c thm mt danh sch v cc host cn kt ni (trong trng hp ny l danh sch cc trm cui). Cc thng tin v phn cng hin th (bao gm c mouse, keyboard v monitor...) ca cc trm cui cng cn c Xserver lu tr hin th ha c ng n ti cc trm cui. 11.4.2. Cc tp tin cu hnh ca XDM /etc/X11/xdm/xdm-config: tp tin ny lu tr ng dn ti cc tp tin cu hnh khc v mt s thng tin v quyn truy cp c bn. i khi tp tin ny cng gi mt s script thi hnh lc khi ng X (startup script). Mt tp tin xdm-config in hnh nh sau:
DisplayManager.errorLogFile: /var/log/xdm-error.log DisplayManager.pidFile: DisplayManager.keyFile: DisplayManager.servers: /var/run/xdm.pid /etc/X11/xdm/xdm-keys /etc/X11/xdm/Xservers

DisplayManager.accessFile: /etc/X11/xdm/Xaccess DisplayManager._0.authorize: true DisplayManager._1.authorize: true DisplayManager._0.setup: DisplayManager._0.reset: DisplayManager*session: /etc/X11/xdm/Xsetup_0 /etc/X11/xdm/TakeConsole /etc/X11/xdm/Xsession DisplayManager._0.startup: /etc/X11/xdm/GiveConsole DisplayManager*resources: /etc/X11/xdm/Xresources DisplayManager*authComplain: false DisplayManager.requestPort: 0

/etc/X11/xdm/Xaccess: m t cc host c th kt ni n xdm ca my tnh ny (tun theo giao thc XDMCP). Mt tp tin Xaccess v d nh sau: # Dng u tin cho kiu yu cu trc tip, ch c du * v phn sau b trng # ngha l mi my tnh u kt ni c, nu khng phi ch ra mt danh # sch
*

# Dng th hai cho kiu yu cu gin tip


* chooser broadcast

# chng trnh chooser s cho php la chn mt danh sch cc host kh d


Trang 102

KC-06-03CN

Hng dn s dng Giao din ha GNOME

# trn mng c th kt ni n c. /etc/X11/xdm/Xserver: m t v cc host m xdm trn my tnh ny s kt ni n cc host (ngc li vi tp tin trn). Mt tp tin Xserver v d nh sau: # Cho chnh my tnh ny
:0 local /usr/X11R6/bin/X

# Cho my tnh t xa # Tn theo a ch IP


192.168.2.204:0 foreign

# Tn theo hostname
elnino:0 foreign

/etc/X11/xdm/Xresources: m t cc thuc tnh X m xdm s dng (nh nn, mu sc, hp thoi...) khi ng nhp h thng. Mt tp tin Xresources v d nh sau:
xlogin*login.translations: #override\ Ctrl<Key>R: abort-display()\n\ <Key>F1: set-session-argument(failsafe) finish-field()\n\ Ctrl<Key>Return: set-session-argument(failsafe) finish-field()\n\ <Key>Return: set-session-argument() finish-field() xlogin*borderWidth: 3 xlogin*greeting: CLIENTHOST xlogin*namePrompt: login:\040 xlogin*fail: Login incorrect #ifdef COLOR xlogin*greetColor: CadetBlue xlogin*failColor: red *Foreground: black *Background: #fffff0 #else xlogin*Foreground: black xlogin*Background: white #endif XConsole.text.geometry: 480x130 XConsole.verbose: true XConsole*iconic: true XConsole*font: fixed Chooser*geometry: 700x500+300+200
Trang 103

KC-06-03CN Chooser*allowShellResize: false Chooser*viewport.forceBars: true

Hng dn s dng Giao din ha GNOME

Chooser*label.font: *-new century schoolbook-bold-i-normal-*-240-* Chooser*label.label: XDMCP Host Menu from CLIENTHOST Chooser*list.font: -*-*-medium-r-normal-*-*-230-*-*-c-*-iso8859-1 Chooser*Command.font: *-new century schoolbook-bold-r-normal-*-180-*

11.5. Tng quan v X font server Qun l v s dng ti nguyn font sao cho c hiu qu nht trn h thng UNIX c X Window l mt trong nhng cng vic rt phc tp m h thng phi m nhim. Nhu cu v hin th font cho cc ng dng l rt ln v lun khng ngng tng ln v chng loi font v cc bng m. Nu nh X server trc tip lm nhim v qun l font, np tt c ti nguyn font khi khi ng X th s gy ra nhng khuyt im sau: Tn b nh: V phi np tt c mi loi font vo b nh. Nhng nu khng np ht th X server s tn rt nhiu thi gian truy cp a c tp tin font khi c ng dng yu cu. Tn khng gian lu tr: V mi trm lm vic cn phi ci y cc loi font. Nu c mt nng cp no v khun dng font cn phi thay i li X server. V phi lm nh vy trn tt c cc trm lm vic. X server 1 X font server 1 X server 2 X font server 2 X server 3
Hnh 11.2. M hnh Client - Server i vi X font server

V nhng l do trn, ngi ta thit k b phn qun l font tch ring ra khi X server v gi l X font server. X font server s dng m hnh clientserver ging nh X p ng nhu cu v font ch cho cc ng dng c nhu cu. Theo , trn mt h thng, ti nguyn v font (v mt vt l chnh l cc tp tin font cha nhng thng tin cn thit gip trnh ng dng hin th mt tp cc k t no theo mt yu cu v ha nht nh) khng nht thit phi nm tp trung trn mt my ch hay mt trm lm vic no c, n c th c lu tr phn tn khp ni. Cc X font server s qun l chng v cung cp cho cc ng dng, v chng trnh yu cu font s l client. Cng mt lc c th c nhiu font server hot ng p ng cho mt client v cng c nhiu client yu cu mt X font server cung cp font theo yu cu. Client y chnh l X server (trnh ng dng i hi font thng qua X server).

Trang 104

KC-06-03CN

Hng dn s dng Giao din ha GNOME

X font server c cc tnh nng c bn sau: Qun l danh mc cc font (cataloguelist). Np cc font vo b nh cung cp cho cc ng dng. C chin lc lp cache (vng lu tr font ti b nh trong) v hy b font khi b nh khi khng cn thit mt cch thch hp. 11.5.1. Giao thc cho X font server v X font client V cc X font server c trn nhiu my tnh khc nhau nn mi lin h clientserver trn c thc hin cn phi c mt hoc mt s cc giao thc truyn thng. Cc giao thc c s dng trong trng hp ny l cc giao thc truyn thng chun c h tr trn UNIX nh TCP/IP. Trc khi mt yu cu v font ca font client c gi i, n cn phi thit lp mt knh truyn bng cch ch ra mt a ch ti font server c dng nh sau: tcp/<hostname>:<ipportnumber>[/cataloguelist] <hostname> l tn my tnh m X font server ang chy, tn ny c th l mt tn min (domain name) nh machine.com hoc a ch IP ca my tnh trn mng nh 192.168.2.200. <ipportnumber> l s hiu cng m font server dnh ring cho vic lng nghe cc yu cu kt ni. <cataloguelist> l mt danh sch v cc tp hp font cn yu cu. Font client
(X server)

network

font server 1
bdf pcf ttf atm f3 dwf ...

network

Font server 2
Hnh 11.3. Cc X font server hot ng trn mng

Trang 105

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Khi mt font client yu cu ti mt font server no , font server ny s tm trong cc catalogue ca mnh xem c font p ng khng, nu khng, n s yu cu mt font server khc p ng (font server ny c trong tp tin cu hnh di tn: ANTERNATESERVER). Cui cng, nu c font p ng, n s chuyn i cc d liu font t rt nhiu ngun khc nhau (v c nhiu nh dng khc nhau nh ttf, pcf, pfb... c h tr trn cng mt h thng X Window) v mt nh dng chung v gi d liu ny cho font client. Vic gi yu cu ca font client lun c font server kim tra thng tin chng thc v quyn thc thi. iu ny lin quan n tnh bo mt ca h thng, i khi mt chng trnh no do mt ngi dng no khng c quyn s dng mt s loi font nht nh trong ton b ti nguyn font. 11.5.2. Cu trc ca X font server X font server c 3 tng lm vic nh sau: OS layer Tng h iu hnh (Operating System font server Layer: OS Layer): L tng m nhim cc yu cu v truyn thng thng tin, xc lp cc knh truyn. N lng nghe cc yu cu ca font client, gi cc yu cu n cho tng DIFS, n cng m nhim vic truyn thng tin tr li ca cc font server cho cc font client. Tng h iu hnh cn qun l c vic cu hnh font server thng qua cc tp tin cu hnh hoc thng qua tham s dng lnh.

difs

renderer
Hnh 11.4. Cc tng ca

X font server

Tng c lp thit b (Device Independent font server Layer: DIFS Layer): Tip nhn cc yu cu n t tng OS, n s phn tch yu cu, kim tra tnh ng n ca yu cu, iu khin tng Renderer hot ng. N cng c cc chc nng nh chuyn i byte sang cc khun dng khc nhau (mt s h thng quy c byte theo khun dng big endian, mt s th li l little endian), hoc to mt b m lu tr (cache) cho cc font ang c dng. N cng chu trch nhim gi li mt yu cu cho cc font server khc p ng khi khng tm thy font cn thit. Tng trnh din (RENDERER Layer): L tng thp nht, n cha tt c cc c t v font tp tin nh cc thng tin header, cc thuc tnh ca font, cha mt b phn gi l phn t ng dn font FPE (font path element) lu tr cc ng dn ti cc th mc cha font cng vi cc tn font (hoc c th l b danh - alias name). N chu trch nhim c cc thng tin cn thit t font tp tin trn a v chuyn i v dng d liu cn thit gi vo ng truyn (i vi cc font thay i kch c c nh font Truetype, s c x l bc ny). 11.5.3. Hot ng ca X font server: X font server thng thng c khi ng khi bt my tnh, thng l mt shell script nh /etc/rc.d/init.d/xfs. N c tp tin cu hnh /etc/X11/fs/config xc nh cc thng s nh: client-limit: s lng ti a cc client kt ni n n (s nguyn). clone-self: thuc tnh logic xc nh xem font server c t nhn bn
Trang 106

KC-06-03CN

Hng dn s dng Giao din ha GNOME

khng khi n t ti gii hn (on, off). Khi font server p ng cng lc ht s client-limit, n s nhn bn sang mt tin trnh khc v tip tc p ng cc ng dng khc. alternate-servers: l danh sch tn cc server s c yu cu khi khng tm thy font thch hp (tn ny c dng a ch nh nu trn, cch nhau bi du ",") catalogue: mt chui xc nh cc th mc cha font. V d:
catalogue = /usr/X11R6/lib/X11/fonts/misc:unscaled, /usr/X11R6/lib/X11/fonts/75dpi:unscaled, /usr/X11R6/lib/X11/fonts/misc, /usr/X11R6/lib/X11/fonts/Type1, /usr/X11R6/lib/X11/fonts/Speedo, /usr/X11R6/lib/X11/fonts/75dpi, /usr/share/fonts/default/TrueType, /usr/share/fonts/default/Type1

default-point-size: l kch c ngm nh ca cc font ch khng ch nh kch c (khng phi loi fixed). n v l decipoint, thng c t l 120 (1 point = 10 decipoints). default-resolutions: l danh sch cc phn gii ngm nh m font server h tr. Danh sch ny c dng cho cc font loi scalable khng ch nh phn gii. phn gii l mt cp hai s nguyn x,y phn cch bi du ",". Cc cp cng cch nhau bi du ",". use-syslog: l gi tr logic xc nh xem cc thng bo li c c ghi li hay khng (on, off). Sau font server xc nh xem trong cc th mc cha font k trn c thm font mi no khng, nu c n s xy dng li danh sch font. Tip theo, font server xc lp cc thng s mi trng nh cc th mc temp, ln ca cache v khi to knh kt ni (IP port) tip nhn yu cu. Trong qu trnh hot ng khi mt font client yu cu m mt font hay yu cu danh sch cc font, font server phi cung cp cho FPE (Font Path Element - phn t ng dn font) mt ci tn font, tn font ny s c FPE tm kim, nu thy trong cc ng dn font, n s kim tra quyn truy cp. Nu tip tc thnh cng, font server s gi thng tin Success v to ra mt font ID gi cho font client m da vo font client s truy cp c ti d liu ca tp tin font . (Vic thc hin np font vo b nh do X font server qun l, n quyt nh c np hay khng v gii phng khi no, trnh tnh trng np cng mt tp tin font). Nu mt trong cc bc trn tht bi, font server s gi tr li thng tin Badfont cho font client (nu tht s sau khi tm kim tt c cc X font server m n c th truy cp c u khng tho mn).
Trang 107

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Khi mt font client b kt ni, tt c cc tham chiu ca n ti cc font ang c m s c xo b. Nu khng cn font client no dng n cc font ny na, font server s loi font ra khi b nh. Trong khi ang vn hnh, c th mt lc no font server khi ng li, khi n c thm cc ng dn font mi chng hn, hoc cn c li cc tp tin cu hnh, hoc gii phng vng m cache. iu ny c thao tc qua cc tn hiu (signal) hoc n gin dng lnh xfs restart. Khi c qu nhiu font client kt ni n mt font server lm gim ng k hiu sut ca h thng, font server c th t nhn bn ln thnh mt font server khc hot ng c lp. Khi yu cu gi t font client n s c phn phi cho c 2 font server. 11.6. X terminal emulator (xterm) M hnh truyn thng ca cc h thng UNIX l my tnh-trm cui (computerterminals). M hnh my tnh-trm cui cho php nhiu ngi t nhiu trm cui cc v tr khc nhau s dng ng thi mt my tnh. Nhng ti thi im cc trm cui l cc thit b c cu hnh rt thp hay ni ng hn l cc bn iu khin n thun, gm c mn hnh, bn phm, cc cng kt ni ..., khng c b nh. Cn vo thi im hin nay, hu ht cc my tnh u c cu hnh mnh hn rt nhiu, v cc "dumb terminal nh vy khng cn na. Nhng m hnh lm vic kiu nh trc vn cn c p dng. Vi cc my tnh chy X cng c mt phn mm m phng trm cui nh trn, cho php ngi dng thao tc nh ang lm vic trn cc trm cui vi chnh my tnh ca mnh hoc cc my tnh t xa thng qua telnet, rlogin... n gin l do phn mm to ra mt ca s, c du nhc h thng, cho php ngi dng dng lnh thao tc vi h thng. Nhng cn c mt s im v tnh tng thch vi cc trm cui truyn thng nh cc kiu VT102, Tektronix 4014 .v.v.. m cc chng trnh m phng ny cn p ng. i khi c mt s cc xterm h tr mt ngn ng v bn phm c th ca mt nc no nh kterm (kanji terminal) h tr xterm cho ngi Nht vi kiu ch cng Kanji, hoc vnterm cho ngi Vit nam.

Trang 108

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Hu ht cc phn mm nh vy u km theo rt nhiu tham s v v tr hin th, thanh tiu , mu sc ca ca s, nn, kiu font ch cho cc k t ...

font servers X Extension: -Printer extension -Keyboard extension -XIM Server -.....

X Server (card driver)

X display manager -xdm -gdm -kdm X Session manager

Graphic Destop Environment (GNOME, KDE, AnotherLevel)

gtk -tcl\tk -gdk..

X Window Manager -enlightenment -sawmill -twm -fvwm, fvwm2 -AfterStep -....

X Applications

Hnh 11.5. Quan h cc thnh phn trong h thng X Window

Quan h gia cc thnh phn ca ton b h thng X Window & Mi trng giao din c trnh by trong s hnh 11.5 trn y.

Trang 109

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Chng 12. thit t cu hnh cho X Window System

12.1. Thit lp cu hnh cho X bng chng trnh Xconfigurator nh Xconfigurator ch dng lnh s xut hin ca s gii thiu chng trnh, chn OK tip tc. Mn hnh xut hin bc ny s khc nhau tu thuc vo loi card mn hnh. Nu theo ch t nhn din th mn hnh s xut hin s ging nh hnh 1.2, ngc li chng ta nhn c mn hnh nh hnh 12.1.

Hnh 12.1. Mn hnh Xconfigurator

Dng u trong hp gii thiu ti hnh 12.1 cho bit thng tin v tn card (c trng hp l hng sn xut v chipset), dng th 2 l loi X server. Chn OK tip tc. Nu card mn hnh hoc l loi card c hoc l card mi nhng khng c trong c s d liu th chng trnh s a ra mt danh sch tn cc loi card c h tr (ly t tp tin Cards-hnh 12.2). Ngi dng cn phi chn tn card c trong my tnh. Nu card khng c trong danh sch th c th chn dng Unlisted cui cng (vic ny khng m bo l n s hot ng, tuy nhin trong mt s trng hp ci th nghim mt s loi card nh vy th vn thy X chy tt).

Hnh 12.2. Chn Card

Sau khi xc nh loi card, chn OK tip tc. Nu chn Unlisted th mt danh sch cc X server c a ra. Hy chn X server cho card hin c. Nhn OK tip tc.
Trang 110

KC-06-03CN

Hng dn s dng Giao din ha GNOME

n y s xut hin danh sch tn mn hnh c h tr (ly t tp tin tp tin /usr/X11R6/share/Xconfigurator/MonitorDB): Cn chn mt trong hai la chn c y: Hoc chn mt tn mn hnh hin c trong danh sch nu bit (chng hn, ADI MicroScan 17) sau n OK. La chn ny l rt quan trng gip cho qu trnh thit t thc hin nhanh. Bi v, nu khng bit tn mn hnh, ngi dng phi dng la chn Custom cung cp cc thng s cn thit cho mn hnh m iu ny khng th c m bo chnh xc.

Hnh 11.3. Thit t mn hnh

La chn Custom/OK. u tin chng trnh s a ra mt danh sch gm 12 loi mn hnh chun. phi bit mn hnh ca thuc loi no trong s la chn (cung cp tn s qut ngang cho mn hnh). Nu khng bit chnh xc c th ln lt th tng trng hp (mt la chn khng ng s cho php quay v chn li y l iu nn trnh bi v c th lm hng mn hnh khi cung cp tn s qu chnh lch). Thng thng nhm LinuxVN chn SVGA hoc VGA. Tip n, phi cung cp khong tn s qut dc cho mn hnh khi mt danh sch cc khong tn s xut hin (c bn khong la chn: 50-70, 50-90, 50100, 40-150). Thng thng nn chn tn s xut hin khong 50-70. Hnh 11.4. Chn t ng thng s Don't probe hoc Probe: Chn Probe/OK: Chng trnh probe t tm ra phn gii v su mu mc nh cho card mn hnh. Sau khi chn Probe v n Enter, ch mt lt s xut hin ca s: Back: Tr v chn li. Use Default: Chn thit lp mc nh. Let Me Choose: c th t mnh thit lp bng cch chn Let Me Choose, khi s xut hin danh sch su mu v phn gii m card mn hnh ca cung cp: Sau khi chn mt trong hai cch thc trn y, chng ta thy xut hin mt ca s cho php chn hoc

Trang 111

KC-06-03CN

Hng dn s dng Giao din ha GNOME

Hnh 11.5

Hy chn mt ch v n OK tip tc. Chn Don't probe: Vi la chn ny phi cung cp lng RAM, clockchip, phn gii, su mu cho card mn hnh (phi ch ra ng lng RAM v clockchip - hy chy lnh SuperProbe).

Hnh 11.6

n y, nu thnh cng chng trnh s th khi ng X kim tra v hi c mun


Trang 112

KC-06-03CN

Hng dn s dng Giao din ha GNOME

chy X khi khi ng khng. Cn khng (c ngha l chn sai mt thng s no ), s phi quay li thit lp cho ng. Sau khi kt thc, chng trnh Xconfigurator s ghi nhng thit lp ny vo tp tin XF86config. Nhng thit lp trc s b ghi ln. Nu mun gi nhng thit lp c th phi sao lu tp tin ny li trc khi chy Xconfigurator. 12.2. Cu trc tp tin /etc/X11/XF86config Trc ht ta tm hiu s qua v cu trc tp tin /etc/X11/XF86config. y l tp tin cha cu hnh ca X. Tp tin ny c chia thnh cc phn (c vit l Section) sau: files, module, server flags, keyboard, monitor, screen, device, Xinput. Section files: Section ny c s dng ch ra ng dn n cc tp tin font c dng cho h thng, n cc tp tin cha mu cho h thng (tp tin mu dng cho h thng thng l tp tin *. txt hoc tp tin *. db). Trong section ny c cc mc sau: FontPath pathname: Ch ra ng dn ti mt danh sch cc th mc X server tm c s d liu font. C th c nhiu FontPath. RGBPath pathname: Ch ra ng dn ti mt th mc X server tm c s d liu mu. ModulePath "pathname": Ch ra ng dn cha cc module. V d: /usr/X11R6/lib/modules. Section module: Dng load cc module ng cho cc thit b Xinput. Cc module ng duy nht c s dng cho cc thit b Xinput v cng ch trn mt vi h thng nh Linux ELF, FreeBSD 2. x v NetBSD 1. x. Xem trang man bit thm chi tit v cc module c h tr cho cc Xinput. Section ServerFlags: Dng ch ra mt vi chc nng pha tp ca X server. N c cc mc sau: NoTrapSignals: iu ny khng cho php X kt thc mt cch m xui khi c mt tn hiu li khng mong i (X server s cht v to ra mt tp tin core). Hot ng mc nh ca X l exit cleanly nhng vn to ra tp tin core. ng s dng chc nng ny tr khi ang g ri mt vn cho X. DonZap: Khng cho php ngi dng n ng thi Ctrl+Alt+Backspace kt thc X server. DonZom: La chn ny khng cho php s dng Ctrl+Alt+ +hoc Ctrl+Alt+ - chuyn i gia cc mode video c lit k bng dng modeline ca section "Screen" trong tp tin XF86Config. AllowNonLocalXvidtune: Cho php Xvidtune client
Trang 113

KC-06-03CN

Hng dn s dng Giao din ha GNOME

kt ni t mt host name khc. DisableVidMode: Khng cho php Xvidtune client s dng cc mode m rng lm thay i video mode. AllowNonLocalModInDev: Cho php client kt ni t my khc c quyn thay i cc thit lp keyboard v mouse.. DisableModInDev: Hy b cc phn m rng misc m c th c s dng thay i cc thit lp device Input. AllowMouseOpenFail: Cho php Server khi ng ngay c khi mouse b li. Section keyboard: Section ny m t v bn phm ang dng. N c cc mc sau: Protocol kbd-protocol: kbd-protocol c th l Standard hoc Xqueue. Xqueue c s dng khi ang dng trnh iu khin hng i s kin trn h thng SVR3 hoc SVR4. AutoRepeat delay rate: Cho php thay i cch hot ng t ng lp (autorepeat) ca bn phm. ServerNumlock: X server s thay i m ca cc phm s bn phi. (nu t tnh nng ny th trong X khng g c phm s bn phi). Section Pointer: Section ny xc nh cc tham s v thit b pointer. N c cc mc sau: Protocol protocol type: Bao gm cc protocol sau: Auto Busmouse ... (trang man gii thiu chi tit) Device /dev/mouse. pointer-dev: V d poiter-dev l

BaundRate rate: Mc nh l 1200 Buttons N . . . (trang man gii thiu chi tit) Section monitor: on 12.3 ca chng ny s m t chi tit thnh phn ny. Section device: Section ny ch ra cc video board. Thng thng c hai section Device. Section u tin l thng tin m t chung cho cc my. Section th hai xc nh cc thng tin ring.
Section "Device" Identifier "Generic VGA"
Trang 114

KC-06-03CN VendorName "Unknown" BoardName "Unknown" Chipset "generic" # Clocks 25.2 28.3 EndSection Section "Device" Identifier "ATI|3D Rage IIC AGP" VendorName "Unknown" BoardName "Unknown" #VideoRam 4096 Endsection

Hng dn s dng Giao din ha GNOME

Mi section Device bao gm cc mc sau: Indentifier device ID string (duy nht) VendorName vendor Chipset chipset -type VideoRam ClockProg "CommandPath": XF86 cung cp chc nng ny thit lp tn s ca ng h trn mt card ho (i vi nhng card khng c h tr cc phng php la chn tn s ng h bng cc driver chun). "CommandPath" l ng dn y ca chng trnh thit lp tn s ng h (X SERVER s gi chng trnh ny khi n cn thay i tn s). Khi s dng chc nng ny v khng ch ra dng Clocks trong tp tin XF86config X SERVER s coi ng h trn card ca c kh nng lp trnh c (PROGRAMMABLE=yes). Tuy nhin dng Clocks y bo cho X SERVER bit cc tn s ng h c th cung cp cho card. Mt chng trnh v d v lp trnh thit lp tn s ng h nm trong /usr/X11R6/lib/X11/etc/et4000clock.c. Section screen: on 12.4 ca chng ny s m t chi tit thnh phn ny. Section Xinput: Section ny dng m t cc thit b X, mi thit b tng ng vi mt on con (Subsection) c dng nh sau: Subsection Endsubsection v d:
Section Xinput SubSection Joystick port /dev/joy0
Trang 115

"tn thit b

<m t thit b>

KC-06-03CN

Hng dn s dng Giao din ha GNOME devicename Joystick screen 0

Endsubsection SubSection Acecad port /dev/ttyS1 devicename Acecad v. v. . . Endsubsection EndSection

12.3. Thit lp d liu cho Monitor iu ny c thc hin trong Section "Monitors ca tp tin XF86config. to mt section trong tp tin ny i hi phi c nhiu kin thc v kinh nghim bi v vic thay i phn ny c th dn n khng khi ng c X thm ch c th ph hu mn hnh ca . Chng hn nu mn hnh ca thuc kiu c tn s c nh m li thit lp vt qu gi tr ca n th c th dn n chy phn cng. Trong phn Monitor phi m t cc trng sau:
Identifier: Ch ra tn ca monitor VendorName: ModelName: HorizSync: VertRefresh: 31.0-48.0 (V d) 59.0-61.0

Modeline "640x400" 45 640 664 760 800 400 409 411 450 Interlace

Dng modeline c hiu nh sau:


# Mode # DotClock # HTimings # VTimings # Flags # EndMode "640x400" 45 640 664 760 800 400 409 411 450 "Interlace"

C rt nhiu cc Modeline c ch ra, y l nhng mode chung nht cho cc loi mn hnh v card mn hnh (cc dng Modeline l ging nhau trn cc my). Chng s la chn mt mode ph hp nht.
Section "Monitor" Identifier "COMPAQ V45 Color Monitor" VendorName "Unknown" ModelName "Unknown" HorizSync 31.0-48.0
Trang 116

KC-06-03CN VertRefresh 59.0-61.0

Hng dn s dng Giao din ha GNOME

Modeline "640x400" 25.175 640 664 760 800 400 409 411 450 # 640x480 @ 60 Hz, 31.5 kHz hsync Modeline "640x480" 25.175 640 664 760 800 480 491 493 525 # 800x600 @ 56 Hz, 35.15 kHz hsync ModeLine "800x600" 36 800 824 896 1024 600 601 603 625 # 1024x768 @ 87 Hz interlaced, 35.5 kHz hsync ...................

12.4. Kt hp d liu Monitor v phn cng Video: iu ny c thc hin bi Section Screen trong tp tin XF86config. C 4 section screen c ch ra ng vi 4 tn driver (cc mn hnh v card mn hnh khc cng c 4 section tng t - cng driver): Driver Accel : Cho card accel. Xem trang ca man page XF86_Accel. Driver VGA2 Driver VGA16 Driver SVGA cn phi cung cp cc thng tin sau: SERVER driver types: L mt trong cc loi SERVER c h tr sau: SVGA (tng ng vi trnh iu khin XF86_SVGA nm trong th mc /usr/X11R6/bin - sau khi ci t X thnh cng), VGA16 (XF86_VGA16), VGA2 (XF86_Mono), ACCEL (XF86_S3, XF86_MACH8, XF86_MACH32, XF86_MACH64, XF86_8514, XF86_P9000, XF86_AGX, XF86_W32). Device: Ch ra tn card mn hnh ca y (l mt trong cc trng NAME ca tp tin Cards. Monior: Ch ra tn mn hnh (l mt trong monitor name ca tp tin MonitorDB). Depth: Bao nhiu bit trn mt pixel. Display mode: Viewport: 0 0 -> To trn bn tri.
Section "Screen" Driver "svga" Device "Generic VGA" #Device "ATI|3D Rage IIC AGP" Monitor "COMPAQ V45 Color Monitor" Subsection "Display"
Trang 117

KC-06-03CN Depth 8 #Modes "800x600" ViewPort 0 0 EndSubsection EndSection # The 16-color VGA server Section "Screen" Driver "vga16" Device "Generic VGA"

Hng dn s dng Giao din ha GNOME

Monitor "COMPAQ V45 Color Monitor" Subsection "Display" Modes "640x480" "800x600" ViewPort 0 0 EndSubsection EndSection # The Mono server Section "Screen" Driver "vga2" Device "Generic VGA" Monitor "COMPAQ V45 Color Monitor" Subsection "Display" Modes "640x480" "800x600" ViewPort 0 0 EndSubsection EndSection # The accelerated servers (S3, Mach32, Mach8, 8514, P9000, AGX, W32, Mach64 # I128, and S3V) Section "Screen" Driver "accel" Device "ATI|3D Rage IIC AGP" Monitor "COMPAQ V45 Color Monitor" Subsection "Display" Depth 8 Modes "800x600" ViewPort 0 0 EndSubsection EndSection

Cc mode hin th chung nht c th tham kho theo danh sch di y (tp tin
Trang 118

KC-06-03CN

Hng dn s dng Giao din ha GNOME

/usr/X11R6/lib/X11/doc/VideoModes.doc):
# Mode Refresh Hor. Sync Dot-clock Interlaced? VESA? # -----------------------------------------------------------# 640x480 60Hz 31.5k 25.175M No No # 640x480 60Hz 31.5k 25.175M No No # 640x480 63Hz 32.8k 28.322M No No # 640x480 70Hz 36.5k 31.5M No No # 640x480 72Hz 37.9k 31.5M No Yes # 800x600 56Hz 35.1k 36.0M No Yes # 800x600 56Hz 35.4k 36.0M No No # 800x600 60Hz 37.9k 40.0M No Yes # 800x600 60Hz 37.9k 40.0M No No # 800x600 72Hz 48.0k 50.0M No Yes # 1024x768i 43.5Hz 35.5k 44.9M Yes No # 1024x768 60Hz 48.4k 65.0M No Yes

12.5. S dng 16 bit mu Theo mc nh X s dng 8 bit mu (256 mu). Nu s dng cc ng dng cn su mu cao hn cn chuyn ln 16 bit hoc cao hn. C hai cch thay i : Chy startx --bpp 16 Nu s dng xdm phi thay i tp tin /etc/X11/xdm/Xservers :
:0 local /usr/X11R6/bin/X

#Thm 2 dng sau :


-bpp 16 :0 local /usr/X11R6/bin/X -bpp 16

Sau trong section Screen ca tp tin XF86config thm mt SubSection Display bng cch sao SubSection Display 8 bit v i trng Depth color thnh 16 bit. Trong qu trnh chy Xconfigurator nu la chn probe th n s s dng gi tr mc nh l 8 bit mu. c th la chn 16, 24, 32 bit mu y nu nh card ca h tr. Tuy nhin khng phi lc no cng tng c su mu, vic ny c th lm cho card ca hot ng kh khn hn. Do phi gim gi tr lm ti RR hoc phn gii xung. Theo mc nh X SERVER s gim phn gii. Nu mun gi phn gii c v mun gim RR th phi thay i li dng Modeline. V d, i:
Modeline "1024x768" 75 1024 1048 1184 1328 768 771 777 806

thnh:
Modeline "1024x768" 65 1024 1032 1176 1344 768 771 777 806 --

Trang 119

H Ni - 2003

Hng dn s dng StartOffice 5.2

t lu, cc phn mm trong B Tin hc vn phng ca Microsoft Office chy trong h iu hnh Windows nh: Word, Excel... tr nn quen thuc trong cc c quan, nh trng, gia nh. Trong h iu hnh Linux cng c cc phn mm Tin hc vn phng tng ng chy trong XWindow nh: b StartOffice, GnomeOffice (ch chy trong mi trng GNOME), KOffice (ch chy trong mi trng KDE)... y, chng ti xin gii thiu vi bn c mt s cc ng dng trong b StarOffice l Text Document v Spreadsheet.

KC-06-03CN

Hng dn s dng Staroffice

Mc Lc
hng dn s dng StartOffice 5.2

Hng dn s dng..................................................................................................................1 trnh son tho vn bn trong StartOffice 5.2 ...............................................................1

1. Khi to trnh son tho vn bn trong StarOffice.................................................. 1 1.1 Khi to ........................................................................................................... 1 1.2 Mn hnh ca trnh son tho vn bn trong StartOffice................................... 2 1.3 Vo ra file.......................................................................................................... 3 2. Cc khi nim c bn .............................................................................................. 4 2.1 Thanh cng c chnh ......................................................................................... 4 2.2 Khi nim cu, dng, on................................................................................ 4 2.3 K thut ct, dn, sao chp................................................................................ 4 2.4 nh du khi trong trnh son tho vn bn ................................................... 4 3. Cc lnh n gin.................................................................................................... 6 3.1 Tm kim v thay th......................................................................................... 6 4. nh dng vn bn................................................................................................... 9 4.1 t cc thng s cho trang vn bn .................................................................. 9 4.2 Tiu trang.................................................................................................... 10 4.3 nh dng k t............................................................................................... 10 4.4 nh dng on vn bn.................................................................................. 13 4.5 nh dng ct vn bn..................................................................................... 16 4.6 nh s hoc to Bullet cho on vn bn...................................................... 17 5. To khun t ng trong trnh son tho vn bn................................................. 19 5.1 Khi nim Style: .............................................................................................. 19 5.2 nh ngha v iu chnh Style ....................................................................... 19 6. Bng biu............................................................................................................... 20 6.1 Khi to bng biu .......................................................................................... 20 6.2 Cc thao tc chnh vi bng ............................................................................ 20 7. X l ho trong trnh son tho vn bn .......................................................... 24 7.1 S dng cc cng c v hnh ........................................................................... 24 7.2 Cc i tng c nhng trong vn bn........................................................ 26 8. In n ti liu........................................................................................................... 29 9. Cc tnh nng khc c trong trnh son tho vn bn............................................ 30 9.1 AutoCorrect ..................................................................................................... 30 9.2 To dng ch thch.......................................................................................... 30 9.3 To mc lc..................................................................................................... 31

KC-06-03CN

Hng dn s dng Staroffice

Hng dn s dng................................................................................................................33 bng tnh - Spreadsheet trong StartOffice 5.2..............................................................33

Bi 1 ........................................................................................................................ 34 L thuyt............................................................................................................... 34 Thc hnh ............................................................................................................. 34 Hng dn......................................................................................................... 37 Bi 2 ........................................................................................................................ 39 L thuyt............................................................................................................... 39 Thc hnh ............................................................................................................. 43 Hng dn............................................................................................................. 44 Bi 3 ........................................................................................................................ 47 L thuyt............................................................................................................... 47 Thc hnh ............................................................................................................. 48 Hng dn............................................................................................................. 50 Bi 4 ........................................................................................................................ 53 L thuyt............................................................................................................... 53 Thc hnh ............................................................................................................. 53 Hng dn............................................................................................................. 54 Bi 5 ........................................................................................................................ 57 L thuyt............................................................................................................... 57 Thc hnh ............................................................................................................. 57 Hng dn............................................................................................................. 58

KC-06-03CN

Hng dn s dng Staroffice

Hng dn s dng trnh son tho vn bn trong StartOffice 5.2

1. Khi to trnh son tho vn bn trong StarOffice


1.1 Khi to

Mc nh, sau khi ci t, b StarOffice c t trong th mc /[ngi dng]/office52 (trong [ngi dng] l th mc c nhn ca ngi dng ng nhp). Bn hy khi ng X Window v c th chy StartOffice theo bn cch sau: Nhn vo nt menu chnh (c biu tng hnh ci bn chn trn thanh Panel), chn mc File Manager. Ca s qun l file c a ra, chn th mc /[ngi dng]/office52/soffice. Khi bn s thy giao din ca StartOffice, hy nhp p chut ti mc New Text Document, trnh son tho vn bn s c a ra. Cch th hai c ngn hn mt cht. Bn cng nhy vo nt menu chnh, chn mc Run Program. Trong khung nhp hy g vo lnh chy chng trnh nh sau: /[ngi dng]/office52/soffice. Khi bn s thy giao din ca StartOffice, hy nhp p chut ti mc New Text Document, trnh son tho vn bn s c a ra. Cch th ba l bn s dng lnh trn xterm (trnh m phng thit b u cui trong X Window) chy chng trnh. M xterm bng cch nhy p chut vo biu tng ca n trn Panel (mc nh biu tng l mt mn hnh c hnh bn chn). Ti du nhc lnh bn hy g vo lnh sau: # # cd /root/office52 ./ soffice start

Khi bn s thy giao din ca StartOffice, hy nhp p chut ti mc New Text Document, trnh son tho vn bn s c a ra. Tuy nhin ba cch ny c v khng c thun tin cho lm, ti sao chng ta li khng s dng cc tnh nng c sn trong X Window nh. Bn hy to shortcut ca b StartOffice trn mn hnh bng cch m menu chnh, chn File Manager, sau chn /[ngi dng]/office52, chn mc soffice, nhn chut tri v ko th biu tng ca mc ln trn mn hnh. Hay cng c th th n vo trn thanh Panel cu bn to mt Launcher ng dng mi. Khi , bn ch cn nhy vo biu tng ca b StartOffice, chn New Text Document, v son tho bt c vn bn no bn thch trong cc ln truy nhp sau.

Trang 1

KC-06-03CN

Hng dn s dng Staroffice

Hnh 1: Giao din chnh ca StarOffice


1.2 Mn hnh ca trnh son tho vn bn trong StartOffice

Sau khi khi ng trnh son tho vn bn, mn hnh ca n xut hin di dng hnh 2:

Hnh 2: Giao din ca StarOffice Writer

Trang 2

KC-06-03CN

Hng dn s dng Staroffice

Cc bn hy ch n cc yu t sau: Thanh tiu (Title Bar): l dng u tin ca mn hnh ghi r tn ng dng StartOffice 5.2 v vn bn cha c t tn l [Untitled1]. Thanh thc n (Menu Bar): nm di thanh tiu cha cc lnh chnh ca trnh son tho. Thanh cng c (Tool Bar): l thanh cha cc nt biu tng gip thc hin nhanh mt s lnh. Thc (Ruler): nm di thanh cng c. Thanh trng thi (Status Bar): nm cui mn hnh cho bit mt s thng tin nh s trang vn bn, nh dng vn bn, ... Thanh cun (Scroll Bar): l thanh nm bn phi mn hnh cho php bn cun trang mn hnh trong trng hp vn bn ca bn di khng hin th ht trn mt trang mn hnh.
1.3 Vo ra file

Ghi vn bn hin thi vo thit b lu tr: thc hin lnh File/Save hoc g Ctrl-S hay kch vo nt c hnh ci a mm trn thanh cng c. Ghi vn bn vi tn khc: thc hin lnh File/Save As. Son tho mt file vn bn mi: thc hin lnh File/News/Text Document. M mt vn bn c sn trn thit b lu tr: thc hin lnh File/Open hoc g Ctrl-O hay kch vo nt c hnh mt quyn v c m ra.

Trang 3

KC-06-03CN

Hng dn s dng Staroffice

2. Cc khi nim c bn
2.1 Thanh cng c chnh

Trn thanh cng c chnh c mt s nt gip bn thc hin c mt s thao tc n gin trn vn bn, di y l tc dng cu cc nt hay c dng: Nt 1 (Insert): c s dng khi mun chn mt i tng no nh bng hay hnh ... Nt 2 (Insert Fields): chn ni dung cu mt s trng ni dung sn c nh ngy thng hin ti, s trang ... Nt 3 (Insert Object): chn mt s i tng t cc ng dng khc nh chn biu , bng tnh ... Nt 4 (Show drow function): a ra thanh cng c dng cho vic v hnh n gin. Nt 5 (Form): to form.
2.2 Khi nim cu, dng, on

Cu (sentence), dng (line), on (paragraph) l nhng khi nim c bn ca mi h son tho vn bn. Cu c nh ngha trong mi quyn sch gio khoa v lng ca hc sinh ph thng. Dng l cc t trn mt dng mn hnh. Nh vy dng l khi nim hon ton tng i, n ph thuc vo rt nhiu yu t nh ca s mn hnh, kh giy in, l tri, phi, ... on l tp hp mt s cu hon chnh v c php v ng ngha, on thng c kt thc bi phm Enter.
2.3 K thut ct, dn, sao chp

Khi nim khi vn bn (block): khi l mt min vn bn lin tc c nh du trn mn hnh. Khi nim b m (clipboard): b m l vng b nh dng lu tr cc d liu tm thi. Ct (cut), dn (paste), sao chp (copy) l cc k thut c bn nht ca mi h son tho vn bn hin i. Cut: xo v a khi vn bn hin thi vo b m (Ctrl-X) Copy: sao chp khi vn bn hin thi vo b m (Ctrl-C) Paste: dn ni dung ca b m hin thi vo v tr du nhc tr (Ctrl-V)
2.4 nh du khi trong trnh son tho vn bn

nh du khi bng chut Cch 1: a con tr n v tr u khi cn nh du, bm, gi v r chut ti cui khi, th tay bm. Cch 2: cch ny ch dng trong trng hp nh du mt t hay mt dng mn hnh. + nhy p chut ti v tr t mun nh du + nhy chut tri ba ln trn dng vn bn mun nh du nh du khi bng bn phm
Trang 4

KC-06-03CN

Hng dn s dng Staroffice

a du nhc tr ti v tr u khi, bm gi phm Shift v s dng cc phm di chuyn nh du khi (cc phm di chuyn gm phm Home, End, Page Up, Page Down, cc phm mi tn).

Trang 5

KC-06-03CN

Hng dn s dng Staroffice

3. Cc lnh n gin
3.1 Tm kim v thay th

a. Cc bc tin hnh vic tm kim nh sau: Edit/Find hoc g Ctrl-F (hay nhn vo nt biu tng c hnh chic ng nhm trn thanh cng c chnh). Hp thoi Find & Replacce s xut hin:

Trong hp thoi bn g cc ch cn tm ti dng Search for. Nu mun tm theo nh dng ca on vn bn cn tm kim, th bn hy kch hot nt Format (cc khi nim v nh dng vn bn cc bn s c hc k cc bi sau). Nu mun tm theo cc c tnh ca k t th kch hot nt Attributes.... Nu mun xo b tt c cc nh dng c ch ra trong phn Options, hy kch hot nt No Format. Thc hin cc la chn nh dng sau nu cn: Whole words only: tm mt t trn vn (v d tm "is" ch khng phi tm "this") Backward: tm theo hng t v tr du nhc tr ngc tr li u vn bn (mc nh vic tm kim c thc hin t du nhc tr n cui vn bn) Regular expressions: cho php tm kim theo mt biu thc n gin. Sau y l mt s cc k t i din bn c th s dng trong biu thc tm kim: K t . ^t t$ * + \C \n \t
Trang 6

ngha thay th cho mt k t bt k ch tm cc t nu n l t bt u mt on ch tm cc t nu n l t kt thc mt on thay th cho 0 hoc nhiu k t thay th cho 1 hoc nhiu k t tm k t c bit sau du / tm du ngt dng cng c to ra khi nhn t hp phm Shift+Enter thay th cho du Tab

KC-06-03CN

Hng dn s dng Staroffice

\>

mu cn tm kim l cc k t nm cui mt t: v d vi mu l "book\>" t c tm thy l "checkbook" ch khng phi "bookmark" mu cn tm kim l cc k t bt u ca mt t: v d vi mu l "book\<" t c tm thy l "bookmark" ch khng phi "checkbook" thay th cho mt on trng mu tm kim nm v tr cui ca on vn bn mu tm kim l k t u tin ca on vn bn s dng k t ny khi cn thay th mt mu mi cho mu k t ang c tm kim. V d: Nu trong mc Search for c mu "Window" Trong mc Replace with c mu "&frame"Kt qu tr v s l "window frame" khi bn nhn nt Replace

\<

^$ $ ^. &

[abc123] [a-e] [a-eh-x] [^a-e] \xXX \XXX this|that

tm tt c cc k t gia hai du ngoc vung tm tt c cc k t gia hai ch ci a v e tm tt c cc k t gia cc ch ci a-e v h-x tm tt c cc k t ngoi tr a-e tm tt c cc k t c m hexa l XX tm tt c cc k t c m octal l XXX tm "this" hoc "that"

Match case: tm khng phn bit ch hoa, ch thng Current selection only: ch tm trn vng c chn hin thi Search for Styles: tm km theo kiu nh dng ca on vn bn. Hp thoi ny s thay i thnh Including Styles khi bn chn mt thuc tnh thng qua nt Attributes hoc Format. Similarity search: la chn ny cho php bn m rng vic tm kim Exchange characters: hy nhp vo phn ny s k t c th thay i trong on vn bn c tm kim. V d: nu bn cn tm t "black" v nhp vo s 2, c ngha l ti a c hai k t trong t "black" c th c thay i v khi t "crack" chng hn cng s c tm thy. Add characters: phn ny cho bn xc nh s k t c thm vo t c trong on vn bn cn tm kim. Cc k t c thm ny c th xut hin trong bt k phn no ca t. V d, nu bn xc nh s k t ti a c thm vo l 2 cho mu tm kim l "start", khi t "started" cng c xem l ph hp vi mu cn tm kim. Remote characters: bn c th xc nh s k t ti a c xo b khi mu cn tm kim. S k t b xo b c th thuc bt c phn no trong mu vn bn cn tm kim. V d nu mu cn tm l "stopped", vi ti a hai k t c xo, th t "stopp" cng ph hp vi mu cn tm kim.
Trang 7

KC-06-03CN

Hng dn s dng Staroffice

Hp kim Combine: hp kim ny s thc hin vic kt hp ba tu chn m rng tm kim trn. Mu tm kim s c tm thy nu n tho mn bt k s kt hp no ca ba tu chn m rng. Nu bn xc nh hai k t cho mi tu chn, khi , t "blink" s ph hp vi mu tm kim "Berlin". Chn Find bt u tm hoc tm tip t v tr hin thi. Chn Find All tm trn ton b vn bn. b. Cch tm kim v thay th nh sau: Edit/Find hoc g Ctrl-F (hay nhn vo nt biu tng c hnh chic ng nhm trn thanh cng c chnh). Hp thoi Find & Replacce s xut hin. Nhp mu cn tm vo trong mc Search for. Xc nh cc la chn v tm kim ging nh trn. Nhp mu c thay th vo mc Replace with. Nhn nt Replace thc hin vic tm kim v thay th t v tr du nhc tr n ht vn bn, hay nhn nt Replace All thay th trn ton b vn bn. Nhn nt Close kt thc vic tm kim hoc thay th.

Trang 8

KC-06-03CN

Hng dn s dng Staroffice

4. nh dng vn bn nh dng vn bn trong trnh son tho bao gm ch yu cc cng vic sau: t cc thng s ca trang vn bn. Xc nh font v kiu ch cho mt khi vn bn. To khun dng cho cc on trong vn bn. t cc thng s ct cho phn vn bn. To bng biu. To v lm vic vi cc i tng khc c th c trong vn bn. Ba chc nng sau cng chng ti s trnh by trong cc mc ring.
4.1 t cc thng s cho trang vn bn

Kch hot Pages... trong menu Format, chn nhn Page thit lp cc thng s cn thit cho trang vn bn.

Hnh 4: nh dng trang vn bn Cc chc nng v la chn c th ca lnh ny nh sau: Margins Phn ny cho php xc nh rng ca cc l tri, phi, trn v di trong trang vn bn, thng s mc nh l 2 cm. Page Layout Phn ny xc nh cc trang vn bn no s c thit t cc thng s. All: cc thng s s c thit t trn ton b vn bn Mirrored: vn bn c trnh by i xng gia cc trang chn, l Right: cc thng s s ch c thit t trn cc trang l Left: cc thng s s ch c thit t trn cc trang chn Numbering Nu mun nh s trang cho vn bn, hy chn mc ny v xc nh kiu s cn thit trong danh sch c sn.
Trang 9

KC-06-03CN

Hng dn s dng Staroffice

Paper format T danh sch trong phn Paper Format, hy chn ly mt kch thc cho trang vn bn, hoc bn c th xc nh trc tip di rng thng qua mc Height v Width. Chn hng giy khi in c chn thng qua hai mc Portrait (in theo chiu thng ng) v Landscape (in theo chiu nm ngang). Nu my in ca bn c nhiu khay giy, hy chn mc Paper source xc nh khay giy c s dng. Vic chn khay giy l rt cn thit nu bn mun nh dng kiu cho cc trang in tip theo khc vi trang in u tin. Preview Field Trong phn ny, bn c th nhn thy trc c cc xc lp bn lm trn trang in. Register-true Tu chn Register-true (gii thch) ch cn khi khi bn nh dng trang hay on vn bn nhng khng dng cho bng. Activate: chn mc ny kch hot tu chn Register-true Reference style: t danh sch trong phn ny, hy chn kiu on vn bn bn mun thit lp
4.2 Tiu trang

Tiu trang l dng ch c in ra mi trang vn bn. Tiu trang bao gm tiu trn (Header) v tiu di (Footer). to tiu hy chn Insert / Header hoc Footer. Chn kiu cho tiu bn cn, sau son tho ni dung ca tiu .
4.3 nh dng k t

nh du khi vn bn cn nh dng kiu k t hoc t du tr ti v tr bt u g ch. Thc hin lnh Format / Character....Hp thoi xc nh c tnh cho k t xut hin:

Hnh 5: Xc nh cc c tnh cho k t

Trang 10

KC-06-03CN

Hng dn s dng Staroffice

a. Nhn Font Nhn ny cho php xc nh kiu font ch c s dng trong vn bn. Font: xc nh kiu font ch c s dng. Bn c th chn kiu t danh sch c sn. Style: Kiu ch bao gm Bold (m), Italic (nghing), Regular (ch thng), Bold Italic (m v nghing). C th kch hot cc tnh nng ny bng cch nhn vo cc nt biu tng ca chng trn thanh cng c hoc s dng cc phm tt (Ctrl-B: ch m; Ctrl-I: ch nghing; ...). Font Size: Thay i kch thc ca font ch. Effects: Phn ny c mt s cc mc chn thit t mt s hiu ng trn k t nh: Outline: nu chn mc ny, ch c ng vin bn ngoi ca k t c hin th. Hiu ng ny khng th p dng cho ton b cc font. Shadow: to bng cho k t trn on vn bn c chn. Underline: gch chn cc k t. Khong trng v du tab cng s c gch chn tr khi bn chn mc Individual words khi chn Format / Character / Font Effects. Bn cng c th s dng nt biu tng trn thanh cng c hoc s dng phm tt Ctrl-U bt tnh nng ny. Strikethrough: tnh nng ny s k cc ng k ngang trn on vn bn c chn (tnh nng ny c th c ch khi bn mun nh du mt on vn bn no ). Color: thay i mu ca k t trn on vn bn c chn. Nu mc chn Print black trong mc Tools / Options / Text Document... / Print c kch hot, th nhng mu bn thay i cho vn bn s khng c in ra. Language: xc nh ngn ng khi s dng tnh nng kim tra li c php. Background Color: chn mu nn cho on vn bn c nh du. Preview Field: vng ny s hin th trc s thay i m bn thit lp. b. Nhn Font Effects Trong nhn ny bn s c cung cp thm mt s cc hiu ng khc ca font ch. More Effects: None: khng chn mt hiu ng no. All caps: i tt c cc k t thnh ch hoa. Lower case: i tt c cc k t thnh ch thng. Small caps: khi s dng tnh nng ny th tt c mi k t u chuyn thnh ch hoa, nhng k t ban u l ch hoa th sau khi chuyn n s c kch thc ln hn cc k t khc. (V d: Who am I? chuyn thnh WHO AM I?) Title: tnh nng ny s chuyn tt c cc k t bt u ca mt t thnh ch hoa. (V d: who am i? chuyn thnh Who Am I?) Blinking: cc k t trong on vn bn s nhp nhy. Super: bt tnh nng ny th cc k t s c dng ca ch s trn, tc l cc k t c kch c nh hn v c t cao hn ch thng. (V d: Who am I? khi chn k t m v bt tnh nng ny s chuyn thnh Who am I? ) Normal: cc k t c hin th di dng thng thng.
Trang 11

KC-06-03CN

Hng dn s dng Staroffice

Sub: cc k t s c dng ch s di khi bt tnh nng ny. (V d: Who am I? khi chn k t m v bt tnh nng ny s chuyn thnh Who am I? ) Position options: phn ny c tc dng khi tnh nng Super hay Sub c bt. Raise/lower by: xc nh v tr xut hin ca ch s trn hoc ch s di da theo kch thc ca font ch hin thi. Relative font size: xc nh kch c ca ch s trn hoc ch s di da theo kch thc ca font ch hin thi. Automatic: v tr ca ch s trn hoc ch s di s t ng c thit lp nu bt tnh nng ny. Spacing: nhn ny cho php xc nh khong cch gia cc k t. Spacing: xc nh khong cch gia cc k t. Standard l khong cch mc nh, Expanded tng khong cch v Condensed s lm gim khong cch gia cc k t. Spacing by: xc nh chnh xc tng hoc gim ca khong cch gia cc k t. Underlining: phn ny ch c tc dng khi tu chn Underline ca nhn Font c kch hot. Bn c th chn gia cc kiu ng gch chn nh sau: Simple: gch n. Double: gch chn p. Bold: gch m. Dotted: gch chm. Dotted (Bold): gch chm m. Dash: gch chn kiu nt t. Dash (Bold): gch chn kiu nt t m. Long Dash: gch chn kiu nt t di. Long Dash (Bold): gch chn kiu nt t di v m. Dot Dash: gch chn kiu chm im-t on. Dot Dash (Bold): gch chn kiu chm im-t on m. Dot Dot Dash: gch chn kiu hai chm mt on. Dot Dot Dash (Bold): gch chn kiu hai chm mt on m. Wave: gch chn hnh sng. Wave (Bold): gch chn hnh sng m. Double Wave: gch chn hnh sng kp. Strikethrough: phn ny ch c gi tr nu tu chn Strikethrough trong nhn Font c la chn. Bn c th la chn gia cc kiu k ngang sau: Single: gch n. Double: gch ngang kp. Bold: gch m. With /: gch s. With X: gch cho.
Trang 12

KC-06-03CN

Hng dn s dng Staroffice

By word: trong trng hp bt tnh nng gch chn k t hay gch ngang trong on vn bn, la tu chn ny th vic gch chn hay gch ngang s ch thc hin trn cc t m khng trn cc khong trng. Preview Field: mi s thay i bn thit lp s c hin th trong phn ny.
4.4 nh dng on vn bn

Chn on vn bn cn thay i nh dng, kch hot thc n Format / Paragraph. Hp thoi Paragraph xut hin:

Hnh 6: Xc nh cc thuc tnh cho on vn bn Sau y l phn m t cc chc nng ca vic nh dng vn bn. a. Indent and Spacing - Cn on v khong cch gia cc on Indent (cn on): From left: mc ny cho php xc nh khong cch gia on vn bn c nh du vi l tri. First line: mc ny xc nh khong cch ca dng u tin trong on vn bn c chn so vi l tri. Automatic: chn mc ny th khong cch gia dng u tin ca on vn bn vi l tri s c t ng thit lp da theo c ch v khong cch gia cc dng. From right: xc nh khong cch ca on vn bn so vi l phi. Spacing (gin on): xc nh khong cch ca on vn bn hin thi so vi cc on vn bn xung quanh Top: khong cch n on vn bn trc. Bottom: khong cch n on vn bn sau. Line spacing (gin dng): khong cch gia cc dng trong on vn bn Single: khong cch n cho tng dng ph hp vi font ch ln nht trong dng ny, cng vi mt sai s nh (sai s ny tu thuc vo font ch ang s dng). C th chuyn v ch gin dng n bng cch nhn t hp phm Ctrl-1.
Trang 13

KC-06-03CN

Hng dn s dng Staroffice

1.5 lines: khong cch cho mi dng bng 1.5 ln khong cch n. Kch hot gin dng ny khi s dng t hp phm Ctrl-5. Double Spacing: khong cch cho mi dng bng hai ln khong cch n. Kch hot gin dng ny khi s dng t hp phm Ctrl-2. Proportional: xc nh mt khong cch gin dng mi da trn t l phn trm ca khong cch gin dng n. At least: xc nh khong cch nh nht gia cc dng. Leading: xc nh khong cch chnh xc gia cc dng. Fixed: xc nh khong cch c nh gia cc dng. Preview: hin th trc nhng s thay i trn on vn bn. Register-true: Nu bn chn tu chn register-true trong Format / Page, hy chn n kch hot tnh nng ny. b. Alignment - Dng hng trong on vn bn: Left: cn tri (Ctrl - L). Right: cn phi (Ctrl - R). Center: cn gia (Ctrl - E). Justifi: cn hai bn (Ctrl -J). Last Line: xc nh dng cui ca on vn bn c cn bn nh th no (tri, gia hoc hai bn). Expand single word: kch vo y lm tng khong cch gia cc k t trong t cui cng ca on vn bn c cn hai bn nu n ng mt mnh trn mt dng. Preview: hin th trc nhng s thay i trn on vn bn. c. Xc nh cc im dng Tab: Tnh nng ny cho php xc nh cc im dng ca tr text trn mn hnh sau khi g phm Tab. Mi on vn bn c mt cch t im dng ring ca mnh. Khi ta g phm Tab trn bn phm, con tr text s c di chuyn ti v tr im dng Tab bn phi gn nht. Khi kch hot vo thc n Format / Paragraph / Tabs, nhn Tab xut hin.

Trang 14

KC-06-03CN

Hng dn s dng Staroffice

Hnh 7: Xc nh im Tab Position: xc nh cc im dng ca tr text trn mn hnh sau khi g phm Tab. Type: xc nh kiu cho tab c chn Left: Tab tri, y l kiu Tab mc nh. Right: Tab phi. Center: Tab gia. Decimal: Tab thp phn. Xc nh k t cho Tab thp phn trong mc Character, mc nh l du chm. Leader: xc nh k t t trc Tab. t mt Tab ta g s tng ng vi v tr ca Tab vo Position, chn mt kiu ti phn Type, chn k t vch Tab ti Leader. Thit t thm cc dim dng khc nhau nu cn thit. S dng nt Clear hu Tab hin thi, Clear All hu tt c cc Tab hin c. C th t cc im dng Tab bng cch dng chut chn kiu Tab v t ti cc im dng Tab trn thc. d. nh dng cc khung vin: Mi i tng chng hn on vn bn, bng biu, cm ch, tranh nh u c th c to khung vin nh vic chn thc n Format / Paragraph / Borders.

Trang 15

KC-06-03CN

Hng dn s dng Staroffice

Hnh 8: To khung vin Trong hp thoi ch cc yu t sau: Presets: xc nh kiu khung vin Spacing: xc nh khong cch gia vn bn v khung vin. Line:xc nh kiu v mu ng vin thng qua mc Style v Color. Shadow Style: xc nh bng cho khung vin. Position: v tr ca vin bng. Size: kch thc ca vin bng. Color: mu sc ca vin bng.
4.5 nh dng ct vn bn

Trnh son vn bn chia mi vn bn thnh nhiu Section khc nhau. Mi section bao gm mt hay nhiu on vn bn. c im c bn phn bit cc section khc nhau l s ct (column) ca vn bn. Sau y l mt s cc thao tc c bn vi section trong vn bn. a. To ct bo ch Chn on vn bn mun to ct. Thc hin lnh Format / Columns...

Hnh 9: Chia ct trong vn bn


Trang 16

KC-06-03CN

Hng dn s dng Staroffice

Trong hp thoi chn: Amount: xc nh s ct vn bn trong phn ny Column Width: xc nh rng cc ct trong on vn bn. Nu c nhiu hn ba ct th s dng cc phm mi tn tri, phi di chuyn n cc ct. Spacing: xc nh khong cch gia cc ct. AutoWidth: nu kch hot tnh nng ny, rng cc ct s c t ng thit t da theo ni dung ct. Preview: hin th trc kt qu ca vic thit t. Separator line: tnh nng ny ch c s dng khi trong on vn bn c t nht hai ct. N cho php xc nh hnh thc ca dng k ngn chia gia cc ct. Line: xc nh rng ca dng k c dng. Nu khng mun chia cc ct bi dng k, hy chn None. Height: xc nh chiu cao ca dng k c dng. Position: xc nh v tr ca dng k ngn khi n c chiu cao nh hn 100% (Top, Centerered v Bottom). Apply to: khi bt tnh nng ny, kiu ct vn bn c thit lp s c p dng trn ton b vn bn hoc cho on vn bn c nh du.
4.6 nh s hoc to Bullet cho on vn bn

Bullet l cc k t c bit c t ti v tr u ca on vn bn. to Bullet hoc nh s cho on vn bn, cc bc thc hin nh sau: nh du on vn bn cn gn Bullet hay s th t t ng. Thc hin vic chn thc n Format / Numbering/Bullets...

Hnh 10: Hp thoi Numbering/Bullets Chn cc mc sau: Bullets: chn kiu Bullet c sn trong phn ny. Numbering style: chn kiu nh s c sn trong phn ny. Outline: chn kiu nh s hoc Bullet cho on vn bn c nhiu mc khc nhau.
Trang 17

KC-06-03CN

Hng dn s dng Staroffice

Graphics: chn Bullet theo kiu ho. Trong phn ny cn c mc Link graphics, cho php to lin kt ho trong trng hp vn bn c cha Bullet kiu ny c m trn my khng c th vin ho cha kiu Bullet . Position: cho php xc nh v tr v khong cch ca cc mc trong on vn bn c nhiu mc c nh s t ng hoc to Bullet. Level: chn s mc trong on vn bn. Positioning: xc nh khong cch gia cc mc cng nh cch thc cn l ca s t ng hoc Bullet. Customize: bn c th tu bin kiu nh s hay Bullet trong phn ny. Level: chn s mc trong on vn bn. Format: nh dng kiu s th t hay Bullet. Preview: hin th trc kt qu ca s tu bin. Chn OK sau khi chn xong cc thng s cn thit.

Trang 18

KC-06-03CN

Hng dn s dng Staroffice

5. To khun t ng trong trnh son tho vn bn


5.1 Khi nim Style:

To khun cho on vn bn bng Style l mt trong cc chc nng c bn ca trnh son tho vn bn trong StarOffice. Nh chng ti trnh by phn trn, on vn bn l mt n v hon chnh v c php cng nh ng ngha, do c th ni rng n l n v chnh trnh by vn bn. Mi on vn bn li c th c nhng cch trnh by ring (Style), kiu ny c tn ring v c lu tr cng vi vn bn. Mi Style trnh by on vn bn bao gm cc thng s c bn nh: kiu font ch, kiu on, kiu Tab ... Nh vy mt vn bn c th bao gm nhiu on vn bn v nhiu kiu (Style) trnh by khc nhau.
5.2 nh ngha v iu chnh Style

to ra mt Style mi hoc iu chnh thng s cho mt Style c ta thc hin vic chn Style / Catalog trong thc n Format. Hp thoi Style Catalog c dng sau:

Hnh 11: Xc nh Style Cc thng s chnh ca hp thoi Style Catalog bao gm: Phn trn cng cho php xc nh loi Style s c p dng cho on vn bn, k t, trang vn bn hay s trang ... Phn tip theo cho php xc nh tn ca Style. Phn cui cho php xc nh kiu Style. New: dng to mt Style mi. Khi hp thoi Style xut hin cho bn la chn cc thng s cn thit cho kiu Style mi. Modify: dng thay i cc thng s ca Style hin thi. Cc thng s c bn ca hp thoi ny tng t nh trong hp to mt Style mi. Delete: xo Style hin thi ra khi danh sch Style. Organizer: sao chp cc Style ring l t mt vn bn ti mt vn bn khc. Close: ng hp thoi.

Trang 19

KC-06-03CN

Hng dn s dng Staroffice

6. Bng biu
6.1 Khi to bng biu

t tr text ti dng nh to bng biu: Chn mc Table... trong thc n Insert (c th nhn CTRL-F12) hay kch nt chn mt bng biu trn thanh cng c chnh. Xc nh cc thng s cn thit cho bng biu

Hnh 12: To bng Name: tn bng biu. Size: kch thc bng biu gm s ct, s hng trong bng. Option: xc nh mt s cc tnh nng c trn bng biu Header: to tiu cho ca s. Nu ni dung bng di, hy bt tnh nng Repeat header cc tiu vn c gi khi sang trang mi. Don't split table: khng chia bng. Boder: to vin cho bng. AutoFormat: xc nh kiu nh dng cho bng Format: chn kiu bng thng qua mt s kiu c sn. Preview: xem trc hnh dng ca bng. More: khi nhn nt ny, hp thoi Formatting xut hin cho php xc nh mt s cc thng s v bng nh: Number format - kch vo y nh dng c s trong AutoFormat; Font - kch vo y nu bn mun nh dng c font ch trong AutoFormat; Alignment - cn l cho ni dung ca tng trong bng; Border - xc nh kiu vin cho tng trong bng; Pattern - xc nh mu nn cho bng trong AutoFormat. Nhn nt Rename khi mun i tn bng hin thi.
6.2 Cc thao tc chnh vi bng

a. Chn cc ca bng: Ta c th nh du mt hay nhiu hng, ct hay ca bng bng cc k thut s dng chut quen thuc. Kch chut vo hng hay ct mun nh du, ko chut n ht v tr cn nh du hoc s dng cc phm mi tn nh du u c. Hay c th kch nt chut phi trn bng v chn Rows / Select hay Column / Select chn nh du hng hoc ct. b. Nhp s liu vo bng:
Trang 20

KC-06-03CN

Hng dn s dng Staroffice

Trong khi g s liu, cc phm Tab, Shift-Tab, Up, Down dng di chuyn gia cc , hng v ct ca bng. Khi tr text nm ti cui cng ca bng, n phm Tab s chn thm mt hng mi cui bng. Mun ra khi bng phi dng phm mi tn xung hoc dng chut. c. iu chnh kch thc bng: Thay i rng ct: a tr chut ti ng phn cch gia cc ct, kch, gi tay v r chut. Trong khi r chut kt hp thm phm Shift gi nguyn rng ca bn cnh. Hoc t du nhc tr trn bng, nhy chut phi, t thc n hin ra chn mc Columns.../ Width. Trong hp thoi Column Width, xc nh ct cn thay i rng cng nh rng ca ct. Thay i cao hng: a tr chut ti vo bng cn thay i, nhy chut phi v chn mc Rows / Heigh t thc n hin ra. Trong hp thoi Row Heigh, xc nh cao cho cc hng trong bng. Thay i thuc tnh ca mt trong bng: t tr chut vo bng, kch chut phi v chn mc Cells. Split...: chia . Amount: xc nh s c thm vo. Direction: xc nh chia theo chiu ngang (horzontally) hay chiu dc (vertically). Merge: cho php trn cc c chn vo thnh mt theo c chiu dc v chiu ngang. Top - Center - Bottom: cn ni dung vn bn trong . Protect - Unprotect: bo v v xo vic bo v ni dung ca trnh mi s thay i i vi ni dung . d. Chn hng, ct hoc : Chn hng: nhy chut phi trn hng cn chn thm hng mi, chn mc Rows / Insert, hp thoi InsertRows xut hin cho php xc nh s hng (Insert / Amount) cng nh v tr chn ca hng mi (Position / Before hay Position / After). Hoc c th nhn vo biu tng ca thao tc chn hng trn thanh cng c. Chn ct: nhy chut phi trn ct cn chn thm ct mi, chn mc Columns / Insert, hp thoi InsertColumns xut hin cho php xc nh s ct (Insert / Amount) cng nh v tr chn ca ct mi (Position / Before hay Position / After). Hoc c th nhn vo biu tng ca thao tc chn ct trn thanh cng c. e. Xa hng hoc ct: Chn s hng hay s ct cn xo. t du nhc tr trn ct hoc hng cn xo, kch chut phi, chn Columns / Delete nu mun xo ct v Rows / Delete nu mun xo hng. Cng c th s dng nt biu tng trn thanh cng c thc hin cc thao tc xo dng, xo ct. f. Chia bng: Bn cng c th chia bng theo cc bc sau: Chn cc cn thit cho vo bng mi.
Trang 21

KC-06-03CN

Hng dn s dng Staroffice

Kch chut phi v chn mc SplitTable, hp thoi xut hin cho php xc nh cc thng s cho bng mi. Copy heading: sao chp nguyn tiu ca bng c vo bng mi. Custom heading (apply style): thm mt dng trng vo bng mi vi nh dng ca n ging nh nh dng ca dng u tin trong bng c. Custom heading: thm mt dng trng vo trong bng mi. No heading: chia bng m khng c bt k mt s thay i no. g. V khung cho cc ca bng: v khung cho mt khi cc trong bng, ta nh du cc , kch chut phi trn cn v khung, chn Table / Border. Cc thao tc cn li lm tng t nh trong mc nh dng cc khung vin. h. Sp xp trong bng: thc hin vic sp xp trong bng, bn hy thc hin nh sau: Chn cc cn sp xp. Chn mc Sort trong thc n Tool. Hp thoi Sort c ni dung nh sau: Sort criteria: Key 1 n 3: xc nh kho sp xp trn vng c chn hoc trn ton b bng.

Hnh 13: Sp xp trong bng Column 1 n 3 (hoc Row 1 n 3): xc nh s ct (hoc hng) c cha mu c s dng cho vic sp xp. Gi tr ny nm trong khong t 1 n 99. Key Type 1 n 3: nh ngha kiu k t cho cc kho sp xp. Order: thit lp th t sp xp cho hng hoc ct (Ascending - tng dn v Descending - gim dn). Direction: xc nh vng thc hin vic sp xp. Separator: vn bn c th c sp xp bng cch nh du cc vn bn. V th bn c th chn mt k t lm mc chia cho tnh nng sp xp trong danh sch. Tabs - chn n nu cc on vn bn c chn c phn cch nhau bi du Tab. Character nhp k t c s dng nh mc chia trong on vn bn c chn. Bng cch s
Trang 22

KC-06-03CN

Hng dn s dng Staroffice

dng mc chia, StarOffice c th xc nh c v tr ca kho sp xp trong on vn bn c chn. Nhn OK thc hin vic sp xp. i. Tnh ton trong bng: Ta c th thc hin cng vic tnh ton trong bng rt thun tin. Cc cng thc c a vo bng bng cch sau: Xc nh cc cn s dng cng thc. Chn mc Calculate t thc n Tool. Lc trn thanh cng c s hin th cc dng cho php bn nhp cc cng thc cn tnh ton. Vng text bn tri nhp v tr ca mun ci cng thc. G cng thc cn tnh ton trong vng text bn phi. Cc dng sn c ca cng thc chn thng qua nt biu tng Formula trn thanh cng c. Nhn biu tng ca nt Apply trn thanh cng c c kt qu. ch cc ca bng ta dng cc k hiu chun, v d: A1, B12 ... j. Chuyn i t vn bn sang bng v ngc li: chuyn i t vn bn thng thng sang dng bng c th thc hin nh sau: Xc nh on vn bn cn i. Chn mc Text <->Table trn thc n Tool. Hp thoi Conver Text to Table xut hin cho php xc nh cc thng s cn thit cho vic chuyn i. Separate text at: xc nh im phn chia vn bn thnh cc ct Tab: chia theo du Tab. Paragraph: chia theo on vn bn. Semicolons: chia theo du chm phy. Other: chia theo cc k t khc. Equal width for all columns: chn tnh nng ny nu mun cc ct c rng bng nhau. Options: xc nh mt s cc thuc tnh ca bng. Autoformat: xc nh khun dng ca bng. chuyn t bng sang dng vn bn th lm nh sau: Xc nh bng cn i. Chn mc Text <->Table trn thc n Tool. Hp thoi Conver Table to Text xut hin cho php xc nh cc thng s cn thit cho vic chuyn i. Separate text at: xc nh im ghp cc ct trong bng thnh vn bn Tab: theo du Tab. Paragraph: theo on vn bn. Semicolons: theo du chm phy. Other: theo cc k t khc.
Trang 23

KC-06-03CN

Hng dn s dng Staroffice

7. X l ho trong trnh son tho vn bn ho (Graphic Object) c coi nh mt i tng hon ton tng ng vi cc i tng khc nh vn bn hay bng... Mi i tng ho c gn lin vi vn bn ti v tr khi to. Ta c th di chuyn chng ti v tr bt k trong vn bn. C hai loi i tng ho. Loi th nht l cc i tng ho c to trc tip bng mt s cc cng c c trong trnh son tho. lm vic vi i tng ny, hy chn mc Insert / Graphics / From Image Editor... Khi , bn c th tu v bt c th g bn mun. Tuy nhin, bn ch c th v mt s hnh n gin khi dng cng c ny. Loi th hai l cc i tng c nhng t mt phn mm khc chng hn nh cc i tng c v trong cc chng trnh ho khc hoc thm ch c cc i tng c to ra trn mi trng Window. c th chn mt hnh bt k vo trong vn bn hin ti, hy chn Insert / Graphics / From File ... Khi hp thoi Insert Graphics xut hin cho php xc nh v tr ca hnh cn chn.
7.1 S dng cc cng c v hnh

Sau khi chn mc Insert / Graphics / From Image Editor... Hp thoi New Image xut hin cho php xc nh cc thng s cn thit cho hnh bn mun to: Width: xc nh rng ca hnh. Height: xc nh cao ca hnh. Number of colors: xc nh s mu cho hnh. Nhn nt Create sau khi chn xong cc thng s cn thit. Khi giao din ho s c hin th vi khung v v cc thanh cng c, thanh mu.

Hnh 14: Giao din ho


Trang 24

KC-06-03CN

Hng dn s dng Staroffice

a. Gii thiu mt s nt ho c bn: Trnh son tho trang b mt thanh dng c v gm mt s nt lnh. Cc nt lnh ny thng c hnh thc th hin c trng cho tc dng ca lnh. Hnh di biu din mt s cc nt ho c bn.

Hnh 15: Thanh cng c trong giao din ho Sau y l tc dng ca cc nt ho c bn: Nt 1 (select): c s dng chn mt hoc nhiu i tng (bng cch nhn phm Shift khi chn i tng). Nt 2 (zoom bar): s dng biu tng ny m thanh cng c mi cho php xc nh phm vi mn hnh ca bn. Nt 3 (image toolbar): m thanh cng c mi cho php sa cha hnh. Nt 4 (pen): kch vo biu tng ny m thanh cng c lu cc cng c v. Nt 5 (line): kch vo y v cc ng thng. Nt 6 (rectangle): kch vo y v hnh ch nht. Nt 7 (rectangle frame tool): s dng biu tng ny v khung hnh ch nht. Nt 8 (ellipse): s dng biu tng ny v hnh elip. Nt 9 (ellipse frame tool): kch vo y v khung hnh elip. Nt 10 (airbrush): kch vo y s dng cng c phun mu. Nt 11 (color toolbar): s dng nt ny khi mun thit t li mu. Nt 12 (effects): to cc hiu ng trn nh hy nhn nt ny. Nt 13 (eyedropper): mt ca s xut hin cho php chn mu thay th cho cc mu sn c trong nh. b. Cc bc tng qut khi tin hnh v: Bc 1: t tr text ti v tr mun v hnh, chn mc Insert / Graphics / From Image Editor... Bc 2: trong hp thoi New Image xc nh kch thc cho khung v. Bc 3: chn mu cho hnh v trn thanh mu di y ca s. Bc 4: nhn chut trn nt cng c v, chn kiu hnh cn v. Bc 5: di chuyn tr chut n v tr cn v trn khung v, nhn v gi chut ti v tr xut pht, ng thi ko r tr chut v cc hng tng ng to hnh v. Bc 6: R chut trn mn hnh lm xut hin hnh v. Khi hnh v t yu cu v kch c, nh chut kt thc. c. Thay i li thuc tnh hnh v: Trnh son tho cung cp cc lnh nh dng li thuc tnh ca cc ho tit nh mu sc, v tr ... thay i thuc tnh ca ho tit bn thc hin cc thao tc sau: Chn khung cha ho tit cn thay i, kch chut phi v chn mc Edit t thc n c a ra.
Trang 25

KC-06-03CN

Hng dn s dng Staroffice

Chn cc mc tng ng thay i thuc tnh cho ho tit. Thay i mu sc: thay i v mu sc hy m thc n Colors trn thanh cng c. Chn thuc tnh v mu sc cn thay i. RGB Colors...: xc nh t l ca ba mu c bn. Brightness / Contrast...: xc nh chi v tng phn ca mu sc. Gamma Correction ...: xc nh gi tr gam mu hin th ca mn hnh. Convert to Grayscale: xc nh s mu ca nh. Invert: chuyn i mu nn ca khung hnh. Modify Color Depth: xc nh cc bit mu hin th Thay i mt s thuc tnh khc: hy m thc n Modify trn thanh thc n v chn thuc tnh cn thay i. Flip: ly i xng ca hnh theo chiu ngang (horizontally) hay chiu dc (vertically). Rotate: quay hnh i mt gc bt k (free rotation), quay gc 90o v bn tri (90 degree left) v 90o v bn phi (90 degree right). Modify size...: thay i li kch thc ca hnh. d. Mt s thao tc trn i tng ho: Xo: chn i tng cn xo, nhn phm Delete. Di chuyn: chn i tng, dng chut r i tng n v tr mi. Sao chp: chn i tng, gi Ctrl trong khi r i tng. Thay i kch thc: chn i tng, a tr chut n mt trong cc im vung bao quanh i tng sao cho bin thnh mi tn hai u, r chut thay i kch thc.
7.2 Cc i tng c nhng trong vn bn

Trong phn ny s m t mt s thao tc c bn vi i tng ho c nhng trong vn bn, l StarOffice Drawing. y l mt tin ch c trong b StarOffice, cho php bn to ra c nhng hnh nh phc tp hn. Chng ti cha i su vo vic m t tng chc nng c th ca n m ch dng li mt s cng c hu ch cho vic son tho vn bn m thi. c th chn mt i tng ho hay ni c th trong trng hp ny l to mi mt i tng ho s dng StarOffice Drawing, hy thc hin nh sau: Trn thanh thc n chn Insert / Object / OLE Object... Hp thoi Insert OLE Object xut hin.

Hnh 16: Nhng i tng ha


Trang 26

KC-06-03CN

Hng dn s dng Staroffice

Chn i tng c nhng l StarOffice 5.2 Drawing, kch vo mc Create new nu to mi nh hay sa i t mt nh c sn khi chn Create from file. Nhn OK khi la chn xong. Giao din ca StarOffice 5.2 Drawing c dng sau:

Hn h 17: Giao din ca StarOffice 5.2 Drawing

Hnh 18: Thanh cng c trong StarOffice 5.2 Drawing Trn thanh cng c v chnh ( bn tri mp mn hnh) c cc nt biu tng gip bn to hnh v vi phc tp ln. Sau y l mt s tnh nng c bn nht: Nt 1 (select): c s dng la chn vn bn. Nt 2 (room): s dng biu tng ny m thanh cng c mi cho php xc nh phm vi mn hnh ca bn. Nt 3 (text): cho php chn vn bn trong khi v. Nt 4 (rectangle): v cc kiu hnh ch nht. Nt 5 (ellipse): v cc kiu hnh elip. Nt 6 (3D object): v hnh khng gian 3 chiu. Nt 7 (curve): v cc ng cong. Nt 8 (Lines and arrows): v ng thng v mi tn. Nt 9 (connector): v ng gp khc. Nt 10 (effects): cc hiu ng trn hnh.
Trang 27

KC-06-03CN

Hng dn s dng Staroffice

Nt 11 (alignment): cn hnh. Nt 12 (arrange): sp xp hnh. Nt 13 (insert): chn thm i tng vo hnh. Nt 14 (form): to mt s form c bn. Nt 15 (3D controller): iu khin cch hin th cu hnh nh ba chiu.

Trang 28

KC-06-03CN

Hng dn s dng Staroffice

8. In n ti liu Thc hin lnh Print trong thc n File, hp thoi Print xut hin:

Hnh 19: Hp thoi Print Trong : Printer: xc nh mt s thng tin v my in nh tn my in (name), trng thi my in (status), kiu my in (type), v tr my in (location)... Print range: xc nh gii hn in l in tt c vn bn (all), in c th trang no (pages) hoc in theo vng la chn (selection). Copies: xc nh s bn in. Options...: kch hot nt ny khi mun xc lp mt s thng tin cn thit cho vic in n nh ni dung c in (contents), trang c in (pages) ...

Trang 29

KC-06-03CN

Hng dn s dng Staroffice

9. Cc tnh nng khc c trong trnh son tho vn bn


9.1 AutoCorrect

AutoCorrect l mt chc nng c bit, cho php chng trnh t ng sa mt s li "thng minh" khi g vn bn. Danh sch cc li ny c lu li v dng cho cc vn bn khc. Vic to cc ch mc nh cho AutoCorrect v nh ngha cc li thng gp c gi t lnh Tools / AutoCorrect/AutoFormat. Trong hp thoi AutoCorrect ta thy mt danh sch cc li c lit k di dng Replace/With (thay th - bi).

Hnh 21: Hp thoi AutoCorrect


9.2 To dng ch thch

Cc bc thc hin to ch thch nh sau: Chuyn du nhc tr ti v tr cu vn bn mun to ch thch. Thc hin lnh Insert / Footnote, hp hi thoi xut hin.

Hnh 22: Chn ch thch trong vn bn Trong hp thoi ch cc thng s sau: Numbering: xc nh kiu nh s ch thch l t ng hay chn mt k t bt k. Type: xc nh kiu ch thch.
Trang 30

KC-06-03CN 9.3 To mc lc

Hng dn s dng Staroffice

C hai cch to mc lc: Cch 1: To mc lc t cc tiu l cc on vn bn trong vn bn c p dng theo cc Style ngm nh. Cc Style ny thng c tn l Heading 1, Heading 2 ... Cch 2: To mc lc t cc nhm ch khng phi l tiu hoc khng c nh dng bng Style (entry). Chng ti ch cp n cch to mt mc lc theo cch 1: t tr text ti ni mun to mc lc. Thc hin Insert / Indexes / Indexes... Hp thoi Insert Index xut hin cho php la chn cc thng s cn thit. Nhn OK khi la chn xong.

Trang 31

KC-06-03CN

Hng dn s dng Staroffice

Trang 32

KC-06-03CN

Hng dn s dng Staroffice

Hng dn s dng bng tnh - Spreadsheet trong StartOffice 5.2

Ti liu hng dn s dng Spreadsheet s c 10 bi. Ni dung ca mi bi s c 3 phn chnh: phn 1 gii thiu v l thuyt, phn 2 l cc bi tp v hng dn s qua v cch lm cc bi tp l ni dung phn 3. Sau khi ci v chy StarOffce, bn tr vo New Spreadsheet trong danh sch cc ng dng to mt ng dng bng tnh mi.

Trang 33

KC-06-03CN

Hng dn s dng Staroffice

Bi 1 L thuyt
1. D liu D liu c g vo t bn phm v c th hin trn dng Nhp d liu v ti hin thi. Con tr text xut hin ngay trong d liu cho php cc thao tc tinh chnh trc tip vi s liu v cc k t ca d liu. Spreadsheet phn bit hai loi d liu: hng s v cng thc. Trong kiu hng s bao gm ch hoc s v kiu cng thc bao gm cc biu thc cha a ch hoc tn ca mt s hoc vng khc ca bng tnh, g cng thc phi bt u bng du =. 2. Khi nim a ch , a ch tuyt i v tng i. Giao ca cc hng v ct gi l . a ch bao gm a ch hng v a ch ct. Cc hng c nh s t 1 n 32000, cc ct c nh s theo A, B, n IV (256 ct). V d: hng 5 ct th 3 s c a ch l C5. Trong khi nhp d liu ta thng xuyn phi s dng a ch hoc vng tham chiu n cc hoc vng khc. Cch vit a ch thng thng c hiu l tng i vi hin thi.

Thc hnh
1. Chy ng dng Spreadsheet. 2. Nhp bng s liu theo mu (Hnh 1)

Hnh 1

Trang 34

KC-06-03CN

Hng dn s dng Staroffice

3. Sa li d liu theo ng mu (nu nhp sai). 4. Tnh cc ct Lng c bn, Tng theo cng thc: Lng c bn = H s lng * 20 USD* T gi hi oi Tng = Lng c bn + n tra Yu cu dng a ch tuyt i ca gi tr t gi hi oi tnh mc lng c bn. T thay i gi tr ca mc lng c bn. Trn hnh 2 l mt minh ho khi tnh vi t gi hi oi l 14500

Hnh 2

5.Ghi file vo a ti th mc ca mnh t to hoc bt k mt th mc no vi tn LUONG.sdc hoc LUONG.xls. 6. M file mi.

Trang 35

KC-06-03CN

Hng dn s dng Staroffice

7. Nhp s liu theo mu (Hnh 3).

Hnh 3

Trang 36

KC-06-03CN

Hng dn s dng Staroffice

8. Ghi file vo a vi tn QUI.sdc. Hng dn 1. Thc hin bc 2: - vo d liu, kch hot mt hoc chn vng cn vo d liu, g d liu v n Enter. - Ring ct STT c th vo nhanh nh sau: ti A6 g s 1. Chn A6, t tr chut ln Fill handle (hnh vung nh nm di vng chn) cho bin thnh du +, gi nt tri chut v r xung di m rng dy s (Data Series). Vo cng thc ti ct Lng c bn mt cch nhanh nht nh sau: Ti E6 g cng thc: = D6*20*$E$5 v n Enter. Chn E6, ko Fill handle ca n ti E15, khi cng thc s c sao chp. Hoc chn E6, kch nt phi chut xut hin thc n ngn. Kch tip vo lnh Copy, sau chn vng E7:E15 ri kch chut phi chn lnh Paste. Tng t bn vo cng thc ti ct Tng nh sau: ti G6 g cng thc sau: = E6 + F6 v n Enter Ch : - Trong khi nhp d liu, nu d liu b sai trong khi cha n Enter th c th sa trc tip trn dng nhp d liu. - Trong mi trng hp c th kch hot , g ni dung mi v n Enter th ni dung c b thay i ni dung mi. - xo nhanh ni dung trong cc no , hy chn cc v n phm Delete. - sa d liu no ch cn chn , n F2 v sa d liu trn dng nhp d liu trn dng nhp d liu v cui cng n Enter. 2. Ghi file vo a bng thc n File/Save hoc kch chut ti nt biu tng Save trn thanh cng c. 3. M file mi bng thc n File/New hoc chn biu tng New Spreadsheet trong danh sch cc ng dng. 4. Thc hin mu hnh 3 - Ta nhn thy ni dung ca vng A12:C14 v A24:C26 ging ni dung vng A1:A3, do thay v phi g li hai vng trn ta thc hin phng php sau: t tr ti A1, gi phm Shift ng thi kch chut ti C3 chn vng A1:C3, t tr chut ti vng va chn v kch nt phi chut xut hin thc n ngn, kch tip vo lnh Copy sau chn A12, kch nt phi chut xut hin thc n ngn, kch tip vo lnh Paste. - Sau khi sao chp xong bn sa d liu cc vng sao cho ph hp. - Tng t lm vi vng A24:C26. 5. Ghi file vo a bng thc n File/Save.
Trang 37

KC-06-03CN

Hng dn s dng Staroffice

Trang 38

KC-06-03CN

Hng dn s dng Staroffice

Bi 2
L thuyt
1. Tho tc vi bng tnh - Chn hng, ct, + Chn hng, ct, cn chn. + Thc hin lnh Insert/Cells. Nu chn ny th my s xut hin hp hi thoi Insert. Trong : Shift cells down: Chn v y hin thi xung di. Shift cells right: Chn v y hin thi sang phi. Entire row: Chn ton b hng vo v tr hin thi. Entire column: Chn ton b ct vo v tr hin thi. - Xo hng, ct, + Chn hng, ct, cn xo. + Thc hin lnh Edit/Delete. Nu chn ny th my s xut hin hp hi thoi Delete. Trong : Shift cells up: Xo v y pha di ln. Shift cells left: Xo v y bn phi sang tri. Delete entire row(s): Xo c hng hin thi cha c chn. Delete entire column(s): Xo c ct hin thi cha c chn. Ch : Lnh Insert/Rows(Insert/Column) dng chn cc hng(ct) ti v tr cc hng (ct) c chn. 2. Cc hm tnh ton trong Spreadsheet Trong Spreadsheet ta c th tin hnh cc tnh ton n gin v trc tip trn bng tnh da trn cc php ton nh: +(cng), - (tr), * (nhn), /(chia).... Ngoi ra ta c th s dng cc hm tnh ton sau: SUM(number1, number2,...): ly tng cc s number1, number2,... MAX (number1, number2,...): ly gi tr ln nht ca cc s number1, number2,... MIN (number1, number2,...): ly gi tr nh nht ca cc s number1, number2,... AVERAGE(number1, number2,...): ly trung bnh ca cc s .
Trang 39

KC-06-03CN

Hng dn s dng Staroffice

..... Hm IF: Tr li mt gi tr nu iu kin bn ch nh nhn gi tr v gi tr kia nu ngc li. C php: IF (logical_test; value_if_true; value_if_false) Trong : - logical_test l bt k gi tr hoc biu thc c nh gi l TRUE hay FALSE. - Value_if_true l gi tr c tr li nu logical_test l TRUE. Nu logical_test l TRUE v value_if_true khng c th hm tr li gi tr TRUE. Value_if_true c th l cng thc khc. - Value_if_false l gi tr c tr li nu logical_test l FALSE. Nu logical_test l FALSE v value_is_false khng c, hm s tr li gi tr FALSE. Value_if_false c th l cng thc khc. Hm AND, OR, NOT Hm AND: Tr li gi tr TRUE nu tt c cc i s nhn gi tr TRUE, tr li gi tr FALSE nu mt hoc nhiu i s l FALSE. C php: AND (logical1, logical2,...) trong : logical1, logical2,... l 1 ti 30 iu kin mun kim tra. Hm OR: tr li gi tr TRUE nu bt k mt i s l TRUE, tr li gi tr FALSE nu tt c cc i s l FALSE. C php: OR (logical1, logical2, ...) trong : logical1, logical2,... l 1 ti 30 iu kin mun kim tra. Hm NOT: l hm ph nh C php: NOT (logical) 3. To khun cho bng tnh. - Lnh to khun cho bng tnh: Sau khi nh du vng bng tnh cn to khun, lnh Format/Cells dng to khun dng tng th cho khi c nh du. Cc la chn tip theo trong hp hi thoi tng ng vi cc lnh to khun ring bit ca Spreadsheet. Number: lnh to khun s. Ta c th chn kiu to khun trong Category + General: nh dng chung + Number: dng nh ngha cc s thng thng. Chn cc thng s sau: Decimal places - s ch sau du chm thp phn, Use 1000 Separators(,) - dng du phy phn cch hng nghn, Negative number - chn cch nh dng s m. Trong hp Sample hin mu nh dng. + Accounting: k t tin t v du chm thp phn ca cc s c nh dng theo kiu ny s c dng thng hng. Chn cc thgn s sau: Decimal places Trang 40

KC-06-03CN

Hng dn s dng Staroffice

s ch s sau du chm thp phn, Symbol - chn k hiu tin t ca cc nc khc nhau(M, Anh, c,... ). Sample hin mu nh dng. + Date: nh dng ngy theo mu c chn trong hp Type. + Time: nh dng gi theo mu c trong hp Type.

+ Percent: nh dng theo kiu phn trm. S ch s sau du chm thp phn c chn trong hp Decimal Places. + Text: nh dng s theo kiu Text. + Special: nh dng theo m vng v s in thoi. + Custom: ty bin theo khun dng c g trong hp Type. Nt Delete c dng xo khun dng khng cn dng n. Font Lnh ny to khun cho cc k t.

Cc thng s v font ch bao gm: - font: Font ch. - Style: kiu ch (Bolt - m) - Size: kch thc ch. - Color: mu ch. - Cc kiu ch gch chn c m t ti v tr Underline (None - bnh thng, Single - gch di n, Double - gch di p, Single Accounting - gch n kiu ti chnh n cui mp phi ca , Double Accounting - gch p kiu ti chnh).
Trang 41

KC-06-03CN

Hng dn s dng Staroffice

-Cc hiu ng khc nhau nh Strikethrough (gch ngang), Superscript (ch cao), Subscript (ch thp) c chn ti hp Effects. - La chn Normal Font c dng nu mun ly li kiu trnh by ngm nh. Alignment Lnh ny dng dng hng cho d liu.

Cc thng s dng hng ca d liu trong cc bao gm: + Horizontal: dng hng ngang: General: text c dng hng tri, s c dng hng phi, cc gi tr logic v li (error) c dng hng gia. Left (indent) dng hng tri (trong hp Indent cho php Indent Text ti 15 mc trong ), Center - dng hng gia, Right - dng hng phi. Fill - t in y . Justify cn u hai bn. Trong trng hp rng ca ct nh hn ni dung bn trong n th t ng tng cao ca hng. Center across selection: dng vo gia vng c la chn. + Vertical: dng hng dc. Top, Center, Bottom - dng cho d liu vo nh, gia hoc y . Justify - t ng dng u theo chiu cao ca . - Orientation: chn hng text. Degrees: chn quay. - Text Control: Cc iu khin khc. Chn Wrap Text nu mun Text xung dng trong cc khi di hn rng hin thi ca . Chn Shrink to fit nu mun Text va kht trong cc khi cc b co hp. Chn Merge cells nu mun trn cc trn cng hng v cng ct. Sau khi trn, ch c d liu nm tri trn trong vng c chn hin trong c trn. Do , mun trn cha tt c d liu trong vng chn th trc khi trn phi sao chp ton b d liu vo tri trn. Borders Lnh to khung (ng vin) cho khi hin thi. Trong : - Preset: None - Hu k khung, Outline - k khung xung quanh khi , Inside k khung trong khi . - Border: p dng cho cc ca khi hin thi. Cho php chn tng ng vin ca mi trong khi bng cch kch chut vo tn nt xung quanh. - Line: Style - chn kiu ng k khung hin thi, Color - mu v ca ng k.

Trang 42

KC-06-03CN

Hng dn s dng Staroffice

Background Dng t mu cho cc c chn.

Trong : -Background color: mu nn. Trong No fill: hu t mu nn. -Preview: hin mu t theo cc thng s va c chn.

Thc hnh
1. M file LUONG.sdc. 2. i tn Sheet1 thnh BANG LUONG. 3. Sao chp Sheet BANG LUONG thnh Sheet mi v i tn thnh BANG LUONG TH. 4. Chn thm ct Trch nhim bn phi ct n tra v tnh tin trch nhim theo cng thc sau:

Trang 43

KC-06-03CN

Hng dn s dng Staroffice

Ph cp trch nhim l 100000 i vi ngi c h s lng ln hn hoc bng 6, l 70000 i vi ngi c h s lng trong khong 5 n 6 v l 50000 i vi ngi c h s lng nh hn 5. 5. Chn thm ct Thng 8/3 bn phi ct Trch nhim v in gi tr theo cng thc sau: (hnh 4) Thng 50000 cho nhn vin l n con nam khng c thng.

Hnh 4

6. Tnh ct Tng lng theo cng thc. Tng lng = Lng c bn + n tra + Trch nhim + Thng 8/3 7. Tnh tng lng ton c quan, tnh trung bnh lng ton c quan. Tnh ngi c mc lng cao nht v thp nht ca c c quan (theo hnh 5).

Hnh 5

Hng dn

1. M file LUONG.sdc bng thc n File/Open hoc kch vo nt biu tng trn thanh cng c.
Trang 44

KC-06-03CN

Hng dn s dng Staroffice

2. i tn Sheet1 thnh BANG LUONG: t tr chut ti tn Sheet1 trn Danh sch cc Module(Sheet Tab) nm pha di cc bng tnh, kch nt chut phi xut hin mt thc n ngn, chn lnh Rename trong thc n . Xut hin hp hi thoi. Trong hp name ta g tn bng tnh mi (BANG LUONG). Kch vo nt chn OK. Chn Sheet BANG LUONG l Sheet lm vic. Chn lnh Edit/Move or Copy Sheet. Xut hin hp hi thoi. Kch chut ti la chn Creat a Copy. Kch vo nt tu chn OK.

3. Sao chp Sheet BANG LUONG thnh Sheet mi v i tn.

Ch : Mt Sheet mi c to ra vi tn BANG LUONG(2) c ni dung hon ton ging vi ni dung ca Sheet BANG LUONG. i tn Sheet BANG LUONG (2) thnh BANG LUONG TH. 4. Chn ct Trch nhim vo bn phi ct n tra Vo cng thc ti ct trch nhim mt cch nhanh nht nh sau: Ti G8 g cng thc: = if(D8>=6;100000;if(D8>=5;70000;50000)) v n Enter. Tng t chn thm ct Thng 8/3 bn phi ct Trch nhim v vo cng thc ti ct nh sau: ti H8 g cng thc: = if(C8=N;50000;0) v n Enter. Vo cng thc ti ct Tng lng nh sau: ti H8 g cng thc = E8+F8+G8+H8 v n phm Enter. 5. Thc hin bc 7: Tnh tng, chn nh gn gi tr tng, kch vo nt AutoSum v dng chut chn vng s liu nh tnh tng v n Enter. p dng: tnh tng lng ton c quan hy kch chut ti l18, kch vo nt AutoSum, xut hin cng thc = SUM(l8:l17) trn vng l8:l17 c mt khung mu xanh bao quanh. Sau khi n Enter trn l18 xut hin kt qu tnh tng ca cc l8 n l17. Tnh trung bnh ta s dng hm AVERAGE (N1, N2,...). p dng: Tnh trung bnh lng ton c quan: ti l19 bn g cng thc sau: = AVERAGE(l8;l9;l10;l11;l12;l13;l14;l15;l16;l17) v n Enter lc ny trn 19 xut hin kt qu tnh trung bnh ca cc l8 dn l17. Tnh lng cao nht (hoc thp nht) ta s dng hm MAX(hoc MIN) = MAX(l8;l9;l10;l11;l12;l13;l14;l15;l16;l17) v n Enter. Tng t, tnh lng thp nht bng hm MIN. 5. Ghi file vo a bng lnh File/Save.
Trang 45

p dng: Tnh lng cao nht: bn hy kch chut ti l20 v g cng thc sau:

KC-06-03CN

Hng dn s dng Staroffice

Trang 46

KC-06-03CN

Hng dn s dng Staroffice

Bi 3 L thuyt
1. Khi nim c s d liu(Database) D liu( hay c s d liu - vit tt l CSDL) l tp hp cc d liu c sp xp trn mt vng ch nht ca bng tnh theo quy nh sau: Dng u tin ghi cc tiu ca d liu, mi tiu l mt ct. Cc tiu ny c gi l trng (field) ca d liu. T dng th hai tr i l s liu ca c s d liu hin thi. Mi dng l mt bn ghi. Nh vy, mi bn ghi l tp hp c s d liu i din cho tt c cc trng ca CSDL. Qun tr d liu trong Spreadsheet bao gm cc cng vic sp xp, tm kim, kt xut v cc thao tc trc tip vi bn ghi v trng ca CSDL. 2. Sp xp d liu. Lnh sp xp d liu c thc hin theo cc bc sau y: nh du vng d liu cn sp xp. Thc hin lnh Data/Sort, xut hin hp hi thoi.

Trong hp hi thoi c cc thng s sau: Vi nhn Sort Criteria

Trang 47

KC-06-03CN

Hng dn s dng Staroffice

Kho sp xp (ti a l 3 kho sp xp ng vi cc ct hoc hng ca vng d liu). Cc kho ny c t ti cc v tr Sort by. Th t sp xp theo kho tng ng c xc nh bng cch chn hoc Ascending (tng) hoc Descending (gim). Vi nhn Options trong hp hi thoi ny cho php chn cc cch sp xp vi kho sp xp l hng hoc ct. + Case sensitive: Sp xp phn bit ch hoa, ch thng. Chn OK thc hin sp xp.

Thc hnh
1. M file QUI.XLS. 2. i tn Sheet 1 thnh THU CHI. 3. Sao chp 3 bng d liu thu chi ca 3 ca hng thnh 1 bng d liu vo Sheet 2 v sp xp li theo ngy (Hnh 5). 4. i tn Sheet 2 thnh QUI.

Trang 48

KC-06-03CN

Hng dn s dng Staroffice

5. Sao chp vo vng khc ca bng tnh, sp xp li theo Loi v nu Loi trng nhau th sp xp theo Ca hng.

6. Tch bng trn ra lm hai bng thu v chi ring, sau tnh tng s tin (tng thu v tng chi) ca tng ca hng (dng SubTotal). 7. Sao chp hnh 6 sang vng khc v sp li theo Loi. Nu Loi trng nhau th sp theo SHTK. Tch bng trn thnh hai bng thu v chi ring.(Hnh 6)

Hnh 6

Trang 49

KC-06-03CN

Hng dn s dng Staroffice

8. Kt xut thnh cc bo co khc nhau theo mu (Hnh 7).

Hnh 4

Hnh 7

9. Tng hp kt qu theo tng ti khon (dng SubTotal).


Hng dn

1. M file QUI.sdc bng thc n File/Open hoc kch chut ti nt biu tng trn thanh cng c. 2. Sao chp: Trc khi sao chp bn hy chn thm ct ca hng trc ct S tin . Ti cc E4, E16, E28 g Ca hng. Nhp s 1 t E5 n E10, s 2 t E17 n E23, s 3 t E29 n E33. + nh du vng cn sao chp: Kch chut ti A4, gi Shift v kch chut ti F10, chn vng A4:F10. + Gi phm Ctrl kch chut ti A17, gi phm Shift kch chut ti F23, chn vng A17: F23. + Gi phm Ctrl kch chut ti A29, gi phm Shift v kch chut ti F33, chn vng A29:F33. + Kch chut ti biu tng Copy trn thanh cng c sao chp khi va nh du vo b m.
Trang 50

KC-06-03CN

Hng dn s dng Staroffice

+ Kch chut ti tn Sheet 2 trn danh sch cc module m bng tnh mi. Kch chut ti A1 v kch phi chut xut hin mt thc n ngn chn Paste, khi d liu trong b m s xut hin ln mn hnh. 3. Sp xp d liu: sp xp d liu trong bng tnh bn nh du vo vng d liu cn sp xp v thc hin lnh Data/Sort. V d: sp xp li vng d liu trong Sheet 2 theo Ngy ta lm nh sau: p dng: sp xp li vng d liu trong Sheet2 theo Ngy ta lm nh sau: + t tr ti A1, gi Shift ng thi kch chut ti F19 nh du vng A1:F19. + Thc hin Data/Sort. Xut hin hp hi thoi c hai nhn l Sort v Option + Trong hp Sort by nhn Sort ta chn trng Ngy lm kha cn sp xp. + Chn nt OK thc hin. 4. Sao chp vng d liu trn vo mt vng khc trn bng tnh: nh du vng A1:F19. - Thc hin lnh Edit/Copy hoc kch chut ti biu tng Copy trn thanh cng c a d liu vo b m. t tr ti A22, kch phi chut xut hin mt thc n ngn chn Paste dn d liu t b m vo v tr mi. 5. Sp xp li vng d liu va sao chp theo Loi v nu Loi trng nhau th sp xp theo Ca hng. Kch chut ti A22, gi phm Shift ng thi kch chut ti F40 nh du vng A22: F40. Thc hin Data/ Sort xut hin hp hi thoi. Trong hp Sort By chn trng Loi lm kha sp xp th nht. Trong hp Then By chn trng Ca hng lm kho sp xp th hai. Chn nt OK thc hin. nh du vng A33: F35. Thc hin lnh Insert/Cell. Xut hin hp hi thoi. + + + Chn Shift Cell Down. Chn nt OK thc hin. Sao chp vng A22:F22 vo vng A35:F35.

6. Chia bng thnh 2 phn thu v chi ring.

7. Tnh tng dng Subtotal. Tnh tng ca tng ca hng. + + + nh du vng cn tnh tng A22:F32 Thc hin lnh Data/Sub Total. Xut hin hp hi thoi. Trong hp Group by chn trng Ca hng.
Trang 51

KC-06-03CN

Hng dn s dng Staroffice

+ Trong hp Calculate Subtotals for chn trng S tin lm trng cn tnh ton. + Trong hp Use Function: Chn hm Sum. + Chn nt OK thc hin. Sau khi nhn nt OK trn vng d liu t ng phn tch thnh cc nhm d liu ca mi ca hng xut hin cc gi tr tnh ton ti cui mi nhm (Sum total 1, Sum total 2, Sum total 3 ). Cui cng l mt dng tng kt (Grand Total). Ta c th i tn ca cc nhm d liu trn. - Tnh tng thu ca tng ca hng: thc hin tng t nh phn tnh tng chi ca tng ca hng. 8. Cu 9 - Lm tng t nh trn theo hnh 8:

Hnh 8

Trang 52

KC-06-03CN

Hng dn s dng Staroffice

Bi 4 L thuyt
1. Lc d liu bng AutoFilter Lc cho php tm kim, lc thng tin theo cc iu kin cho trc ca d liu. Auto Filter l cch nhanh nht chn cc bn ghi trong danh sch. + + To Auto Filter nh du vng d liu nh lc. Thc hin Data/Filter.

+ Chn Auto Filter: SpreadSheet s t ng chn nhng mi tn th xung (drop down arrows) vo bn phi ca cc tn trng trong CSDL. + + Kch vo mi tn ti ct cha d liu dng lm tiu chun lc. Chn mt trong cc la chn ti drop-down menu: [All]: hin ton b cc bn ghi. [Blanks]: ch hin nhng bn ghi trng. [Nonblanks]: ch hin nhng bn ghi khng trng. [Top 10...]: hin ton b cc bn ghi trong gii hn c xc nh r ( cao hn hoc thp hn), bi i tng (item) hay t l phn trm (percentage). [.Standard Filter...]: la chn vi nhng ton t so snh. Phn cn li l danh sch gi tr ca bn ghi trong CSDL ti ct .
Thc hnh

1. M file LUONG.sdc. 2. Kch hot Sheet BANGLUONG TH 3. Lc v kt xut ra danh sch lng ca cc nhn vin n (Hnh 9).

4. Lc v kt xut danh sch lng nhng ngi c h s lng trong khong t 5.0 ti 7.0. (Hnh 10)

Hnh 10

Trang 53

KC-06-03CN

Hng dn s dng Staroffice

5. Ghi file LUONG.sdc vo a. 6. M file QUI.sdc 7. Lc v kt xut tnh tng hp doanh thu, chi ph hnh chnh v lu thng ca ton cng ty (ti khon doanh thu c bt u bi s 4, ti khon chi ph hnh chnh v lu thng bt u bi s 3). Sau sp xp li theo loi thu v chi ( Hnh 11 ). 8. Ghi file QUI.sdc vo a.
Hng dn

1. M file LUONG.sdc bng thc n File/Open. 2. Lc v kt xut ra cc danh sch lng ca cc nhn vin n. - nh du vng A7:l17. - Thc hin lnh Data/Filter/AutoFilter. - Sau khi thc hin SpreadSheet t ng chn cc mi tn th xung bn phi cc trng hin c trong vng d liu. - Kch vo mi tn ca trng Gii tnh v kch chn i tng l N trong danh sch va xut hin. SpreadSheet s chn lc v hin th danh sch cc nhn vin n trn mn hnh, lc ny bn ch vic thc hin thao tc sao chp cc danh sch sang vng mi. 3. Lc v kt xut danh sch lng nhng ngi c h s lng trong khong t 5.0 n 7.0. - Kch chut vo mi tn ca trng Gii tnh v la chn All hin tt c cc bn ghi ca ton b c s d liu. - Kch chut vo mi tn ca trng H s lng: chn la chn Standard Filter. Xut hin mt hp hi thoi.

- Trong mi tn trn cng bn tri ca hp H s lng ta chn (>=), trong hp bn cnh ta g s 5. - Ti mi tn th 2 chn (<=), trong hp bn cnh g s 7. - Trong phn ton t logic gia hai iu kin chn And. - Chn nt OK thc hin. SpreadSheet s chn lc v hin th danh sch nhng nhn vin tho mn nhng iu kin trn ra mn hnh, lc ny bn ch vic thc hin thao tc sao chp cc danh sch sang vng mi. 4. Hng dn cu 7 nh du vng A1: F19.

Trang 54

KC-06-03CN

Hng dn s dng Staroffice

Thc hin lnh Data/Filter/AutoFilter.

- Sau khi thc hin Spread Sheet t ng chn cc mi tn th xung bn phi cc trng hin c trong vng d liu. - Kch chut vo mi tn ca trng SHTK v chn la chn Custom. - Ta s dng cc k t i din g iu kin: Trong mi tn trn cng bn tri ca hp SHTK ta chn (=), trong hp bn cnh ta g s 4*. - Ti mi tn th hai chn (=), trong hp bn cnh g s 3*. - Chn ton t logic OR. Chn nut OK thc hin SpreadSheet s chn lc v hin th danh sch nhng bn ghi tho mn iu kin trn ra mn hnh, lc ny bn ch vic thc hin thao tc sao chp cc danh sch sang vng mi v sp xp li theo thu v chi.

Trang 55

KC-06-03CN

Hng dn s dng Staroffice

Trang 56

KC-06-03CN

Hng dn s dng Staroffice

Bi 5
L thuyt
1. Lc d liu bng Advanced Filter - Advanced Filter dng tm cc bn ghi tho mn iu kin phc tp hn. y l chc nng lc nng cao tng ng vi cc tiu chun so snh gin tip. s dng Advancer Filter bt buc phi dng vng tiu chun lc d liu. Cc bc thc hin: - To vng tiu chun. - nh du vng CSDL cn khai thc. Thc hin Data/Filter. Chn Advacer Filter. Xut hin hp hi thoi. Trong : 2. S dng cc hm d liu DSUM(database, field, criteria): Tnh tng gi tr ca trng (field) trong CSDL (Database) tho mn iu kin trong vng tiu chun (Crieria). DAVERAGE(database, field, criteria): Tnh trung bnh cng ca trng (field) trong CSDL (Database) tho mn iu kin trong vng tiu chun. DCOUNT(database, field, criteria): m tng ca nhng bn ghi trong CSDL trn trng khai thc tho mn iu kin trong vng tiu chun. DMAX (database, field, criteria): Tm gi tr ln nht ca trng (field) trong CSDL(Database) tho mn iu kin trong vng tiu chun. DMIN(database, field, criteria): tm gi tr nh nht ca trng (field) trong CSDL (Database) tho mn iu kin trong vng tiu chun.
Thc hnh

1. M file LUONG.sdc, kch hot Sheet BANG LUONG TH. 2. Lc v kt xut danh sch nhng ngi c tn l H.(Hnh ) 3. Lc v kt xut danh sch lng ca nhng ngi c h l Nguyn v gii tnh l Nam. 4. Tnh tng lng, trung bnh lng, lng cao nht v thp nht ca nam trong c quan (Dng cc hm DSUM, DAVERAGE, DMAX, DMIN, DCOUNT) (Hnh ). 5. ng file LUONG.sdc 6. M file QUI.sdc, kch hot Sheet QUI. 7. Lc v kt xut cc khon thu trong ngy 14/1/2001 v ngy 25/1/2001 8. Lc v kt xut tng thu bn cc lai ph tng (Hnh ). 9. Dng hm DSUM tnh tng tin chi theo ti khon 34. Dng hm DAVERAGE tnh trung bnh s tin thu theo ti khon 403. (Hnh ).
Trang 57

KC-06-03CN Hng dn

Hng dn s dng Staroffice

tm v kt xut d liu bng phng php Advanced Filter phi c 3 vng sau: - Vng c s d liu. - Vng tiu chun. - Vng kt xut. Trong vng kt xut c th c hoc khng nhng vng c s d liu v vng tiu chun bt buc phi c. p dng vo cu 2 ta phi thc hin cc bc sau: - By gi bn hy to vng tiu chun. Vng tiu chun c dng sau: Ti K1 v K2 bn g: Ch rng, tiu chun trn ch hin trn dng nhp d liu. Khi n Enter trn hin ln ch FALSE. nh du vng c s d liu (A7:l17). Data/Filter/ Advanced Filter. Xut hin mt hp hi thoi. Trong hp Action kch chn Copy to Another Location.

- Trong hp List Range: khai bo vng c s d liu. Trong trng hp ny bn ch kim tra xem vng tiu chun m mnh va nh du c ng khng nu khng ng hy sa li. Trong hp Crieria Range: khai bo vng iu kin. Kch chut trong hp Copy to sao cho xut hin tr text

Trang 58