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.
25
Embed
Partea a II-a: Sisteme de operare · 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,
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
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
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
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
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
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