Partea a II-a: Sisteme de operare · Partea a II-a: Sisteme de operare 1 Sistemul Unix. Introducere...

25
85 Partea a II -a: Sisteme de operare 1 Sistemul Unix. Introducere UNIX este un sistem de operare care a fost creat în 1960 -o dezvoltare. -user, multi-tasking pentru accesibile prin e elemente comune. Cele de la firma Apple. programe. 1.1 Nucleul Nucleul este partea c sistem. Un exemplu relevant poate fi acela în care shell- tru îndeplinirea unor comenzi, spre exemplu rm myfile. Shell- shell-ul returneaza prompterul userului alte comenzi. 1.2 Interpretorul de comenzi Interpretorul de comenzi sau shell- numele de shell. Acesta este un executate. Utilizatorul poate adapta Shell-ul propriu, chiar utiliza hell-uri diferite. Cele mai utilizate shell-uri sunt sh, bash, csh, tcsh.

Transcript of Partea a II-a: Sisteme de operare · Partea a II-a: Sisteme de operare 1 Sistemul Unix. Introducere...

85

ParteaaII-a:Sistemedeoperare

1 SistemulUnix.IntroducereUNIX este un sistem de operare care a fost creat în 1960 -o

dezvoltare. -user, multi-tasking pentru

accesibile prin

e elemente comune. Cele

de la firma Apple.

programe.

1.1 NucleulNucleul este partea c

sistem. Un exemplu relevant poate fi acela în

care shell- tru îndeplinirea unor comenzi, spre exemplu rm myfile. Shell-

shell-ul returneaza prompterul userului alte comenzi.

1.2 InterpretoruldecomenziInterpretorul de comenzi sau shell-

numele de shell. Acesta este un

executate. Utilizatorul poate adapta Shell-ul propriu, chiar

utiliza hell-uri diferite. Cele mai utilizate shell-uri sunt sh, bash, csh, tcsh.

86

Shell-ul bash are facilitatea de a completa numele scris

care potrivesc atunci shell-

1.3 man, apropos, info comenzile Unix;

Sintaxa

man [optiuni] comanda

Exemplu de rulare

[cipak@cipsoft ~] man ls

LS(1) User Commands LS(1) NAME ls - list directory contents SYNOPSIS ls [OPTION]... [FILE]... DESCRIPTION List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuSUX nor --sort. Mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and ..

87

--author with -l, print the author of each file -b, --escape print octal escapes for nongraphic characters --block-size=SIZE use SIZE-byte blocks -B, --ignore-backups do not list implied entries ending with ~ -c with -lt: sort by, and show, ctime (time of last modification of file status information) with -l: show ctime and sort by name otherwise: sort by ctime

2

2.1 Comandapwdpwd ;

Sintaxa

pwd

Exemplu de rulare

[cipak@cipsoft ~] pwd

/home/cipak

2.2 Comandalsls ;

Sintaxa

ls [optiuni] ... fisier ... catalog

-

88

-

-

man ls.

Exemplu de rulare

[cipak@cipsoft ~] $ ls -l

total 8 drwxr-xr-x 2 cipak users 4096 Feb 17 23:48 cipak_work -rw------- 1 cipak users 0 Nov 5 2006 Drafts drwxr-xr-x 9 cipak users 4096 Jan 14 22:07 public_html -rw------- 1 cipak users 0 Nov 5 2006 Sent -rw------- 1 cipak users 0 Nov 5 2006 Trash -rw-r--r-- 1 cipak users 0 Feb 23 17:07 unu.txt

2.3 Comandacdcd s ;

Sintaxa

cd nume_director

Exemplu de rulare

[cipak@cipsoft ~] $ cd public_html

[cipak@cipsoft public_html] $

2.4 Comandamkdirmkdir ;

-p ot, nu ;

89

Exemplu de rulare

[cipak@cipsoft ~] $ mkdir test

[cipak@cipsoft ~] $ ls l

total 8 drwxr-xr-x 2 cipak users 4096 Feb 17 23:48 cipak_work -rw------- 1 cipak users 0 Nov 5 2006 Drafts drwxr-xr-x 9 cipak users 4096 Jan 14 22:07 public_html -rw------- 1 cipak users 0 Nov 5 2006 Sent drwxr-xr-x 1 cipak users 0 Feb 26 17:07 test -rw------- 1 cipak users 0 Nov 5 2006 Trash

2.5 Comandarmdirrmdir ;

- ;

Exemplu de rulare

[cipak@cipsoft ~] $ mkdir p a/b/c

[cipak@cipsoft ~] $ ls l

total 8 drwxr-xr-x 1 cipak users 0 Feb 26 17:07 a drwxr-xr-x 2 cipak users 4096 Feb 17 23:48 cipak_work -rw------- 1 cipak users 0 Nov 5 2006 Drafts drwxr-xr-x 9 cipak users 4096 Jan 14 22:07 public_html -rw------- 1 cipak users 0 Nov 5 2006 Sent -rw------- 1 cipak users 0 Nov 5 2006 Trash [cipak@cipsoft ~] $ rmdir p a/b/c

[cipak@cipsoft ~] $ ls l

total 7

drwxr-xr-x 2 cipak users 4096 Feb 17 23:48 cipak_work -rw------- 1 cipak users 0 Nov 5 2006 Drafts drwxr-xr-x 9 cipak users 4096 Jan 14 22:07 public_html -rw------- 1 cipak users 0 Nov 5 2006 Sent

90

-rw------- 1 cipak users 0 Nov 5 2006 Trash

2.6 Comandarmrm ;

Sintaxa

rm [optiuni] ... fisiere ... cataloage ...

- recursiv;

- ;

Exemplu de rulare

[cipak@cipsoft ~] $ mkdir test

[cipak@cipsoft ~] $ ls l

total 8 drwxr-xr-x 2 cipak users 4096 Feb 17 23:48 cipak_work -rw------- 1 cipak users 0 Nov 5 2006 Drafts drwxr-xr-x 9 cipak users 4096 Jan 14 22:07 public_html -rw------- 1 cipak users 0 Nov 5 2006 Sent drwxr-xr-x 1 cipak users 0 Feb 26 17:07 test -rw------- 1 cipak users 0 Nov 5 2006 Trash [cipak@cipsoft ~] $ rm r test

[cipak@cipsoft ~] $ ls l

total 7 drwxr-xr-x 2 cipak users 4096 Feb 17 23:48 cipak_work -rw------- 1 cipak users 0 Nov 5 2006 Drafts drwxr-xr-x 9 cipak users 4096 Jan 14 22:07 public_html -rw------- 1 cipak users 0 Nov 5 2006 Sent -rw------- 1 cipak users 0 Nov 5 2006 Trash

2.7 Comandacatcat le date ca argument ;

91

Sintaxa

cat [option] [file] ...

Exemplu de rulare

[cipak@cipsoft ~] $ cat /etc/passwd /etc/group

root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin cipak:x:500:500:Ciprian-Bogdan Chirila:/home/cipak:/bin/bash student:x:501:501:Student:/home/student:/bin/bash 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 tty:x:5: disk:x:6:root lp:x:7:daemon,lp mem:x:8: kmem:x:9: wheel:x:10:root mail:x:12:mail cipak:x:500: student:x:501:

2.8 Comandacpcp ;

Sintaxa

cp [option] ... source dest

cp [option] ... source directory

92

- ;

-i mod interactiv;

-r, .

Exemplu de rulare

[cipak@cipsoft ~] $ cp /etc/*.conf .

[cipak@cipsoft ~] $ ls -l

total 260 -rw-r--r-- 1 cipak cipak 17 Mar 4 20:06 host.conf -rw-r--r-- 1 cipak cipak 8505 Mar 4 20:06 htdig.conf -rw-r--r-- 1 cipak cipak 1752 Mar 4 20:06 identd.conf -rw-r--r-- 1 cipak cipak 658 Mar 4 20:06 initlog.conf -rw-r--r-- 1 cipak cipak 5955 Mar 4 20:06 ldap.conf -rw-r--r-- 1 cipak cipak 119 Mar 4 20:06 ld.so.conf -rw-r--r-- 1 cipak cipak 2434 Mar 4 20:06 lftp.conf -rw-r--r-- 1 cipak cipak 213 Mar 4 20:06 lilo.conf -rw-r--r-- 1 cipak cipak 516 Mar 4 20:06 logrotate.conf-rw-r--r-- 1 cipak cipak 17735 Mar 4 20:06 lpd.conf -rw-r--r-- 1 cipak cipak 762 Mar 4 20:06 named.conf -rw-r--r-- 1 cipak cipak 12 Mar 4 20:06 pam_smb.conf -rw-r--r-- 1 cipak cipak 1362 Mar 4 20:06 pbm2ppa.conf -rw-r--r-- 1 cipak cipak 14566 Mar 4 20:06 pine.conf

2.9 Comandamvmv ;

Sintaxa

mv [option]... source dest

mv [option]... source... directory

- - -

93

Exemplu de rulare

[cipak@cipsoft cipak]$ > alfa.txt [cipak@cipsoft cipak]$ ls alfa.txt [cipak@cipsoft cipak]$ mkdir test [cipak@cipsoft cipak]$ ls alfa.txt test [cipak@cipsoft cipak]$ mv alfa.txt test [cipak@cipsoft cipak]$ ls test [cipak@cipsoft cipak]$ ls test alfa.txt

2.10 Comandalnln ;

Sintaxa

ln [option]... target linkname ln [option]... target... directory

-

-superutilizatorul root);

-

Exemplu de rulare

[cipak@cipsoft cipak]$ echo mesaj > alfa.txt [cipak@cipsoft cipak]$ ln s beta.txt alfa.txt [cipak@cipsoft cipak]$ ls l total 4 -rw-rw-r-- 1 cipak cipak 6 Mar 12 22:01 alfa.txt lrwxrwxrwx 1 cipak cipak 8 Mar 12 22:03 beta.txt -> alfa.txt

[cipak@cipsoft cipak]$ ln alfa.txt gama.txt [cipak@cipsoft cipak]$ ls il total 12 426037 -rw-rw-r-- 2 cipak cipak 6 Mar 12 22:01 alfa.txt 426038 lrwxrwxrwx 1 cipak cipak 8 Mar 12 22:03 beta.txt -> alfa.txt 426037 -rw-rw-r-- 2 cipak cipak 6 Mar 12 22:01 gama.txt

94

2.11 Comandachmodchmod - cataloagelor;

Sintaxa

chmod [option] ... mode,[mode] ... file ...

iuni

-

Moduri

4000 executabile care au acest bit setat se vor executa cu uid-ul efectiv al proprietarului de

2000 care au acest bit setat se vor executa cu gid-ul efectiv

1000

directoarelor setate cu acest bit nu se va permite modific

-un astfel de regim este /tmp.

0400

0200 permite scr

0100

0040

0020 grup;

0010

0004

95

0002 i;

0001

pentru proprietar, citire 400 + 200 + 100 + 040 + 010 + 004 + 001.

mod ::= clauza [, clauza ...]

clauza ::= [cine ...] [actiune ...] actiune

actiune ::= op [perm ...]

cine ::= a | u | g | o

op ::= + | - | =

perm ::= r | s | t | w | x | X | u | g | o

Simbolurile din grupul cine a este echivalent cu simbolurile ugo

Simbolurile din grupul perm

r

s

t

w ii pentru drepturile de scriere;

x

Operatorii din grupul op

cine perm vor fi setati;

- cine perm vor

96

cine perm vor fi setati, iar restul vor fi

Exemplu de rulare

[cipak@cipsoft ~] $ > alfa.txt

[cipak@cipsoft ~] $ chmod 755 alfa.txt

[cipak@cipsoft ~] $ ls -l

total 0

-rwxr-xr-x 1 cipak cipak 0 Mar 4 19:41 alfa.txt

[cipak@cipsoft ~] $ chmod 644 alfa.txt

[cipak@cipsoft ~] $ ls -l

total 0

-rw-r--r-- 1 cipak cipak 0 Mar 4 19:41 alfa.txt

[cipak@cipsoft ~] $ chmod o+w alfa.txt

[cipak@cipsoft ~] $ ls -l

total 0

-rwxr-xrwx 1 cipak cipak 0 Mar 4 19:41 alfa.txt

[cipak@cipsoft ~] $ chmod u-x alfa.txt

[cipak@cipsoft ~] $ ls -l

total 0

-rw-r-xrwx 1 cipak cipak 0 Mar 4 19:41 alfa.txt

2.12 Comandachownchown set ;

Sintaxa

chown [optiuni]... owner[:[grup]] files...

97

-R recursiv; - ; -H

; -L un director ce a fost întâlnit; -P ;

Exemplu de rulare

[cipak@cipsoft cipak]$ > alfa.txt

total 0

-rwxr-xrwx 1 cipak cipak 0 Mar 4 19:41 alfa.txt

[cipak@cipsoft cipak]$ su root

[cipak@cipsoft cipak]$ chown root.root alfa.txt

[cipak@cipsoft cipak]$ ls -l

total 0

-rwxr-xrwx 1 root root 0 Mar 4 19:41 alfa.txt

3 Comenzipentrucontrolulproceselor

3.1 Comandapsps ;

Sintaxa

ps [options]

- ;

, inclusiv cele ale altor useri;

98

Exemplu de rulare

[cipak@cipsoft cipak]$ ps aux

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.2 1412 520 ? S Mar05 0:04 init [5] root 2 0.0 0.0 0 0 ? SW Mar05 0:00 [keventd] root 3 0.0 0.0 0 0 ? SW Mar05 0:00 [kapm-idled] root 4 0.0 0.0 0 0 ? SWN Mar05 0:00 [ksoftirqd_CPU0]root 5 0.0 0.0 0 0 ? SW Mar05 0:00 [kswapd] root 6 0.0 0.0 0 0 ? SW Mar05 0:00 [kreclaimd] root 7 0.0 0.0 0 0 ? SW Mar05 0:00 [bdflush] root 8 0.0 0.0 0 0 ? SW Mar05 0:00 [kupdated] root 9 0.0 0.0 0 0 ? SW< Mar05 0:00 [mdrecoveryd] root 13 0.0 0.0 0 0 ? SW Mar05 0:00 [kjournald] root 88 0.0 0.0 0 0 ? SW Mar05 0:00 [khubd] root 600 0.0 0.2 1472 620 ? S Mar05 0:00 syslogd -m 0 root 605 0.0 0.4 2084 1192 ? S Mar05 0:00 klogd -2 rpc 625 0.0 0.2 1552 588 ? S Mar05 0:00 portmap rpcuser 653 0.0 0.2 1596 760 ? S Mar05 0:00 rpc.statd root 765 0.0 0.2 1396 524 ? S Mar05 0:00 /usr/sbin/apmd -proot 838 0.0 0.4 2676 1272 ? S Mar05 0:00 /usr/sbin/sshd root 871 0.0 0.3 2264 960 ? S Mar05 0:00 xinetd -stayaliveroot 911 0.0 0.8 5640 2068 ? S Mar05 0:00 sendmail: acceptiroot 939 0.0 0.0 0 0 ? SW Mar05 0:00 [scsi_eh_0] root 958 0.0 0.1 1440 484 ? S Mar05 0:00 gpm -t ps/2 -m /droot 976 0.0 0.2 1584 660 ? S Mar05 0:00 crond xfs 1046 0.0 1.4 5132 3780 ? S Mar05 0:00 xfs -droppriv -daroot 1064 0.0 0.4 3252 1164 ? S Mar05 0:00 smbd -D root 1069 0.0 0.4 2432 1112 ? S Mar05 0:05 nmbd -D daemon 1105 0.0 0.2 1444 568 ? S Mar05 0:00 /usr/sbin/atd root 1128 0.0 0.1 1384 448 tty1 S Mar05 0:00 /sbin/mingetty ttroot 1129 0.0 0.1 1384 448 tty2 S Mar05 0:00 /sbin/mingetty ttroot 1130 0.0 0.1 1384 448 tty3 S Mar05 0:00 /sbin/mingetty ttroot 1131 0.0 0.1 1384 448 tty4 S Mar05 0:00 /sbin/mingetty ttroot 1132 0.0 0.1 1384 448 tty5 S Mar05 0:00 /sbin/mingetty ttroot 1133 0.0 0.1 1384 448 tty6 S Mar05 0:00 /sbin/mingetty ttroot 1134 0.0 0.6 6204 1716 ? S Mar05 0:00 /usr/bin/gdm -nodroot 1142 0.0 0.7 6224 1900 ? S Mar05 0:00 /usr/bin/gdm -nodroot 1143 0.0 0.6 18612 1536 ? S Mar05 0:00 /etc/X11/X :0 -augdm 1148 0.0 1.3 7048 3340 ? S Mar05 0:00 /usr/bin/gdmlogingdm 1149 0.0 2.1 8512 5384 ? S Mar05 0:00 /usr/bin/xsri --rroot 32734 0.0 0.8 3568 2080 ? S 13:26 0:00 /usr/sbin/sshd cipak 32735 0.0 0.5 2496 1336 pts/0 S 13:26 0:00 -bash cipak 1236 0.0 0.2 2632 720 pts/0 R 17:44 0:00 ps aux

3.2 Comandakillkill trimite un semnal unui proces sau grup de procese, implicit se trimite semnalul TERM;

Sintaxa

kill [-s signal | -p ] [--] pid ...

99

pid poate fi: n unde n>0, procesul cu identificatorul n va fi semnalizat; 0 tuturor procesele din grupul curent de procese li se va transmite semnalul; -1 tuturor proceselor cu id-ul mai mare decât 1 li se va transmite semnalul; -n unde n>1, tuturor proceselor din grupul de procese n li se va transmite semnalul. - specifica ca nume sau

- - -un semnal.

Exemplu de rulare

[cipak@cipsoft cipak]$ ps PID TTY TIME CMD 10168 pts/0 00:00:00 bash 10359 pts/0 00:00:00 ps 10450 pts/0 00:00:00 emacs [cipak@cipsoft cipak]$ kill -9 10450 [cipak@cipsoft cipak]$ ps PID TTY TIME CMD 10168 pts/0 00:00:00 bash 10359 pts/0 00:00:00 ps

3.3 Comandaww ;

Sintaxa

w [husfV] [user]

- -procesor;

100

Exemplu de rulare

[cipak@cipsoft cipak]$ w

9:26am up 5 days, 20:24, 1 user, load average: 0.12, 0.08, 0.02 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT cipak pts/0 192.168.1.203 9:16am 0.00s 0.07s 0.00s w

4 Comenzipentruadministrareasistemului

4.1 Comandadatedate data în formatul curent sau ;

Sintaxa

date [option]... [+FORMAT] date [-u|--utc|--universal] [MMDDhhmm [[CC] YY] [.ss]]

Exemplu de rulare

[cipak@cipsoft cipak]$ date Wed Mar 09:21:17 EET 2009

4.2 Comandawhowho ;

Sintaxa

who [option]... [file | arg1 arg2]

Exemplu de rulare

[cipak@cipsoft cipak]$ who cipak pts/0 Mar 11 09:16 (192.168.1.203) [cipak@cipsoft cipak]$ who am i cipsoft!cipak pts/0 Mar 11 09:16 (192.168.1.203) [cipak@cipsoft cipak]$ who mom likes

101

cipsoft!cipak pts/0 Mar 11 09:16 (192.168.1.203)

4.3 Comandalastlast ;

Sintaxa

last [-R] [-num] [-n num] [-adiox] [-f file] [name...] [tty...]

-num este ; -n num idem ca mai sus; - ;

Exemplu de rulare

[cipak@cipsoft cipak]$ last -20

cipak pts/0 192.168.1.248 Thu Mar 12 20:58 still logged in cipak pts/1 192.168.1.203 Wed Mar 11 09:27 - 09:27 (00:00) cipak pts/0 192.168.1.203 Wed Mar 11 09:16 - 11:23 (02:06) cipak pts/0 192.168.1.203 Mon Mar 9 13:26 - 19:26 (05:59) reboot system boot 2.4.7-10 Thu Mar 5 13:02 (7+09:11) cipak pts/0 192.168.1.203 Wed Mar 4 19:59 - 20:53 (00:54) cipak pts/0 192.168.1.203 Wed Mar 4 19:34 - 19:59 (00:24) cipak pts/0 192.168.1.203 Sun Mar 1 23:51 - 00:15 (00:23) cipak pts/0 192.168.1.248 Sun Mar 1 17:52 - 19:43 (01:50) wtmp begins Sun Mar 1 17:52:23 2009

4.4 Comandahostnamehostname ;

Sintaxa

hostname [-v] {hostname |-F file} hostname [-v] [-d|-f|-s|-a|-i|-y|-n]

- ; - ; - ; - ;

102

- ; - ; Exemplu de rulare

[cipak@cipsoft cipak]$ hostname f

cipsoft.graphics.cs.utt.ro

4.5 Comenzile mount sistemului;

umount nt;

Sintaxa

mount [-fnrsvw] [-t vsftype] [-o options] device dir

-t este tipu : iso9660 pentru imaginile de CD; ; ; ; - -only; - -write;

Exemplu de rulare

[cipak@cipsoft cipak]$ mount t iso9660 /dev/cdrom /mnt/cdrom /dev/hda1 on / type ext3 (rw) none on /proc type proc (rw) usbdevfs on /proc/bus/usb type usbdevfs (rw) none on /dev/pts type devpts (rw,gid=5,mode=620) none on /dev/shm type tmpfs (rw) /dev/cdrom on /mnt/cdrom type iso9660 (r)

4.6 Comandadudu ;

103

Sintaxa

du [option]... [file]...

- ; - ; - ; --max- ; - ;

Exemplu de rulare

[cipak@cipsoft cipak]$ du h s .

721M .

4.7 Comandadfdf

Sintaxa

df [option]... [file]...

- ;

- ;

- ;

Exemplu de rulare

[cipak@cipsoft cipak]$ df

Filesystem 1k-blocks Used Available Use% Mounted on /dev/hda1 9358644 4407272 4475976 50% / none 127796 0 127796 0% /dev/shm

[cipak@cipsoft cipak]$ df -h

Filesystem Size Used Avail Use% Mounted on /dev/hda1 8.9G 4.3G 4.2G 50% / none 125M 0 124M 0% /dev/shm

104

5

5.1 Comandaheadhead - linii dintr-

Sintaxa

-c =[- -

-n =[--

Exemplu de rulare

[cipak@cipsoft cipak]$ head /etc/passwd

root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin news:x:9:13:news:/var/spool/news:

5.2 Comandatailtail -dintr-

Sintaxa

tail

105

-

-

Exemplu de rulare

[cipak@cipsoft cipak]$ tail /etc/passwd

named:x:25:25:Named:/var/named:/bin/false pcap:x:77:77::/var/arpwatch:/bin/nologin amanda:x:33:6:Amanda user:/var/lib/amanda:/bin/bash junkbust:x:73:73::/etc/junkbuster:/bin/bash mailman:x:41:41:GNU Mailing List Manager:/var/mailman:/bin/falsemysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash ldap:x:55:55:LDAP User:/var/lib/ldap:/bin/false pvm:x:24:24::/usr/share/pvm3:/bin/bash cipak:x:500:500:Ciprian-Bogdan Chirila:/home/cipak:/bin/bash student:x:501:501:Student:/home/student:/bin/bash

5.3 Comandawcwc

Sintaxa

wc

-

-

-

Exemplu de rulare

[cipak@cipsoft cipak]$ wc -l /etc/passwd

65 /etc/passwd

5.4 Comandasortsort

106

Sintaxa

sort

- ;

- ;

- ;

Exemplu de rulare

[cipak@cipsoft cipak]$ sort /etc/passwd

adm:x:3:4:adm:/var/adm:/sbin/nologin amanda:x:33:6:Amanda user:/var/lib/amanda:/bin/bash apache:x:48:48:Apache:/var/www:/bin/false bin:x:1:1:bin:/bin:/sbin/nologin cipak:x:500:500:Ciprian-Bogdan Chirila:/home/cipak:/bin/bash daemon:x:2:2:daemon:/sbin:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin gdm:x:42:42::/var/gdm:/sbin/nologin gopher:x:13:30:gopher:/var/gopher:/sbin/nologin halt:x:7:0:halt:/sbin:/sbin/halt ident:x:98:98:pident user:/:/sbin/nologin junkbust:x:73:73::/etc/junkbuster:/bin/bash ldap:x:55:55:LDAP User:/var/lib/ldap:/bin/false lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin mailman:x:41:41:GNU Mailing List Manager:/var/mailman:/bin/falsemailnull:x:47:47::/var/spool/mqueue:/dev/null mail:x:8:12:mail:/var/spool/mail:/sbin/nologin mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash named:x:25:25:Named:/var/named:/bin/false news:x:9:13:news:/var/spool/news: nobody:x:99:99:Nobody:/:/sbin/nologin nscd:x:28:28:NSCD Daemon:/:/bin/false ntp:x:38:38::/etc/ntp:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin pcap:x:77:77::/var/arpwatch:/bin/nologin postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash pvm:x:24:24::/usr/share/pvm3:/bin/bash

107

radvd:x:75:75:radvd user:/:/bin/false root:x:0:0:root:/root:/bin/bash rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin rpc:x:32:32:Portmapper RPC user:/:/bin/false rpm:x:37:37::/var/lib/rpm:/bin/bash shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown squid:x:23:23::/var/spool/squid:/dev/null student:x:501:501:Student:/home/student:/bin/bash sync:x:5:0:sync:/sbin:/bin/sync uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin xfs:x:43:43:X Font Server:/etc/X11/fs:/bin/false

5.5 Comandagrepgrep

Sintaxa

grep [options] pattern [file...]

-

- înainte de liniile unde a avut loc potrivirea tiparului;

-

-

Exemplu de rulare

[cipak@cipsoft cipak]$ grep cipak /etc/passwd

cipak:x:511:100:Ciprian-Bogdan CHIRILA:/home/cipak:/bin/bash

6 Comenzipentruoperareasupraperifericelor

6.1 Comandatartar

Sintaxa

108

tar [options] [archive] [filename...] [directory...]

-

-

-

-

-

-

Exemplu de rulare

[cipak@cipsoft cipak]$ tar cvzf etc.tgz /etc/passwd

[cipak@cipsoft cipak]$ ls *.tgz

etc.tgz

[cipak@cipsoft cipak]$ tar xvzf etc.tgz

[cipak@cipsoft cipak]$ ls

etc etc.tgz

6.2 Comandamkfsmkfs

Sintaxa

mkfs [-V] [-t fstype] [fs-options] filesys [blocks]

-ext3;

-

109

Exemplu de utilizare

[root@cipsoft root]# mkfs t ext3 /dev/hdb1