Differences

This shows you the differences between two versions of the page.

Link to this comparison view

info1:laboratoare:02 [2020/10/20 11:29]
alexandru.vochescu
info1:laboratoare:02 [2020/10/20 11:32] (current)
alexandru.vochescu
Line 403: Line 403:
  
  
-{{page>​uso:​laboratoare:​ac:​laborator-01:​cheatsheet&​nofooter&​noeditbutoon}}+====== Sumar Cheatsheet ======
  
 +===== Căi în ierarhia de fișiere =====
 +
 +==== Calea curentă ====
 +
 +<code bash>
 +student@uso:​~$ pwd
 +/​home/​student
 +</​code>​
 +==== Cale relativă și cale absolută ====
 +
 +Cale relativă:
 +
 +<code bash>
 +student@uso:​~$ ls -l snap/​spotify/​
 +total 8
 +drwxr-xr-x 5 student student 4096 Oct  2 03:11 42
 +drwxr-xr-x 3 student student 4096 Oct  2 03:10 common
 +lrwxrwxrwx 1 student student ​   2 Oct  2 03:10 current -> 42
 +</​code>​
 +Cale absolută:
 +
 +<code bash>
 +student@uso:​~$ ls -l /​home/​student/​snap/​spotify
 +total 8
 +drwxr-xr-x 5 student student 4096 Oct  2 03:11 42
 +drwxr-xr-x 3 student student 4096 Oct  2 03:10 common
 +lrwxrwxrwx 1 student student ​   2 Oct  2 03:10 current -> 42
 +</​code>​
 +==== Schimbarea căii curente ====
 +
 +<code bash>
 +student@uso:/​etc$ pwd
 +/etc
 +student@uso:/​etc$ cd /usr
 +student@uso:/​usr$ pwd
 +/usr
 +</​code>​
 +==== Scurtături de căi ====
 +
 +Caracterul ''​%%-%%'':​
 +
 +<code bash>
 +student@uso:​~$ pwd
 +/​home/​student
 +student@uso:​~$ cd /usr/bin/
 +student@uso:/​usr/​bin$ pwd
 +/usr/bin
 +student@uso:/​usr/​bin$ cd -
 +/​home/​student
 +student@uso:​~$ cd -
 +/usr/bin
 +student@uso:/​usr/​bin$ cd -
 +/​home/​student
 +student@uso:​~$ cd -
 +/usr/bin
 +</​code>​
 +Caracterul ''​%%~%%'':​
 +
 +<code bash>
 +student@uso:/​usr/​bin$ cd /tmp/
 +student@uso:/​tmp$ pwd
 +/tmp
 +student@uso:/​tmp$ cd ~
 +student@uso:​~$ pwd
 +/​home/​student
 +student@uso:​~$ cd /​usr/​bin/​X11/​
 +student@uso:/​usr/​bin/​X11$ pwd
 +/​usr/​bin/​X11
 +student@uso:/​usr/​bin/​X11$ cd ~
 +student@uso:​~$ pwd
 +/​home/​student
 +</​code>​
 +===== Interacțiunea cu fișiere în linia de comandă =====
 +
 +==== Ierarhie de fișiere ====
 +
 +<code bash>
 +student@uso:​~$ tree -L 1 /
 +/
 +|-- bin
 +|-- boot
 +|-- dev
 +|-- etc
 +|-- home
 +|-- initrd.img -> /​boot/​initrd.img-3.16.0-4-586
 +|-- lib
 +|-- lib64
 +|-- libx32
 +|-- lost+found
 +|-- media
 +|-- mnt
 +|-- opt
 +|-- proc
 +|-- root
 +|-- run
 +|-- sbin
 +|-- srv
 +|-- sys
 +|-- tmp
 +|-- usr
 +|-- var
 +``-- vmlinuz -> boot/​vmlinuz-3.16.0-4-586
 +</​code>​
 +==== Afișarea conținutului unui director ====
 +
 +<code bash>
 +student@uso:​~/​Avengers$ ls
 +Captain America ​ Iron Man  Thor
 +</​code>​
 +<code bash>
 +student@uso:​~$ ls -l
 +(...)
 +-rw-rw-r-- 1 student student ​   0 Oct 13 13:02  cities
 +-rw-rw-r-- 1 student student ​   0 Oct 13 13:03 '​cities in romania'​
 +-rw-r--r-- 1 student student 8980 Sep 24 09:00  examples.desktop
 +-rw-rw-r-- 1 student student ​   0 Oct 13 13:02  romania
 +drwxr-xr-x 4 student student 4096 Oct  2 03:11  snap
 +</​code>​
 +==== Crearea fișierelor ====
 +
 +<code bash>
 +student@uso:​~$ ls cities
 +ls: cannot access cities: No such file or directory
 +student@uso:​~$ touch cities
 +student@uso:​~$ ls cities
 +cities
 +</​code>​
 +==== Crearea directoarelor ====
 +
 +<code bash>
 +student@uso:​~$ mkdir GameOfThrones
 +student@uso:​~$ mkdir Avengers
 +student@uso:​~$ ls -l
 +(...)
 +drwxr-xr-x 2 student student 4096 Sep 29 17:43 Avengers
 +(...)
 +drwxr-xr-x 2 student student 4096 Sep 29 17:43 GameOfThrones
 +(...)
 +</​code>​
 +==== Afișarea conținutului unui fișier ====
 +
 +<code bash>
 +student@uso:​~$ cat GameOfThrones/​Arya
 +A girl has no name
 +</​code>​
 +==== Ștergerea fișierelor ====
 +
 +<code bash>
 +student@uso:​~$ ls Avengers/
 +Captain America ​ Hulk  Iron Man  Thor
 +student@uso:​~$ rm Avengers/​Hulk
 +student@uso:​~$ ls Avengers/
 +Captain America ​ Iron Man  Thor
 +</​code>​
 +==== Ștergerea directoarelor ====
 +
 +<code bash>
 +student@uso:​~$ mkdir LordOfTheRings
 +student@uso:​~$ ls -l
 +total 12
 +drwxr-xr-x 2 student student 4096 Sep 29 18:02 Avengers
 +drwxr-xr-x 2 student student 4096 Sep 29 17:44 GameOfThrones
 +drwxr-xr-x 2 student student 4096 Sep 29 18:09 LordOfTheRings
 +student@uso:​~$ rmdir "​LordOfTheRings"​
 +student@uso:​~$ ls -l
 +total 8
 +drwxr-xr-x 2 student student 4096 Sep 29 18:02 Avengers
 +drwxr-xr-x 2 student student 4096 Sep 29 17:44 GameOfThrones
 +</​code>​
 +==== Redenumirea și mutarea fișierelor și directoarelor ====
 +
 +<code bash>
 +student@uso:​~$ ls
 +GameOfThrones
 +student@uso:​~$ mv GameOfThrones ThroneOfGames
 +student@uso:​~$ ls
 +ThroneOfGames
 +</​code>​
 +==== Copierea fișierelor și directoarelor ====
 +
 +<code bash>
 +student@uso:​~$ cp Avengers/​Thor /tmp/
 +student@uso:​~$ ls /tmp/
 +Thor  ssh-ApUMKI3HSJ
 +</​code>​
info1/laboratoare/02.1603182565.txt.gz · Last modified: 2020/10/20 11:29 by alexandru.vochescu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0