Professional Documents
Culture Documents
SO 04 - Structura SO
SO 04 - Structura SO
SO 04 - Structura SO
1
Pipes, redirection and REGEX
Redirecting both STDERR and STDOUT with &>
3
New Unix/Linux commands
find – used to find files corresponding to a certain
criteria
find starting_dir matching_criteria [options]
find [starting directory] [search option] [search criteria] [result option]
Examples:
find /usr –name startx
find /etc -name hosts 2> errors.txt
find /etc -name hosts 2> /dev/null
find /etc -name hosts -ls 2> /dev/null
find /usr –name ‘*tif’
find . –name dir05 –type d (d – directory, f - file) 4
find command
Search files by size:
find /etc –size +300 (size more than 300 blocks – one
block is 512 bytes)
When you specify a file size, you can give the size in bytes (c),
kilobytes (k), megabytes (M) or gigabytes (G)
sysadmin@localhost:~$ find /etc -size 10c -ls 2>/dev/null
(finds files that are exactly 10 bytes large)
find . –mtime +5
(matches files modified more than 5 days ago)
find ~ –perm 777
find ~ –user stud03 –ls > listastud03 5
Using multiple options for find command
03.11.2022
As an example, the following command will display all files in
the /etc directory structure that are 10 bytes in size and are plain
files:
6
Using the cut Command to Filter File Contents
03.11.2022
with delimited database files.
sysadmin@localhost:~$ cut -d: -f1,5-7 mypasswd
root:root:/root:/bin/bash
7
Using the cut Command to Filter File
Contents
Using the cut command, you can also extract columns of text
based upon character position with the -c option. This can be
useful for extracting fields from fixed-width database files. For
03.11.2022
example, the following will display just the file type (character
#1), permissions (characters #2-10) and filename (characters
#50+) of the output of the ls -l command:
9
Regular expressions
• A Regular Expression is a collection of "normal" and "special"
characters that are used to match simple or complex patterns.
Normal characters are alphanumeric characters which match
themselves. For example, an a would match an a.
03.11.2022
Regular Expression Matches
. Any single character
03.11.2022
abcddd
$ grep 'a..c' example.txt
03.11.2022
abcddd
Note that you can either list out each possible
12
Regular expressions -
examples
To indicate that you want to match a character that is not one of
the listed characters, start your [ ] set with a ^ symbol. For
example, the following will demonstrate matching a pattern that
includes a character that isn't an a, b or c followed by a d:
03.11.2022
$ grep '[^abc]d' example.txt
abcddd
13
Regular expressions -
examples
When you perform a pattern match, the match could occur
anywhere on the line. You may want to specify that the match
occurs at the beginning of the line or the end of the line. To match
at the beginning of the line, begin the pattern with a ^ symbol.
03.11.2022
In the following example, another line is added to
the example.txt file to demonstrate the use of the ^ symbol:
$ echo "xyzabc" >> example.txt
03.11.2022
xyzabc
$ grep "cd*" example.txt
http://zota.ase.ro/so
• Componente
• Apeluri de sistem
• Integrarea componentelor
• Maşina virtuală
Managementul proceselor
Managementul memoriei principale
Managementul fişierelor
Managementul sistemului I/O
Managementul memoriei secundare
Conectarea la reţea
Sistemul de protecţie
Sistemul de interpretare al comenzilor
Componente de
Structura SO sistem
Managementul proceselor
Un proces este o instanţă a unui program în execuţie (un program este pasiv,
un proces este activ).
Un proces are diverse resurse (timp UCP alocat, fişiere) şi atribute ce trebuie
administrate.
Managementul proceselor include:
Managementul I/O
· Sistemul “buffer caching”
· Cod generic pentru drivere de echipamente
· Drivere pentru fiecare dispozitiv - translatează cererile de
citire/scriere în comenzi de poziţionare pe disc
Programe de sistem
• Compilatoare/link-editoare/asambloare, etc.
• Comunicaţii (ftp, telnet, ssh, etc.)
• Interpretoare de comenzi – programe ce preiau secvenţe de control
(comenzi) (shell, interfaţă grafică)
Componente de
Structura SO sistem
Exemple de
apeluri de sistem:
“Asamblarea”
Structura SO componentelor
SO
O structură simplă:
MS-DOS
Programarea aplicaţiilor
Drivere MS-DOS
Manipularea întreruperilor ocupă cel mai mult din timpul nucleului NT, o
întrerupere NT fiind generată pentru fiecare interacţiune a subsistemelor
administratorului NT.
Nucleul NT rulează în mod privilegiat şi de aceea nu poate fi niciodată
expulzat din memorie.
Structura SO Administratorul NT
Utilizatorul virtual
Utilizatorul fizic
Maşina virtuală
VirtualBox (Sun/Oracle) -
http://www.virtualbox.org/wiki/VirtualBox
VMware -
http://www.vmware.com/products/player/faqs.html
QEMU – wiki.qemu.org