16-03-2021

This commit is contained in:
2021-03-16 06:57:22 +01:00
parent fb07a20b0c
commit e02b036875
27 changed files with 1860 additions and 128 deletions

View File

@@ -5,13 +5,13 @@
Créer une archive tar: **tar -cvf**
```bash
root@DiskStation:~ # tar -cvf archive.tar .profile .bashrc test-dossier/
$ tar -cvf archive.tar .profile .bashrc test-dossier/
```
Afficher le contenu de l'archive sans l'extraire: **tar -tf**
```bash
root@DiskStation:~ # tar -tf archive.tar
$ tar -tf archive.tar
.profile
.bashrc
test-dossier/
@@ -21,9 +21,9 @@ test-dossier/test-copy-scp.txt
Ajouter un fichier à l'archive: **tar -rvf**
```bash
root@DiskStation:~ # tar -rvf archive.tar .bash_history
$ tar -rvf archive.tar .bash_history
root@DiskStation:~ # tar -tf archive.tar
$ tar -tf archive.tar
.profile
.bashrc
test-dossier/
@@ -34,7 +34,7 @@ test-dossier/test-copy-scp.txt
Extraire les fichiers de l'archive: **tar -xvf**
```bash
root@DiskStation:~ # tar -xvf archive.tar
$ tar -xvf archive.tar
```
@@ -44,7 +44,7 @@ root@DiskStation:~ # tar -xvf archive.tar
Extraire les fichiers de l'archive: **tar zxvf**
```bash
root@DiskStation:~ # tar zxvf archive.tgz
$ tar zxvf archive.tgz
```
@@ -54,18 +54,18 @@ root@DiskStation:~ # tar zxvf archive.tgz
Compresser avec gzip:
```bash
root@DiskStation:~ # gzip archive.tar
$ gzip archive.tar
root@DiskStation:~ # ls
$ ls
archive.tar.gz
```
Decompresser avec gunzip:
```bash
root@DiskStation:~ # gunzip archive.tar.gz
$ gunzip archive.tar.gz
root@DiskStation:~ # ls
$ ls
archive.tar
```
@@ -78,18 +78,18 @@ Voir le contenu de l'archive avec zcat:
Compresser avec bzip2:
```bash
root@DiskStation:~ # bzip2 archive.tar
$ bzip2 archive.tar
root@DiskStation:~ # ls
$ ls
archive.tar.bz2
```
Decompresser avec bunzip2:
```bash
root@DiskStation:~ # bunzip2 archive.tar.bz2
$ bunzip2 archive.tar.bz2
root@DiskStation:~ # ls archive.tar
$ ls archive.tar
```
@@ -99,7 +99,7 @@ root@DiskStation:~ # ls archive.tar
Compresser avec zip:
```bash
bruno@DS916:~ $ zip -r scripts.zip scripts/
$ zip -r scripts.zip scripts/
adding: scripts/ (stored 0%)
adding: scripts/@eaDir/ (stored 0%)
adding: scripts/@eaDir/ffmpeg@SynoResource (deflated 84%)
@@ -114,13 +114,13 @@ bruno@DS916:~ $ zip -r scripts.zip scripts/
Exclure les fichiers ressources invisibles (“*MACOSX” “.*Filename” “.ds store”):
```bash
bruno@DS916:~ $ zip -r -X scripts.zip scripts/
$ zip -r -X scripts.zip scripts/
```
Décompresser avec zip:
```bash
bruno@DS916:~/test $ unzip scripts.zip
$ unzip scripts.zip
Archive: scripts.zip
creating: scripts/
creating: scripts/@eaDir/
@@ -133,6 +133,46 @@ Archive: scripts.zip
inflating: scripts/ffmpeg-convertMP4v5.sh
```
Voir le contenu d'une archive:
```bash
$ unzip -l vegas.zip
Archive: vegas.zip
Length Date Time Name
--------- ---------- ----- ----
0 10-30-2018 13:43 overlays/
15520 10-30-2018 13:43 vegas.css
23957 10-30-2018 13:43 vegas.js
9459 10-30-2018 13:43 vegas.min.css
16251 10-30-2018 13:43 vegas.min.css.map
10383 10-30-2018 13:43 vegas.min.js
36089 10-30-2018 13:43 vegas.min.js.map
100 10-30-2018 13:43 overlays/01.png
100 10-30-2018 13:43 overlays/02.png
98 10-30-2018 13:43 overlays/03.png
100 10-30-2018 13:43 overlays/04.png
102 10-30-2018 13:43 overlays/05.png
100 10-30-2018 13:43 overlays/06.png
104 10-30-2018 13:43 overlays/07.png
106 10-30-2018 13:43 overlays/08.png
118 10-30-2018 13:43 overlays/09.png
--------- -------
112587 16 files
```
Extraire dans un dossier différent:
```bash
$ unzip -l vegas.zip -d $HOME/Desktop
```
Dézipper une archive protégée:
```bash
$ unzip -P password vegas.zip
```
#### dmg (macOS)
@@ -140,7 +180,7 @@ Archive: scripts.zip
Créer:
```bash
bruno@SilverBook:~$ hdiutil create -format UDZO -srcfolder hubiC/ hubic.dmg
$ hdiutil create -format UDZO -srcfolder hubiC/ hubic.dmg
.........
created: /Users/bruno/hubic.dmg
```
@@ -156,7 +196,7 @@ Différents formats d'image:
Monter:
```bash
bruno@SilverBook:~$ hdiutil attach hubic.dmg
$ hdiutil attach hubic.dmg
Calcul de la somme de contrôle de Protective Master Boot Record (MBR : 0)
Protective Master Boot Record (MBR : : vérifiée CRC32 $DC586CEA
Calcul de la somme de contrôle de GPT Header (Primary GPT Header : 1)
@@ -182,7 +222,7 @@ vérifiée CRC32 $BE421D06
Voir:
```bash
bruno@SilverBook:~$ ls -lah /Volumes/hubiC/
$ ls -lah /Volumes/hubiC/
total 8
drwxr-xr-x 11 bruno staff 442B 12 aoû 12:05 .
drwxr-xr-x@ 6 root wheel 204B 12 aoû 12:07 ..
@@ -198,7 +238,7 @@ drwxr-xr-x 9 bruno staff 306B 6 aoû 17:39 scripts plex 1.0xx
Ejecter:
```bash
bruno@SilverBook:~$ hdiutil eject /Volumes/hubiC/
$ hdiutil eject /Volumes/hubiC/
"disk3" unmounted.
"disk3" ejected.
```
@@ -210,32 +250,32 @@ bruno@SilverBook:~$ hdiutil eject /Volumes/hubiC/
Archiver et compresser en gzip: **tar -zcvf**
```bash
root@DiskStation:~ # tar -zcvf archive.tar.gz .bashrc .profile test-dossier/
$ tar -zcvf archive.tar.gz .bashrc .profile test-dossier/
.bashrc
.profile
test-dossier/
test-dossier/test-copy-scp.txt
root@DiskStation:~ # ls
$ ls
archive.tar.gz
```
Voir le contenu de l'archive gzip: **tar -ztf**
```bash
root@DiskStation:~ # tar -ztf archive.tar.bz2
$ tar -ztf archive.tar.bz2
```
Décompresser: **tar -xzvf**
```bash
root@DiskStation:~ # tar -xzvf archive.tar.gz
$ tar -xzvf archive.tar.gz
.bashrc
.profile
test-dossier/
test-dossier/test-copy-scp.txt
root@DiskStation:~ # ls -la
$ ls -la
drwxr-xr-x 3 root root 4096 Aug 6 07:45 .
drwx—— 8 root root 4096 Aug 6 07:18 ..
-rw-rr 1 root root 953 Aug 5 11:04 .bashrc
@@ -244,7 +284,7 @@ drwx—— 8 root root 4096 Aug 6 07:18 ..
drwxr-xr-x 2 root root 4096 Aug 6 07:04 test-dossier
# décompresser dans un dossier cible
root@DiskStation:~ # tar -xzvf archive.tar.gz -C /tmp/
$ tar -xzvf archive.tar.gz -C /tmp/
```
@@ -254,8 +294,8 @@ root@DiskStation:~ # tar -xzvf archive.tar.gz -C /tmp/
Décompresser: **tar -xf (+ v pour mode verbose)**
```bash
root@DS916:/volume1/web/_archives# tar -xf nextcloud-11.0.2.tar.bz2
root@DS916:/volume1/web/_archives# ls -la
$ tar -xf nextcloud-11.0.2.tar.bz2
$ ls -la
total 137156
@@ -273,19 +313,19 @@ drwxr-xr-x 1 nobody 65534 414 Feb 26 20:44 nextcloud
Extrait le fichier README de l'archive automysqlbackup-v3.0_rc6.tar.gz
```bash
bruno@SilverBook:~/Downloads$ tar --extract --file=automysqlbackup-v3.0_rc6.tar.gz README
$ tar --extract --file=automysqlbackup-v3.0_rc6.tar.gz README
```
Extrait le fichier book.enchant.html du dossier php-chunked-xhtml de l'archive php*manual*fr.tar.gz
```bash
bruno@SilverBook:~/Downloads$ tar --extract --file=php_manual_fr.tar.gz php-chunked-xhtml/book.enchant.html
$ tar --extract --file=php_manual_fr.tar.gz php-chunked-xhtml/book.enchant.html
```
Extraire plusieurs fichiers d'archive:
```bash
bruno@SilverBook:~/Downloads$ tar xvf php_manual_fr.tar.gz php-chunked-xhtml/book.enchant.html php-chunked-xhtml/function.mysql-connect.html
$ tar xvf php_manual_fr.tar.gz php-chunked-xhtml/book.enchant.html php-chunked-xhtml/function.mysql-connect.html
```
@@ -295,15 +335,24 @@ bruno@SilverBook:~/Downloads$ tar xvf php_manual_fr.tar.gz php-chunked-xhtml/boo
Connaitre la liste des fichiers de l'archive:
```bash
bruno@SilverBook:~/Downloads$ unzip -l zenphoto-zenphoto-1.4.14.zip
$ unzip -l zenphoto-zenphoto-1.4.14.zip
```
Extraire des fichiers de l'archive:
```bash
bruno@SilverBook:~/Downloads$ unzip zenphoto-zenphoto-1.4.14.zip zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/zenpage/zenpage.css zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/tinymce4/skins/lightgray/img/anchor.gif
$ unzip zenphoto-zenphoto-1.4.14.zip zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/zenpage/zenpage.css zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/tinymce4/skins/lightgray/img/anchor.gif
Archive: zenphoto-zenphoto-1.4.14.zip
4c21854e7a7950ec8d9644a959da019d9781d36c
inflating: zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/tinymce4/skins/lightgray/img/anchor.gif
inflating: zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/zenpage/zenpage.css
```
```
Dézipper tous les fichiers d'un dossier:
```bash
$ unzip '.zip'
```