Вы находитесь на странице: 1из 46

Securitatea Sistemelor de Calcul

Florin Anton
Linux utilizare de baza Partea 1

Cuprins

Terminale virtuale, login & logout

Utilizare tastatura & mouse

Istoria de comenzi

Fisiere & directoare

Partitii & directoare partajate

VIM

Alte editoare

Documentatia Linux

Utilizatori si mesaje

Utilitare

Runlevel-uri

Grub

Terminale Virtuale, login & logout


7 terminale virtuale
(CRTL +) ALT + Fn, n=1...7

Logout:
logout
exit
CTRL + D

Blocarea terminalelor
vlock -a
screen saver

Utilizare tastatura & mouse


Utilizare tastatura
<ctrl-c> - opreste executia comenzii curente
<ctrl-d> - incheierea transmisiei
<tab>
- completarea comenzii
<arrow up>, <arrow down> - comanda
anterioara, urmatoare
<shift page-up>, <shift page-down> - ecranul
anterior, urmator
<ctrl-R> - se cauta o comanda in istoria de
comenzi

Utilizare tastatura & mouse


Utilizare Mouse (in consola)
Left click: marcheaza startul unei selectii
Right click: marcheaza incheierea unei selectii
Left drag: marcheaza o selectie
Middle click: se face paste la selectie
* (programul gpm trebuie se fie in executie)

Istoria de comenzi
history
history <number of lines>
!-1

!!

!200

Fisiere & directoare


/
/bin /boot
/media

/dev

/etc /home /lib

/mnt /opt
/usr /var

/proc /root /sbin /tmp

...

Fisiere & directoare


pwd

od, hexdump, strings

cd
ls -alR, file
touch, rm -irf
mkdir -p, rmdir -p
cat, less, more
cp -R, mv, split bytes=SIZE PREFIX

Partitii & directoare partajate


fdisk -l
mount -t fstype -o options device
mount_point
umount device/mount_point
/etc/fstab
smbclient -L //server -N -U user%password
smbmount
9

Partitii & directoare partajate


/etc/fstab

/dev/sda3 /

ext3

defaults,usrquota

11

/dev/sda2

/boot

ext3

defaults

12

none

/dev/pts

devpts gid=5,mode=620

00

none

/dev/shm

tmpfs

defaults

00

none

/proc

proc

defaults

00

none

/sys

sysfs

defaults

00

/dev/sda1

swap

swap defaults

00

/dev/hda

/media/cdrom

auto

owner,noauto,ro

00

/dev/fd0

/media/floppy

auto

owner,noauto

00

10

VIM
Comenzi vi
Moduri (Comanda: ESC, Edit: i, Ex: ':')
Deplasare cursor la nivel de caracter (sageti, sau h,k,l,j)
Deplasare cursor la nivel de linie/fisier (^,$, 1G, G)
Undo: u
Cut: dd, 2dd, 5dd, etc
Copy: yy, 2yy, 5yy, etc
Paste: p
Cautare: /pattern
Cautare & Inlocuire: 1,$s/old/new/g
%s/old/new/g

11

VIM
Comenzi vi

Iesire fara salvare: :q


Iesire fortata: :q!
Salvare: w
Salvare fortata: w!
Salvare si iesire: :wq

12

VIM
Optiuni vi

:set all
:set number/nonumber
:set ignorecase/noignorecase
:set tx/notx
:set hlsearch/nohlsearch
:syntax on/off
13

Alte editoare
nano, pico, jed, mcedit
gedit, kedit, kate

14

Documentatia Linux
man
man -k, apropos, makewatis
info
HOWTO
command --help
/usr/share/doc
Internet
15

Documentatia Linux
NAME
man - format and display the on-line manual pages
SYNOPSIS
man [-acdfFhkKtwW] [--path] [-m system] [-p string] [-C config_file] [-M pathlist] [-P pager] [-S section_list] [section] name ...
DESCRIPTION
man formats and displays the on-line manual pages. If you specify section, man
............................................
OPTIONS
-C config_file
Specify the configuration fi
SEE ALSO
apropos(1), whatis(1), less(1), groff(1), man.conf(5).
BUGS
The -t option only works if a troff-like program is installed.
FILES
..............................................................

16

Documentatia Linux
Sectiuni Man
Sectiune
1
2
3
4
5
6
7
8
9

Topica
Comenzi disponibile utilizatorilor
Apeluri sistem (Unix si C)
Rutine din libraria C
Nume speciale de fisiere
Formate si conventii pentru fisiere
Jocuri
Pachete de procesare de ti Word processing
Comenzi si proceduri pentru administrarea sistemului
Kernel
17

Utilizatori si mesaje
who, whoami, who am i
finger
echo
write, wall, talk, mesg y/n
18

Utilizatori si mesaje
[root@station ~]# finger florin
Login: florin
Directory: /home/florin

Name: Florin ANTON


Shell: /bin/bash

Never logged in.


Mail forwarded to \florin@station.ro
Mail last read Fri Oct 30 12:19 2009 (EET)
No Plan.
19

Utilitare
find
locate, updatedb
cut, grep, egrep, sort
head, tail
type, which, whereis
gzip, gunzip, zcat, bzip2, bunzip2, tar
20

Runlevel-uri
/etc/inittab
init <runlevel>
id:5:initdefault
reboot, poweroff, shutdown
startx
21

Grub
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
password --md5 $1$oEzI/y7l$owGqE5UhbY6ofd/YtxAjr.
title CentOS-4 i386 (2.6.9-42.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.ELsmp ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.9-42.ELsmp.img
title CentOS-4 i386-up (2.6.9-42.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.EL ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.9-42.EL.img

22

Bibliografie

Red Hat Enterprise Linux 5 Deployment Guide

http://www.tldp.org

23

Securitatea Sistemelor de Calcul

Florin Anton
Linux utilizare de baza Partea 1

Cuprins

Terminale virtuale, login & logout

Utilizare tastatura & mouse

Istoria de comenzi

Fisiere & directoare

Partitii & directoare partajate

VIM

Alte editoare

Documentatia Linux

Utilizatori si mesaje

Utilitare

Runlevel-uri

Grub

Terminale Virtuale, login & logout


7 terminale virtuale
(CRTL +) ALT + Fn, n=1...7

Logout:
logout
exit
CTRL + D

Blocarea terminalelor
vlock -a
screen saver

Utilizare tastatura & mouse


Utilizare tastatura
<ctrl-c> - opreste executia comenzii curente
<ctrl-d> - incheierea transmisiei
<tab>
- completarea comenzii
<arrow up>, <arrow down> - comanda
anterioara, urmatoare
<shift page-up>, <shift page-down> - ecranul
anterior, urmator
<ctrl-R> - se cauta o comanda in istoria de
comenzi

Utilizare tastatura & mouse


Utilizare Mouse (in consola)
Left click: marcheaza startul unei selectii
Right click: marcheaza incheierea unei selectii
Left drag: marcheaza o selectie
Middle click: se face paste la selectie
* (programul gpm trebuie se fie in executie)

Istoria de comenzi
history
history <number of lines>
!-1

!!

!200

Fisiere & directoare


/
/bin /boot
/media

/dev

/etc /home /lib

/mnt /opt
/usr /var

/proc /root /sbin /tmp

...

Fisiere & directoare


pwd

od, hexdump, strings

cd
ls -alR, file
touch, rm -irf
mkdir -p, rmdir -p
cat, less, more
cp -R, mv, split bytes=SIZE PREFIX

Partitii & directoare partajate


fdisk -l
mount -t fstype -o options device
mount_point
umount device/mount_point
/etc/fstab
smbclient -L //server -N -U user%password
smbmount
9

Partitii & directoare partajate


/etc/fstab

/dev/sda3 /

ext3

defaults,usrquota

11

/dev/sda2

/boot

ext3

defaults

12

none

/dev/pts

devpts gid=5,mode=620

00

none

/dev/shm

tmpfs

defaults

00

none

/proc

proc

defaults

00

none

/sys

sysfs

defaults

00

/dev/sda1

swap

swap defaults

00

/dev/hda

/media/cdrom

auto

owner,noauto,ro

00

/dev/fd0

/media/floppy

auto

owner,noauto

00

10

VIM
Comenzi vi
Moduri (Comanda: ESC, Edit: i, Ex: ':')
Deplasare cursor la nivel de caracter (sageti, sau h,k,l,j)
Deplasare cursor la nivel de linie/fisier (^,$, 1G, G)
Undo: u
Cut: dd, 2dd, 5dd, etc
Copy: yy, 2yy, 5yy, etc
Paste: p
Cautare: /pattern
Cautare & Inlocuire: 1,$s/old/new/g
%s/old/new/g

11

VIM
Comenzi vi
Iesire fara salvare: :q
Iesire fortata: :q!
Salvare: w
Salvare fortata: w!
Salvare si iesire: :wq

12

VIM
Optiuni vi
:set all
:set number/nonumber
:set ignorecase/noignorecase
:set tx/notx
:set hlsearch/nohlsearch
:syntax on/off
13

Alte editoare
nano, pico, jed, mcedit
gedit, kedit, kate

14

Documentatia Linux
man
man -k, apropos, makewatis
info
HOWTO
command --help
/usr/share/doc
Internet
15

Documentatia Linux
NAME
man - format and display the on-line manual pages
SYNOPSIS
man [-acdfFhkKtwW] [--path] [-m system] [-p string] [-C config_file] [-M pathlist] [-P pager] [-S section_list] [section] name ...
DESCRIPTION
man formats and displays the on-line manual pages. If you specify section, man
............................................
OPTIONS
-C config_file
Specify the configuration fi
SEE ALSO
apropos(1), whatis(1), less(1), groff(1), man.conf(5).
BUGS
The -t option only works if a troff-like program is installed.
FILES
..............................................................

16

Documentatia Linux
Sectiuni Man
Sectiune
1
2
3
4
5
6
7
8
9

Topica
Comenzi disponibile utilizatorilor
Apeluri sistem (Unix si C)
Rutine din libraria C
Nume speciale de fisiere
Formate si conventii pentru fisiere
Jocuri
Pachete de procesare de ti Word processing
Comenzi si proceduri pentru administrarea sistemului
Kernel
17

Utilizatori si mesaje
who, whoami, who am i
finger
echo
write, wall, talk, mesg y/n
18

Utilizatori si mesaje
[root@station ~]# finger florin
Login: florin
Directory: /home/florin

Name: Florin ANTON


Shell: /bin/bash

Never logged in.


Mail forwarded to \florin@station.ro
Mail last read Fri Oct 30 12:19 2009 (EET)
No Plan.
19

Utilitare
find
locate, updatedb
cut, grep, egrep, sort
head, tail
type, which, whereis
gzip, gunzip, zcat, bzip2, bunzip2, tar
20

find PATH -name 'test*' -print -exec file {} \;


-ok file {}\;
-type f
d
-size +n
-n
nc
-mtime +x
-x
x
-perm
onum
mode
-user user
-newer ref.file
-o
-a
cut -f -d files
cut -c files

Runlevel-uri
/etc/inittab
init <runlevel>
id:5:initdefault
reboot, poweroff, shutdown
startx
21

Grub
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
password --md5 $1$oEzI/y7l$owGqE5UhbY6ofd/YtxAjr.
title CentOS-4 i386 (2.6.9-42.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.ELsmp ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.9-42.ELsmp.img
title CentOS-4 i386-up (2.6.9-42.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.EL ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.9-42.EL.img

22

Bibliografie
Red Hat Enterprise Linux 5 Deployment Guide
http://www.tldp.org

23