16-03-2021
This commit is contained in:
@@ -199,9 +199,6 @@ All snaps up to date.
|
||||
$ snap refresh --time
|
||||
timer: 00:00~24:00/4
|
||||
last: today at 08:55 CET
|
||||
next: today at 14:11 CET$ snap refresh --time
|
||||
timer: 00:00~24:00/4
|
||||
last: today at 08:55 CET
|
||||
next: today at 14:11 CET
|
||||
```
|
||||
|
||||
|
||||
@@ -6,83 +6,59 @@
|
||||
|
||||
### Nano ([https://www.nano-editor.org/](https://www.nano-editor.org/))
|
||||
|
||||
CTRL + A : Permet d'aller au début de la ligne
|
||||
|
||||
CTRL + E : Permet d'aller à la fin de la ligne
|
||||
|
||||
CTRL + Y : Permet de remonter de page en page
|
||||
|
||||
CTRL + V : Permet de descendre de page en page
|
||||
| Lignes | |
|
||||
| ------------------------------------------------------------ | -------- |
|
||||
| aller au début de la ligne | CTRL + A |
|
||||
| aller à la fin de la ligne | CTRL + E |
|
||||
| remonter de page en page | CTRL + Y |
|
||||
| descendre de page en page | CTRL + V |
|
||||
| se rendre au n° de ligne indiqué | CTRL + _ |
|
||||
| savoir à quel n° de ligne / colonne / caractère se trouve votre curseu | CTRL + C |
|
||||
|
||||
|
||||
|
||||
CTRL + _ : Permet de se rendre au n° de ligne indiqué
|
||||
|
||||
CTRL + C : Permet de savoir à quel n° de ligne / colonne / caractère se trouve votre curseur
|
||||
| Couper / coller | |
|
||||
| ----------------------------------------------------------- | -------- |
|
||||
| supprimer le caractère sous le curseur | CTRL + D |
|
||||
| coupe le texte depuis le curseur jusqu'à la fin du fichier | Meta - T |
|
||||
| supprimer une ligne complète (comme la commande dd sous Vi) | CTRL + K |
|
||||
| coller une ligne | CTRL + U |
|
||||
|
||||
|
||||
|
||||
CTRL + W : Permet de faire une [recherche](https://korben.info/recherche-2)
|
||||
| Divers | |
|
||||
| ------------------------------------------------------ | -------- |
|
||||
| faire une [recherche](https://korben.info/recherche-2) | CTRL + W |
|
||||
| sauvegarder votre fichier | CTRL + O |
|
||||
| quitter nano | CTRL + X |
|
||||
| afficher l'aide | CTRL + G |
|
||||
| masquer / afficher l'aide-mémoire | Meta - X |
|
||||
|
||||
|
||||
|
||||
CTRL + D : Permet de supprimer le caractère sous le curseur
|
||||
|
||||
Meta - T : Coupe le texte depuis le curseur jusqu'à la fin du fichier
|
||||
| | |
|
||||
| ---------------------------------- | ------------ |
|
||||
| déplacer le curseur vers le haut | CTRL + P |
|
||||
| déplacer le curseur vers le bas | CTRL + N |
|
||||
| déplacer le curseur vers la droite | CTRL + F |
|
||||
| déplacer le curseur vers la gauche | CTRL + B |
|
||||
| se déplacer d'un mot en avant | CTRL + Space |
|
||||
| se déplacer d'un mot en arrière | Meta - Space |
|
||||
| sauter au début du paragraphe | Meta - ( |
|
||||
| sauter à la fin du paragraphe | Meta - ) |
|
||||
| sauter au début du fichier | Meta - \ |
|
||||
| sauter à la fin du fichier | Meta - / |
|
||||
|
||||
|
||||
|
||||
CTRL + K : Permet de supprimer une ligne complète (comme la commande dd sous Vi)
|
||||
|
||||
CTRL + U : Coller
|
||||
|
||||
|
||||
|
||||
CTRL + O : Permet de sauvegarder votre fichier
|
||||
|
||||
CTRL + X : Permet de quitter nano
|
||||
|
||||
CTRL + G : Affiche l'aide
|
||||
|
||||
Meta - X : Masquer / afficher l'aide-mémoire
|
||||
|
||||
|
||||
|
||||
CTRL + P : déplace le curseur vers le haut
|
||||
|
||||
CTRL + N : déplace le curseur vers le bas
|
||||
|
||||
CTRL + F : déplace le curseur vers la droite
|
||||
|
||||
CTRL + B : déplace le curseur vers la gauche
|
||||
|
||||
|
||||
|
||||
CTRL + Space : se déplace d'un mot en avant
|
||||
|
||||
Meta - Space : se déplace d'un mot en arrière
|
||||
|
||||
|
||||
|
||||
Meta - ( : saute au début du paragraphe
|
||||
|
||||
Meta - ) : saute à la fin du paragraphe
|
||||
|
||||
Meta - \ : saute au début du fichier
|
||||
|
||||
Meta - / : saute à la fin du fichier
|
||||
|
||||
|
||||
|
||||
Meta - U : annuler
|
||||
|
||||
Meta - E : redo
|
||||
|
||||
|
||||
|
||||
Meta - A : marquer (début)
|
||||
|
||||
Meta - 6 (shift) : copier
|
||||
| | |
|
||||
| ----------------------- | ---------------- |
|
||||
| annuler la modification | Meta - U |
|
||||
| redo | Meta - E |
|
||||
| marquer (début) | Meta - A |
|
||||
| copier | Meta - 6 (shift) |
|
||||
|
||||
|
||||
|
||||
@@ -114,6 +90,8 @@ CTRL + _ : aller à la ligne xx
|
||||
|
||||
Meta sur macOS: ESC puis <touche>
|
||||
|
||||
> iTerm2: Profifes -> Edit -> Keys -> Left Option key = Esc+
|
||||
|
||||
|
||||
|
||||
#### Copier / couper / coller sous nano
|
||||
|
||||
@@ -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-r–r– 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'
|
||||
```
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# grep
|
||||
# interpègrep
|
||||
|
||||
|
||||
|
||||
@@ -7,21 +7,53 @@ La commande **grep** permet de rechercher une chaîne de caractères dans un fic
|
||||
Options:
|
||||
|
||||
```bash
|
||||
-i (ignore case) insensible à la casse
|
||||
-v affiche les lignes ne contenant pas la chaîne
|
||||
-c (count) compte le nombre de lignes contenant la chaîne
|
||||
-n (number) chaque ligne contenant la chaîne est numérotée
|
||||
-x ligne correspondant exactement à la chaîne
|
||||
-l affiche le nom des fichiers qui contiennent la chaîne
|
||||
-C (context) fait figurer les deux lignes qui précèdent et suivent la ligne où figure le mot recherché
|
||||
-Ax (after) affiche les x lignes qui suivent la ligne où figure le mot recherché
|
||||
-Bx (before) affiche les x lignes qui précèdent la ligne où figure le mot recherché
|
||||
-r (recursif)
|
||||
-w mot exact
|
||||
-E, --extended-regexp interprète la PATTERN comme Expression Régulière Etendue
|
||||
-F, --fixed-strings interprète la PATTERN comme chaine
|
||||
-G, --basic-regexp interprète la PATTERN comme chaine Expression Régulière Basique
|
||||
-P, --perl-regexp interprète la PATTERN comme Expression Régulière PERL (PCRE)
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
-i, --ignore-case insensible à la casse
|
||||
-v affiche les lignes ne contenant pas la chaîne
|
||||
-w, --word-regexp recherche le mot correspondant exactement à la chaîne
|
||||
-x, --line-regexp recherche ligne correspondant exactement à la chaîne
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
-c, --count compte le nombre de lignes contenant le fichier / chaîne (associé à -v)
|
||||
--color (never|always|auto) met en couleur les concordances
|
||||
-l, --files-with-matches affiche le nom des fichiers qui contiennent la chaîne
|
||||
-m NUM, --max-count NUM stoppe la lecture du fichier après avoir trouvé NUM lignes
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
-n, --line-number chaque ligne contenant la chaîne est numérotée
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
-C NUM, --context=NUM fait figurer les NUM lignes qui précèdent et suivent la ligne où figure le mot recherché
|
||||
-A NUM, --after-context=NUM affiche les NUM lignes qui suivent la ligne où figure le mot recherché
|
||||
-B NUM, --before-context=NUM affiche les NUM lignes qui précèdent la ligne où figure le mot recherché
|
||||
-r (recursif)
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
|
||||
```
|
||||
|
||||
<u>Chercher dans un dossier (récursif)</u>:
|
||||
|
||||
```bash
|
||||
|
||||
148
docs/Linux/pushd-popd.md
Normal file
148
docs/Linux/pushd-popd.md
Normal file
@@ -0,0 +1,148 @@
|
||||
# pushd / popd
|
||||
|
||||
|
||||
|
||||
### pushd:
|
||||
|
||||
```bash
|
||||
~ master* ⇡
|
||||
❯ pushd /usr/local/bin
|
||||
/usr/local/bin ~
|
||||
|
||||
/usr/local/bin
|
||||
❯ pushd /etc
|
||||
/etc /usr/local/bin ~
|
||||
|
||||
/etc
|
||||
❯ pushd /Users/bruno/Documents
|
||||
~/Documents /etc /usr/local/bin ~
|
||||
|
||||
~/Documents master* ⇡
|
||||
❯ pushd /Users/bruno/Music
|
||||
~/Music ~/Documents /etc /usr/local/bin ~
|
||||
|
||||
```
|
||||
|
||||
### dirs:
|
||||
|
||||
```bash
|
||||
~/Music master* ⇡
|
||||
❯ dirs -l -v
|
||||
0 /Users/bruno/Music
|
||||
1 /Users/bruno/Documents
|
||||
2 /etc
|
||||
3 /usr/local/bin
|
||||
4 /Users/bruno
|
||||
|
||||
```
|
||||
|
||||
### naviguer avec pushd:
|
||||
|
||||
```bash
|
||||
~/Music master* ⇡
|
||||
❯ dirs -l -v
|
||||
0 /Users/bruno/Music
|
||||
1 /Users/bruno/Documents
|
||||
2 /etc
|
||||
3 /usr/local/bin
|
||||
4 /Users/bruno
|
||||
|
||||
# On avance de 2 répertoires dans la pile 0.1.2 (en partant du haut) => /etc
|
||||
~/Music master* ⇡
|
||||
❯ pushd +2
|
||||
/etc /usr/local/bin ~ ~/Music ~/Documents
|
||||
|
||||
# On avance de 1 répertoire dans la pile 0.1 (en partant du bas) => ~/Music
|
||||
/etc
|
||||
❯ pushd -1
|
||||
~/Music ~/Documents /etc /usr/local/bin ~
|
||||
|
||||
~/Music master* ⇡
|
||||
❯ dirs -l -v
|
||||
0 /Users/bruno/Music
|
||||
1 /Users/bruno/Documents
|
||||
2 /etc
|
||||
3 /usr/local/bin
|
||||
4 /Users/bruno
|
||||
|
||||
```
|
||||
|
||||
### popd:
|
||||
|
||||
Sans argument, supprime le 1er répertoire de la pile, et va au suivant.
|
||||
|
||||
```bash
|
||||
/etc
|
||||
❯ dirs -l -v
|
||||
0 /etc
|
||||
1 /usr/local/bin
|
||||
2 /Users/bruno
|
||||
3 /Users/bruno/Music
|
||||
4 /Users/bruno/Documents
|
||||
|
||||
/etc
|
||||
❯ popd
|
||||
/usr/local/bin ~ ~/Music ~/Documents
|
||||
|
||||
/usr/local/bin
|
||||
❯ dirs -l -v
|
||||
0 /usr/local/bin
|
||||
1 /Users/bruno
|
||||
2 /Users/bruno/Music
|
||||
3 /Users/bruno/Documents
|
||||
|
||||
```
|
||||
|
||||
Option -n (?????)
|
||||
|
||||
```bash
|
||||
/usr/local/bin
|
||||
❯ dirs -l -v
|
||||
0 /usr/local/bin
|
||||
1 /Users/bruno
|
||||
2 /Users/bruno/Music
|
||||
3 /Users/bruno/Documents
|
||||
|
||||
/usr/local/bin
|
||||
❯ popd -n
|
||||
/usr/local/bin ~ ~/Music ~/Documents
|
||||
|
||||
/usr/local/bin
|
||||
❯ dirs -l -v
|
||||
0 /usr/local/bin
|
||||
1 /Users/bruno
|
||||
2 /Users/bruno/Music
|
||||
3 /Users/bruno/Documents
|
||||
|
||||
```
|
||||
|
||||
popd +1 (supprime en partant du haut de la pile 0..1)
|
||||
|
||||
```
|
||||
❯ dirs -l -v
|
||||
0 /usr/local/bin
|
||||
1 /Users/bruno
|
||||
2 /Users/bruno/Music
|
||||
3 /Users/bruno/Documents
|
||||
|
||||
/usr/local/bin
|
||||
❯ popd +1
|
||||
/usr/local/bin ~/Music ~/Documents
|
||||
|
||||
```
|
||||
|
||||
popd -1 (supprime en partant du bas de la pile 0..1)
|
||||
|
||||
```bash
|
||||
/usr/local/bin
|
||||
❯ dirs -l -v
|
||||
0 /usr/local/bin
|
||||
1 /Users/bruno/Music
|
||||
2 /Users/bruno/Documents
|
||||
|
||||
/usr/local/bin
|
||||
❯ popd -2
|
||||
~/Music ~/Documents
|
||||
|
||||
```
|
||||
|
||||
@@ -671,4 +671,9 @@ Ajouter une ligne tout à la fin:
|
||||
|
||||
```bash
|
||||
$ sed -i '$a ---------------' test.txt
|
||||
```
|
||||
```
|
||||
|
||||
|
||||
|
||||
https://wiki.maxcorp.org/sed/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user