Compare commits
10 Commits
e02b036875
...
cd8cebe7cb
| Author | SHA1 | Date | |
|---|---|---|---|
| cd8cebe7cb | |||
| efb8d64ac7 | |||
| d78f93eed2 | |||
| 5b45dc0863 | |||
| e6fc2251ec | |||
| 6c514dbbef | |||
| bb890cba15 | |||
| 7d89fb0224 | |||
| 53aa196ac1 | |||
|
25789f522b
|
30
docs/Divers/Composer.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Composer
|
||||
|
||||
|
||||
|
||||
Installer bibliothèque:
|
||||
|
||||
```bash
|
||||
composer require lsolesen/pel --prefer-dist --classmap-authoritative
|
||||
```
|
||||
|
||||
|
||||
|
||||
```php
|
||||
require __DIR__ . '/vendor/lsolesen/pel/autoload.php';
|
||||
use lsolesen\pel\Pel;
|
||||
use lsolesen\pel\PelDataWindow;
|
||||
use lsolesen\pel\PelJpeg;
|
||||
use lsolesen\pel\PelTag;
|
||||
use lsolesen\pel\PelIfd;
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
Supprimer bibliothèque:
|
||||
|
||||
```bash
|
||||
composer remove lsolesen/pel
|
||||
```
|
||||
|
||||
19
docs/Divers/JDownloader.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# JDownloader
|
||||
|
||||
|
||||
|
||||
[How to use another browser than your OS' default to solve browser captchas](https://support.jdownloader.org/Knowledgebase/Article/View/define-custom-browser-solver-captcha-browser)
|
||||
|
||||
Ouvrir **Preferences** -> **Paramètres avancés**.
|
||||
|
||||
Chercher *"browser captchasolver browser commandline"*
|
||||
|
||||
Ajouter `[ "open", "-n", "-a", "/Applications/Firefox.app", "--args", "-new-tab", "%s" ]`
|
||||
|
||||
|
||||
|
||||
Coller un lien dans JDownloader.
|
||||
|
||||
Un onglet Firefox s'ouvre pour résoudre le captcha.
|
||||
|
||||
Cliquer sur **I am no robot**.
|
||||
51
docs/Divers/Lightroom/Lightroom.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# Lightroom
|
||||
|
||||
|
||||
|
||||
#### Emplacements des fichiers dans macOS
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
~/Pictures/Lightroom/Airbook
|
||||
drwxr-xr-x - bruno staff 25 déc 16:28 Backups/
|
||||
.rw-r--r--@ 1,3Gi bruno staff 28 déc 09:03 'Lightroom Catalog-v13.lrcat'
|
||||
drwx------@ - bruno staff 27 déc 20:13 'Lightroom Catalog-v13.lrcat-data'/
|
||||
.rw-r--r-- 32Ki bruno staff 27 déc 20:13 'Lightroom Catalog-v13.lrcat-shm'
|
||||
.rw-r--r-- 4,3Mi bruno staff 28 déc 09:03 'Lightroom Catalog-v13.lrcat-wal'
|
||||
.rw-r--r-- 72 bruno staff 27 déc 20:13 'Lightroom Catalog-v13.lrcat.lock'
|
||||
drwxr-xr-x - bruno staff 27 déc 20:13 'Lightroom Catalog-v13 Helper.lrdata'/
|
||||
drwxr-xr-x - bruno staff 28 déc 09:03 'Lightroom Catalog-v13 Previews.lrdata'/
|
||||
drwxr-xr-x - bruno staff 27 déc 20:13 'Lightroom Catalog-v13 Sync.lrdata'/
|
||||
drwxr-xr-x - bruno staff 7 oct 2022 'Lightroom Settings'/
|
||||
|
||||
# du -ckh Lightroom\ Catalog-v13\ Helper.lrdata 71Mo
|
||||
# du -ckh Lightroom\ Catalog-v13\ Sync.lrdata 5 Mo
|
||||
# du -ckh Lightroom\ Catalog-v13\ Previews.lrdata 28 Go
|
||||
# Lightroom Catalog-v13.lrcat-data 201 Mo
|
||||
```
|
||||
|
||||
|
||||
|
||||
| Fichiers | Emplacement |
|
||||
| ---------------------------------------- | ------------------------------------------------------------ |
|
||||
| **Application Lightroom Classic** | Applications/Adobe Lightroom Classic/Adobe Lightroom Classic.app |
|
||||
| **Préférences Lightroom Classic** | Users/[nom d’utilisateur]/Library/Preferences/**com.adobe.LightroomClassicCC7.plist**<br />*Sous macOS, après avoir supprimé le fichier ci-dessus, redémarrez votre ordinateur, puis relancez Lightroom Classic tout en maintenant les touches **Maj** + **Option** enfoncées. Dans la boîte de dialogue, sélectionnez **Réinitialiser les préférences**.* |
|
||||
| **Catalogue** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog.lrcat** (2) |
|
||||
| (dossier) | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog.lrcat-data/** (2)<br />*À partir de Lightroom Classic 11, Lightroom Classic stocke des informations supplémentaires dans un nouveau fichier portant l’extension **.lrcat-data,** avec le fichier de catalogue. Ce fichier se situe dans le même dossier que votre fichier de catalogue. Ce fichier contient des informations importantes sur vos photos et vos modifications et doit être inclus dans vos systèmes de sauvegarde éventuels.* |
|
||||
| **Cache d’aperçu** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog Previews.lrdata/**<br />*Quitter Lightroom avant d'effacer le dossier. Les aperçus seront recrées au besoin.* |
|
||||
| **Cache des aperçus dynamiques** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog Smart Previews.lrdata/** |
|
||||
| **Cache des mots-clé, dossiers** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog Helper.lrdata/**<br />*Accelère les performances de LR dans l'affichage des métadonnées.* |
|
||||
| | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog Sync.lrdata/** |
|
||||
| **Fichier de verrouillage de catalogue** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog.lrcat.lock** (1)<br />*Remarque : Le fichier de verrouillage empêche le catalogue d’être remplacé en cours d’utilisation.* |
|
||||
| | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog.lrcat-wal** (1) |
|
||||
| | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog.lrcat-shm** (1) |
|
||||
| **Fichier journal de catalogue** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog.lrcat-journal**<br />*Les catalogues ouverts utilisent le fichier journal pour vérifier les enregistrements de base de données incomplets. Ne supprimez pas le fichier journal à moins que vous ne supprimiez également son catalogue associé.* |
|
||||
| **Sauvegarde d’un catalogue** | /Users/[nom d’utilisateur]/Pictures/Lightroom/Backups/**[date et heure de sauvegarde]/Lightroom Catalog.lrcat** |
|
||||
| **Lightroom Settings** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Settings/**<br />Contient des plugins (**Topaz Photo AI.lrplugin**) et des presets d'éditeurs externes (**TopazPhotoAI.lrtemplate**) |
|
||||
| **Paramètres prédéfinis et modèles** | **(.lrtemplate)** Les paramètres prédéfinis et modèles au format .lrtemplate sont enregistrés à l’emplacement suivant : */Users/[nom d’utilisateur]/Library/Application Support/Adobe/Lightroom/[dossier du paramètre prédéfini ou du modèle]/**[nom du fichier de paramètre prédéfini ou de modèle.lrtemplate]*** |
|
||||
| | **(XMP)** À partir de Lightroom Classic, les paramètres prédéfinis existants au format .lrtemplate sont automatiquement convertis au nouveau format de paramètre prédéfini XMP. Après la conversion, les nouveaux paramètres prédéfinis au format XMP sont enregistrés à l’emplacement suivant : */Users/[user name]/Library/Application Support/Adobe/CameraRaw/Settings* |
|
||||
| | **(Paramètres prédéfinis stockés avec le catalogue) :** si vous avez activé l’option [**Stocker les paramètres prédéfinis avec ce catalogue**](https://helpx.adobe.com/fr/lightroom-classic/help/setting-preferences-lightroom.html#Storepresetswithyourcatalog) dans les préférences de Lightroom Classic, les fichiers de paramètres prédéfinis et de modèle sont enregistrés à l’emplacement suivant : *MacHD/[emplacement du catalogue]/[nom du dossier du catalogue]/Lightroom Settings/Settings* |
|
||||
| **Catalogue local de Lightroom (cloud)** | /Users/[nom d’utilisateur]/Pictures/**Lightroom Library.lrlibrary** |
|
||||
| | (1) fichiers présents quand Lightroom Classic est ouvert.<br />(2) présents dans l'archive Backup/YYYY-MM-DD HHSS/Lightroom Catalog-v13.zip |
|
||||
|
||||
109
docs/Divers/Permajet/Art_lisse.md
Normal file
@@ -0,0 +1,109 @@
|
||||
# Papiers d'art lisses (6)
|
||||
|
||||
|
||||
|
||||
**Gamme primée de papiers d'art numériques avec des surfaces lisses et délicatement structurées finies avec un revêtement mat multicouche**.
|
||||
|
||||
Ces milieux sans acide de qualité musée sont fabriqués à partir d'Alpha Cellulose, de Cotton Rag ou d'un mélange des deux avec des poids de base de 200 à 310 g/m2. Tous les matériaux sont enduits pour donner à vos images une saturation des couleurs incroyable et des noirs exceptionnellement profonds. Les matériaux de base sont raffinés pour éliminer l'acide et la lignine afin d'assurer et de prolonger la stabilité archivistique.
|
||||
|
||||
Tous les papiers portent un certificat de stabilité archivistique délivré par des laboratoires agréés UKAS. PermaJet, un membre de premier plan et avant-gardiste de la Fine Art Trade Guild, a adopté les normes requises par le système Guilds ArtSureTM pour s'assurer que des normes élevées étaient maintenues dans toute la gamme.
|
||||
|
||||
*« Ces papiers sont merveilleux, très lourds et denses, posés à plat ou montés avec une surface lisse comme du velours. Il fait des impressions qui donnent l'impression qu'elles valent la peine d'être payées. » **David Kilpatrick, rédacteur en chef, Cameracraft Magazine**.*
|
||||
|
||||
|
||||
|
||||
# Alpha Natural Rag 310
|
||||
|
||||
Alpha Natural Rag 310 est un papier jet d'encre d'art avec une surface lisse et mate et une base blanche naturelle. Produisez facilement de beaux résultats Giclée avec ce papier gratuit OBA, le choix parfait pour les artistes et les photographes à la recherche d'un véritable matériau d'art d'archives. Il reproduit des couleurs époustouflantes et vibrantes et une grande profondeur et des détails d'image. La base chaude 100 % coton fournit une plate-forme stable pour les reproductions d'art sans changement de couleur ni amélioration.
|
||||
|
||||
Alpha Natural Rag est très adapté aux photographes de paysage, de portrait et d'art et aux artistes qui désirent une surface très lisse.
|
||||
|
||||
**Alpha Natural Rag 310 est parfait pour...**
|
||||
|
||||
- Véritable archivistique, reproductions d'art sans OBA
|
||||
- Couleurs et profondeur d'image exceptionnelles
|
||||
- Impressions nécessitant une teinte de base naturelle sans changement de couleur
|
||||
|
||||
https://www.permajet.com/product/alpha-natural-rag-310/
|
||||
|
||||
|
||||
|
||||
# Omega Rag 310
|
||||
|
||||
Omega Rag 310 est un papier jet d'encre d'art avec une surface lisse et mate et une base blanche neutre. Il imprime les couleurs à un niveau exceptionnel avec un faible métamérisme, tandis que ses détails d'ombre et sa gradation lisse des tons en font un partenaire idéal pour le travail monochrome. Très adapté aux photographes de paysages et de portraits, ce papier imprime des couleurs complexes, des noirs profonds et des niveaux élevés de détails sans compromis.
|
||||
|
||||
La surface d'Omega Rag a une délicieuse finition lisse qui donne de la profondeur aux images, et une base de chiffon 100 % coton pour une stabilité archivistique et une qualité exceptionnelle. La base lourde a une excellente sensation à portée de main et constituera un excellent choix pour les tirages d'art, les expositions et plus encore.
|
||||
|
||||
**Omega Rag 310 est parfait pour...**
|
||||
|
||||
- Reproductions d'art
|
||||
- Photographes à la recherche d'un papier mat plus lourd
|
||||
- Couleurs complexes et haut niveau de détail
|
||||
|
||||
https://www.permajet.com/product/omega-rag-310/
|
||||
|
||||
|
||||
|
||||
# Photo Art Silk 290
|
||||
|
||||
Photo Art Silk 290 est un papier jet d'encre d'art avec une surface mate en soie et une base blanc moyen. Ce papier mat a un revêtement unique qui prend un éclat de soie luxueux lorsqu'il est imprimé, pétillant dans la lumière et débordant de vitalité. Cela en fait le papier parfait pour les paysages marins et les photographies de paysages à longue exposition, améliorant les résultats et ajoutant une qualité magique.
|
||||
|
||||
Photo Art Silk est un papier d'art avec une différence et créera des tirages remarquables adaptés à tous les usages, de l'art mural aux participations au concours Camera Club. La surface a une texture ondulée subtile pour une vraie sensation d'art, tandis que la base blanche naturelle Alpha Cellulose offre d'excellents rendus de couleurs et des détails nets.
|
||||
|
||||
**Photo Art Silk 290 est parfait pour...**
|
||||
|
||||
- Matières contenant des surfaces réfléchissantes, telles que l'eau
|
||||
- Tirages d'art nécessitant une finition spéciale supplémentaire
|
||||
- Paysages marins à longue exposition
|
||||
|
||||
https://www.permajet.com/product/photo-art-silk-290/
|
||||
|
||||
|
||||
|
||||
# Portfolio Rag 220
|
||||
|
||||
Portfolio Rag 220 est un papier jet d'encre d'art avec une surface lisse et mate et une base naturelle blanc cassé. Il reproduit les couleurs avec beaucoup de profondeur et de clarté, la teinte de base naturelle offrant une précision adaptée aux reproductions d'art. La délicieuse surface mate lisse est parfaite pour le portrait et la photographie de mariage, donnant un aspect de haute qualité sans éléments distrayants. Il a un chiffon 100 % coton, sans acide, qui offre une stabilité archivistique au travailleur sérieux des beaux-arts.
|
||||
|
||||
Portfolio Rag 220 est le papier le plus léger de la gamme des beaux-arts, adapté aux portfolios et aux albums, aux invitations et aux tirages encadrés.
|
||||
|
||||
**Portfolio Rag 220 est parfait pour...**
|
||||
|
||||
- Œuvres d'art adaptées à une surface lisse
|
||||
- Livres photo, invitations, travail en studio
|
||||
|
||||
https://www.permajet.com/product/portfolio-rag-220/
|
||||
|
||||
|
||||
|
||||
# Portrait Rag 285
|
||||
|
||||
Portrait Rag 285 est un papier jet d'encre d'art avec une surface mate classique et une base blanche moyenne. Il a un Dmax incroyable qui produit des noirs profonds et veloutés, et une large gamme de couleurs adaptée aux tons de peau et aux paysages. La surface a une texture subtile qui ajoute du caractère et de la définition aux œuvres d'art sans détourner l'attention du sujet.
|
||||
|
||||
La base de chiffon 100 % coton de Portrait Rag produit une excellente définition tonale et une large gamme de couleurs pour des impressions précises et de haute qualité. Les qualités archivistiques en font un excellent choix pour les photographes, les artistes et les galeries.
|
||||
|
||||
**Portrait Rag 285 est parfait pour...**
|
||||
|
||||
- Portraits et mariages haut de gamme
|
||||
- Noirs profonds et veloutés et couleurs riches
|
||||
- Œuvres d'art d'archives
|
||||
|
||||
https://www.permajet.com/product/portrait-rag-285/
|
||||
|
||||
|
||||
|
||||
# Portrait White 285
|
||||
|
||||
Portrait White 285 est un papier jet d'encre fine art avec une surface mate texturée subtile et une base blanche brillante. Il reproduit magnifiquement les couleurs, rehaussées par le ton de base plus blanc, tandis que les noirs impriment profondément et riches. La surface mate subtile et alvéolée complète la photographie d'art et les œuvres d'art, ajoutant une délicieuse texture douce qui rehausse l'image. Les photographes et les artistes apprécieront d'imprimer leur travail sur Portrait White 285, en particulier ceux qui produisent des portraits, des œuvres clés et des illustrations.
|
||||
|
||||
Ce matériau 100% alpha cellulose est sans acide et idéal pour les impressions standard d'archives.
|
||||
|
||||
**Portrait White 285 est parfait pour...**
|
||||
|
||||
- Représenter la texture des tons de peau dans le portrait d'art
|
||||
- Travail haut de gamme qui bénéficierait d'une base blanche brillante
|
||||
- Œuvre d'art avec des noirs riches et des couleurs vives
|
||||
|
||||
https://www.permajet.com/product/portrait-white-285/
|
||||
|
||||
|
||||
|
||||
65
docs/Divers/Permajet/Art_textures.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# Papiers d'art texturés (3)
|
||||
|
||||
|
||||
|
||||
**Matériaux d'art texturés pour l'artiste auto-publiant, le photographe d'art et la maison de reproduction d'art.**
|
||||
|
||||
Des surfaces texturées qui donnent une sensation de profondeur et de subtilité à vos images tout en offrant une densité d'image et une définition des couleurs remarquables.
|
||||
|
||||
Les matériaux moulés sont vraiment emblématiques de la gamme PermaJet, en utilisant du coton raffiné et des fibres naturelles pour constituer la base avec des poids allant de 250 à 325 g/m2.
|
||||
|
||||
Des revêtements avancés sont appliqués à l'aide de la technologie multicouche pour assurer une cohérence uniforme même sur la texture la plus lourde. La reproduction des couleurs dépassera vos attentes dans tous les domaines en fournissant des images qui répondent aux normes les plus élevées de qualité du Musée et de reproduction des beaux-arts de Giclee.
|
||||
|
||||
Chaque papier est certifié pour sa qualité et sa longévité par des laboratoires indépendants qui travaillent à répondre aux normes attendues par le système ArtSureTM de la Fine Art Trade Guild de renommée internationale.
|
||||
|
||||
|
||||
|
||||
# Artist Watercolour 250
|
||||
|
||||
Artist Watercolour 250 est un papier jet d'encre d'art avec une surface fortement texturée et une base blanche naturelle. Ce papier sans OBA rappelle les matériaux traditionnels pour l'aquarelle, avec une texture tissée proéminente qui donne un superbe effet réaliste lors de la reproduction de croquis et de peintures. Artist Watercolour est également fantastique pour imprimer des photographies d'art, la texture faisant ressortir des détails subtils et ajoutant une finition unique de haute qualité.
|
||||
|
||||
La base blanche naturelle de ce papier Alpha Cellulose a une gamme de couleurs et une netteté exceptionnelles, assurant que votre travail imprime à son meilleur. Convient pour une utilisation archivistique dans les galeries, les expositions et plus encore.
|
||||
|
||||
**Artist Watercolour 250 est parfait pour...**
|
||||
|
||||
- Œuvres d'art artistiques, en particulier de grandes envergure
|
||||
- Croquis et peintures, pour une reproduction réaliste des textures
|
||||
- Superbes couleurs et définition
|
||||
|
||||
https://www.permajet.com/product/artist-watercolour-250/
|
||||
|
||||
|
||||
|
||||
# Gallery Etching 310
|
||||
|
||||
Gallery Etching 310 est un papier jet d'encre d'art avec une surface fortement texturée et une base blanche naturelle. Ce papier présente des détails d'image impressionnants et une vivacité des couleurs, un excellent choix pour les artistes et les photographies créatives. La texture de surface est constituée d'ondulations prononcées au hasard, qui ajoutent de la vie à une image lorsqu'elle est imprimée. Cette texture convient particulièrement aux reproductions d'artistes, imitant les qualités élevées de la peinture à l'huile pour un look presque 3D. Il offre également une qualité et une profondeur délicieuses aux photographies qui bénéficieraient d'une texture supplémentaire, telles que des natures mortes et des paysages d'art.
|
||||
|
||||
Gallery Etching 310 a une base Alpha Cellulose sans acide et un impressionnant revêtement résistant aux éraflures, avec des qualités d'archivage qui répondent aux normes de la galerie.
|
||||
|
||||
**Gallery Etching 310 est parfait pour...**
|
||||
|
||||
- Reproductions d'art détaillées, en particulier des œuvres d'art
|
||||
- Images nécessitant un aspect de texture supplémentaire
|
||||
- Couleurs audacieuses et vibrantes et noirs profonds
|
||||
|
||||
https://www.permajet.com/product/gallery-etching-310/
|
||||
|
||||
|
||||
|
||||
# Museum Heritage 310
|
||||
|
||||
Museum Heritage 310 est un papier jet d'encre d'art avec une surface texturée et une base blanc moyen. Il imprime avec des détails et une clarté exceptionnels, rehaussés par le tissage texturé rugueux qui est très adapté à la photographie d'art, aux scènes rustiques et aux portraits détaillés. Ce papier mélange coton et Alpha Cellulose est parfait pour les artistes qui souhaitent reproduire leur travail, la base blanc moyen offrant des rendus de couleurs et monochromes exceptionnels.
|
||||
|
||||
Museum Heritage a un revêtement supérieur qui imprime d'excellents détails de surbrillance et d'ombre avec un Dmax élevé. La surface texturée ajoute de la profondeur et de la qualité aux images pour un aspect et une sensation très spéciaux, adaptés aux expositions professionnelles, aux galeries, aux musées et aux artistes.
|
||||
|
||||
**Museum Heritage 310 est parfait pour...**
|
||||
|
||||
- Œuvres d'art qui nécessitent plus de profondeur, avec des
|
||||
détail de la surbrillance et de l'ombre
|
||||
- Couleurs complexes et pièces très détaillées
|
||||
- Scènes et paysages rustiques, portraits « météorologiques »
|
||||
|
||||
https://www.permajet.com/product/museum-heritage-310/
|
||||
|
||||
|
||||
|
||||
101
docs/Divers/Permajet/Baryta.md
Normal file
@@ -0,0 +1,101 @@
|
||||
# Papiers Baryta à base de fibres (5)
|
||||
|
||||
|
||||
|
||||
**Lancé en 2004, PermaJet a été le pionnier des médias numériques de Baryta.**
|
||||
|
||||
Papiers à base de fibres (Baryta) avec une structure traditionnelle de chambre noire, ce qui en fait l'alternative à jet d'encre numérique parfaite aux papiers à l'halogénure d'argent d'origine.
|
||||
|
||||
Les bases alpha-cellulose ont la sensation légèrement striée que vous attendez des papiers traditionnels pour chambre noire et sont disponibles avec des options de surface lisses et délicatement structurées. Avec des poids de base allant de 285 à 325 g/m2, PermaJet a créé une gamme de produits Baryta « à plat » qui alimentent facilement votre imprimante à jet d'encre.
|
||||
|
||||
Le revêtement multicouche amélioré, combiné à la technologie d'encre moderne, vous assure d'obtenir les cotes Dmax les plus élevées avant que possible. Ces caractéristiques fonctionnent ensemble pour offrir la gamme de tons la plus large afin d'améliorer les détails de la surbrillance et de l'ombre, offrant des images monochromes nettes et des couleurs percutantes.
|
||||
|
||||
Une véritable collection d'arrêt de spectacle maintenant disponible en Gloss (subtil brillant séché à l'air) Pearl, Silk et Matt. Les longueurs des rouleaux sont toutes de 15 mètres et disponibles jusqu'à 60'' de large à des fins de production et des supports en feuilles A4 - A2. Les surfaces sont toutes sèches instantanément et ont des finitions résistantes aux éraflures, ce qui les rend idéales pour une utilisation avec des encres à base de colorants et de pigments.
|
||||
|
||||
Développé avec la stabilité archivistique et les processus de test associés à la Fine Art Trade Guild de renommée internationale à l'esprit - une garantie que vos images dureront de nombreuses années à venir.
|
||||
|
||||
Lors de tests indépendants de plus de 200 papiers d'art et photo jet d'encre, ils ont donné la plus grande précision D-MAX, de gamme de couleurs et de tons de peau, créant à son tour d'excellentes niveaux de gris pour les images monochromes.
|
||||
|
||||
|
||||
|
||||
# FB Distinction 320
|
||||
|
||||
FB Distinction 320 est un papier jet d'encre à base de fibres avec une surface subtilement brillante et une teinte de base blanche brillante. Rappelant les matériaux traditionnels de la chambre noire, ce papier baryte imprime avec des détails exceptionnels, Dmax et une gamme de tons. La surface brillante a un éclat délicat qui élève les photographies et les œuvres d'art.
|
||||
|
||||
Créez des impressions audacieuses et percutantes qui se démarquent sur la base blanche brillante Alpha Cellulose, ajoutant de la vie aux couleurs et créant du contraste. Les noirs profonds et la large gamme de tons font de FB Distinction 320 un excellent choix pour les travaux monochromes à contraste élevé, ou les images en couleur qui bénéficieraient d'une teinte de base améliorée pour vraiment se démarquer et créer un impact.
|
||||
|
||||
**FB Distinction 320 est parfait pour...**
|
||||
|
||||
- Images avec beaucoup de détails et de profondeur d'ombre
|
||||
- Images percutantes et à contraste élevé
|
||||
- Monochromes qui bénéficieraient d'une base blanche brillante
|
||||
|
||||
https://www.permajet.com/product/fb-distinction-320/
|
||||
|
||||
|
||||
|
||||
# FB Gold Silk 315
|
||||
|
||||
FB Gold Silk 315 est un papier jet d'encre à base de fibres avec une surface satinée et une teinte de base chaude naturelle. Ce papier primé a un Dmax record, ce qui vous permet d'imprimer les noirs les plus profonds et les plus veloutés qui créent du contraste et de la définition. Avec des détails nets et une belle couleur et une capacité monochrome, combinées à la somptueuse surface en soie, FB Gold Silk est la quintessence de la qualité. Il reproduit les matériaux traditionnels de la chambre noire baryte avec une finesse qui impressionnera tout spectateur.
|
||||
|
||||
Créez des impressions exceptionnelles à chaque fois grâce à l'adéquation de ce papier à un large éventail de sujets et de types d'images. FB Gold Silk 315 excelle avec les portraits et le travail monochrome, grâce à sa large gamme de tons et à sa teinte de base chaude. Ce papier Alpha Cellulose est idéal pour les concours photographiques, les expositions, les portfolios et plus encore.
|
||||
|
||||
**FB Gold Silk 315 est parfait pour...**
|
||||
|
||||
- Noirs et ombres profonds sans perte de détails
|
||||
- Images du côté plus chaud, en particulier les tons de peau
|
||||
- Chambre noire rappelant les imprimés, fans de la soie originale en fibre d'or Ilford Galerie
|
||||
|
||||
https://www.permajet.com/product/fb-gold-silk-315/
|
||||
|
||||
|
||||
|
||||
# FB Matt 285
|
||||
|
||||
FB Matt 285 est un papier jet d'encre à base de fibres avec une surface mate lisse et une teinte de base blanche brillante. Rappelant le papier chambre noire traditionnel, et la seule variété mate de la gamme, c'est une alternative fantastique pour les photographes et les artistes qui préfèrent les finitions mates.
|
||||
|
||||
Ce papier Alpha Cellulose est hautement recherché pour sa surface mate lisse et veloutée, qui imprime avec des tons nuancés et des détails nets. C'est le choix parfait pour une variété d'images, des paysages doux à l'architecture saisissante, et il capturera chaque détail avec sa couche de base de baryte supérieure. Des images monochromes s'impriment avec une merveilleuse gamme de tons et des noirs nets, tandis que les couleurs sont délicates et sophistiquées. La surface mate et la technologie de pose à plat rendent ce papier très approprié pour l'encadrement, idéal pour les expositions photographiques, les galeries d'art et les œuvres d'art mural.
|
||||
|
||||
**FB Matt 285 est parfait pour...**
|
||||
|
||||
- Monochromes avec une large gamme de tons
|
||||
- Paysage et art moderne avec des gradations lisses
|
||||
- Impressions de haute qualité qui seront visualisées derrière le verre
|
||||
|
||||
https://www.permajet.com/product/fb-matt-285/
|
||||
|
||||
|
||||
|
||||
# FB Pearl 300
|
||||
|
||||
FB Pearl 300 est un papier jet d'encre à base de fibres avec une superbe surface perlée et une teinte de base blanche naturelle. Créez de somptueux imprimés qui rappellent les matériaux traditionnels de chambre noire aux halogénures d'argent, avec une excellente gamme de tons, des détails et Dmax, le choix parfait pour les travailleurs monochromes. La photographie couleur et les illustrations imprimeront avec une vivacité et une profondeur qui attirent le spectateur.
|
||||
|
||||
La surface en perles a un aspect luxueux qui ajoute de la vie aux images et une sensation générale de qualité. FB Pearl 300 est un excellent choix pour la photographie de portrait et de paysage grâce à sa large gamme de tons et à sa base blanche naturelle. Fabriqué à partir d'Alpha Cellulose, il est sans acide et sans OBA, ce qui permet des impressions de qualité archivistique à 100 %. La finition de haute qualité et la longévité archivistique font de ce papier le choix idéal pour les tirages d'art et les expositions.
|
||||
|
||||
**FB Pearl 300 est parfait pour...**
|
||||
|
||||
- Portraits et paysages nécessitant une finition luxueuse et étincelante
|
||||
- Imprimés de qualité chambre noire
|
||||
- Prises de vue et images à longue exposition avec beaucoup de tons moyens
|
||||
|
||||
https://www.permajet.com/product/fb-pearl-300/
|
||||
|
||||
|
||||
|
||||
# FB Royal Gloss 310
|
||||
|
||||
*Veuillez noter que le stock actuel de FB Royal Gloss 310 a subi un changement de température et a maintenant une teinte de base plus blanche*
|
||||
FB Royal Gloss 310 est un papier jet d'encre à base de fibres avec une surface brillante raffinée et une teinte de base blanche naturelle. Rappelant les matériaux traditionnels émaillés de la chambre noire, ce papier a un bel aspect et une belle sensation avec de subtiles ondulations à travers la surface. Il imprime avec des détails glorieux et des couleurs fidèles à la réalité grâce à la base blanche naturelle, l'option parfaite pour les photographes animaliers, portraits et paysages.
|
||||
|
||||
Ce papier Alpha Cellulose a une base de baryte sans acide et une sensation de poids lourd désirable, idéal pour les expositions d'art, les concours et plus encore. Sa qualité d'impression est exceptionnelle et ne manquera pas d'impressionner tous les amateurs traditionnels de chambre noire.
|
||||
|
||||
**FB Royal Gloss 310 est parfait pour...**
|
||||
|
||||
- Couleurs fidèles à la vie et noirs profonds
|
||||
- Expositions et œuvres d'art
|
||||
- Répliques d'impressions traditionnelles à base de fibres émaillées
|
||||
|
||||
https://www.permajet.com/product/fb-royal-gloss-310/
|
||||
|
||||
|
||||
|
||||
176
docs/Divers/Permajet/Photo_numerique.md
Normal file
@@ -0,0 +1,176 @@
|
||||
# Papiers photo numérique (10)
|
||||
|
||||
|
||||
|
||||
Une gamme créativement équilibrée de papiers photographiques, graphiques et d'impression d'affiches développée au cours des 25 dernières années pour donner à vos images et œuvres d'art un rendu parfait à un prix attractif.
|
||||
|
||||
Adaptés à une utilisation avec les encres colorantes et pigmentaires, ces papiers photo numériques peuvent être utilisés dans n'importe quelle imprimante à jet d'encre et sont tous dotés d'une technologie de séchage instantané. Les matériaux de base en papier « blanc brillant » sont enduits pour donner une large gamme de couleurs et un Dmax exceptionnellement élevé. La combinaison de nos avancées technologiques a été fournie pour vous donner des images nettes et nettes impressionnantes à la densité d'impression la plus élevée, donnant à votre image l'aspect et la sensation dynamiques que vous voulez créer.
|
||||
|
||||
|
||||
|
||||
# Gloss 271
|
||||
|
||||
Gloss 271 est un papier jet d'encre instantané sec et brillant avec une base blanche brillante. Il imprime avec des couleurs vives et des détails nets, parfait pour les photos de famille de tous les jours jusqu'au travail en studio commercial. La surface reproduit une belle gamme de tons et un contraste profond, fini par un brillant lisse et étincelant qui ajoutera de la vie à n'importe quelle image. Gloss 271 est un excellent choix pour la photographie audacieuse et le travail graphique qui doit avoir l'air net et percutant.
|
||||
|
||||
Ce papier photo numérique enduit de résine a un poids de 271 g/m2 qui passera sans effort à travers votre imprimante tout en ayant une sensation de haute qualité à portée de main. Son superporeux et protecteur UV ajoute un haut niveau de résistance à l'humidité et à la décoloration, assurant que vos photos ont l'air fantastiques pour les années à venir.
|
||||
|
||||
**Gloss 271 est parfait pour...**
|
||||
|
||||
- Cas où une finition haute brillance est souhaitée
|
||||
- Couleurs vibrantes et saturées
|
||||
- Impressions quotidiennes, publicité et travail en studio
|
||||
|
||||
https://www.permajet.com/product/gloss-271/
|
||||
|
||||
|
||||
|
||||
# MattPlus 240
|
||||
|
||||
MattPlus 240 est un papier jet d'encre de poids moyen avec une surface mate lisse. Créez des impressions vibrantes et percutantes avec la somptueuse surface mate qui donne de la profondeur aux images sans éblouissement ni textures gênants. Les impressions sur ce papier ont des détails nets incroyables et des couleurs riches, tandis que l'impressionnante gamme de tons rend ce papier tout aussi désirable pour le travail monochrome.
|
||||
|
||||
MattPlus 240 a une teinte de base blanche propre qui fournit des impressions précises, ce qui en fait un choix fantastique pour les reproductions d'œuvres d'art numériques, les peintures murales photographiques et les documents marketing.
|
||||
|
||||
Ce papier photo numérique a une base Alpha Cellulose, offrant une grande qualité et des résultats qui auront l'air fantastiques pour les années à venir. Son poids de 240 g/m2 alimente sans effort n'importe quelle imprimante tout en ayant une sensation de qualité.
|
||||
|
||||
**Matt Plus 240 est parfait pour...**
|
||||
|
||||
- Couleurs profondes et nettes et détails nets
|
||||
- Faune et portraits aux tons doux
|
||||
- Impression quotidienne nécessitant une finition mate
|
||||
|
||||
https://www.permajet.com/product/matt-plus-240/
|
||||
|
||||
|
||||
|
||||
# Matt Proofing 160
|
||||
|
||||
Matt Proofing 160 est le papier jet d'encre le plus léger de la gamme PermaJet et une option très économique. Il a une surface mate lisse et est conçu avec l'épreuvage d'image à l'esprit, idéal pour produire des impressions d'essai et des feuilles de contact sans gaspiller de matériaux à coût plus élevé.
|
||||
|
||||
Bien que conçu pour les exigences de fermentation, ce papier Alpha Cellulose atteint toujours une excellente qualité et une excellente saturation encre pour les tirages photographiques de tous les jours. Cela rend Matt Proofing 160 parfait pour les photographes et les artistes à la recherche d'un papier jet d'encre avec un poids de base très léger. Sa surface lisse est nette et brillante, produisant des couleurs et des noirs forts.
|
||||
|
||||
En raison de son poids léger, ce papier alimente sans effort à travers n'importe quelle imprimante à jet d'encre.
|
||||
|
||||
**Matt Proofing 160 est parfait pour...**
|
||||
|
||||
- Feuilles de contact et tirages de test
|
||||
- Impression à usage général nécessitant un poids de base inférieur
|
||||
|
||||
https://www.permajet.com/product/matt-proofing-160/
|
||||
|
||||
|
||||
|
||||
# Oyster 271
|
||||
|
||||
Le papier jet d'encre le plus populaire de PermaJet, Oyster 271, est instantanément sec avec une base blanche brillante et une subtile surface perlée. Son revêtement microporeux offre un Dmax incroyable assurant une large gamme de tons et des couleurs riches et saturées, garantissant que même les images complexes donnent le meilleur d'elles-mêmes. Il a une surface de lustre magnifiquement délicate qui améliore les impressions sans se distraire du sujet, ce qui en fait un favori des photographes et des artistes.
|
||||
|
||||
Oyster 271 est trois fois primé et est souvent décrit comme un excellent papier polyvalent, convenant à une grande variété d'images, ce qui en fait un must pour le stock de chaque imprimeur. Ce papier photo numérique enduit de résine a un poids de 271 g/m2 qui passera sans effort à travers n'importe quelle imprimante à jet d'encre tout en ayant une sensation de haute qualité à portée de main. Sa supercouche de protection UV ajoute un haut niveau de résistance à l'humidité et à la décoloration, ce qui garantit que vos photos sont fantastiques pour les années à venir.
|
||||
|
||||
**Oyster 271 est parfait pour...**
|
||||
|
||||
- Exigences quotidiennes, du portrait à la faune
|
||||
- Images couleur et monochromes
|
||||
- Débutants cherchant à se familiariser avec l'impression
|
||||
|
||||
https://www.permajet.com/product/oyster-271/
|
||||
|
||||
|
||||
|
||||
# Photo Lustre 310
|
||||
|
||||
Photo Lustre 310 est un papier jet d'encre blanc brillant avec une surface luxueuse et brillante. Les couleurs sont profondes et saturées, et les images monochromes s'impriment avec une gamme de tons et un contraste incroyables. Le Dmax élevé donne des noirs intenses et riches tout en atteignant la définition dans les zones d'ombre. Sa finition lustrée est subtile tout en ajoutant un niveau de définition supplémentaire.
|
||||
|
||||
Ce papier photo numérique primé a un poids de base lourd pour une sensation de qualité que l'on trouve rarement dans un papier aussi économique, et une surface résistante et résistante aux rayures. Cela rend Photo Lustre 310 idéal pour toutes sortes d'utilisation où des couleurs percutantes et un contraste audacieux sont une priorité, des portfolios photographiques aux affichages de conception graphique.
|
||||
|
||||
Photo Lustre 310 dispose d'une supercouche microporeuse de protection contre les UV qui ajoute un niveau élevé de résistance à l'humidité et à la décoloration, garantissant que vos photographies et vos œuvres d'art ont l'air fantastiques pour les années à venir.
|
||||
|
||||
**Photo Lustre 310 est parfait pour...**
|
||||
|
||||
- Des couleurs riches et des noirs profonds et frappants
|
||||
- Impression quotidienne nécessitant une sensation de haute qualité
|
||||
- Images monochromes détaillées avec un fort contraste
|
||||
|
||||
https://www.permajet.com/product/photo-lustre-310/
|
||||
|
||||
|
||||
|
||||
# Smooth Gloss 280
|
||||
|
||||
Smooth Gloss 280 est un papier jet d'encre sec instantané avec une finition miroir et brillante et une teinte de base chaude. Les images s'impriment avec dynamisme et précision détaillée, ce qui en fait le papier parfait pour les photographes ayant une publicité à fort impact et un travail en studio. Le Dmax élevé est capable de noirs profonds et d'une bonne gamme de tons, garantissant que les impressions sur Smooth Gloss 280 sont percutantes et nettes, finies avec la surface brillante qui ajoute un niveau supplémentaire de profondeur et d'impact.
|
||||
|
||||
Ce papier photo numérique enduit de résine a un poids de 280 g/m2 qui se nourrira sans effort à travers n'importe quelle imprimante à jet d'encre tout en ayant une sensation de haute qualité à portée de main. Sa supercouche microporeuse de protection UV ajoute un haut niveau de résistance à l'humidité et à la décoloration, garantissant que vos photographies et vos œuvres d'art sont fantastiques pour les années à venir.
|
||||
|
||||
**Smooth Gloss 280 est parfait pour...**
|
||||
|
||||
- Images où une teinte de base plus chaude est préférée
|
||||
- Images couleur et monochromes haute définition
|
||||
- Publicité, travail en studio, impression quotidienne
|
||||
|
||||
https://www.permajet.com/product/smooth-gloss-280/
|
||||
|
||||
|
||||
|
||||
# Smooth Pearl 280
|
||||
|
||||
Smooth Pearl 280 est un papier jet d'encre sec instantané au fini perlé subtil. Il a une teinte de base naturelle blanche/chaude qui le rend idéal pour les tons de peau, les studios de portrait, la photographie de paysage et les reproductions d'art. La superbe surface lisse avec sa finition perlée raffinée donne la sensation de luxe que l'on retrouve dans les papiers plus chers. Smooth Pearl 280 dispose d'un Dmax exceptionnel, capable de produire des noirs profonds et une large gamme de tons, adapté à la fois au travail monochrome et en couleur.
|
||||
|
||||
Ce papier photo numérique enduit de résine a un poids de 280 g/m2 qui se nourrira sans effort à travers n'importe quelle imprimante à jet d'encre tout en ayant une sensation de haute qualité à portée de main. Sa supercouche microporeuse de protection UV ajoute un haut niveau de résistance à l'humidité et à la décoloration, garantissant que vos photographies et vos œuvres d'art sont fantastiques pour les années à venir.
|
||||
|
||||
**Smooth Pearl 280 est parfait pour...**
|
||||
|
||||
- Impression quotidienne où une base plus chaude est préférée
|
||||
- Portraits aux tons lisses
|
||||
- Fans de l'original Ilford Smooth Pearl
|
||||
|
||||
https://www.permajet.com/product/smooth-pearl-280/
|
||||
|
||||
|
||||
|
||||
# Titanium Gloss 300
|
||||
|
||||
Titanium Gloss 300 est un papier jet d'encre brillant avec une base métallique unique. Il a un sous-ton argenté qui donne vie à des images où les sujets contiennent du métal, de l'eau et des surfaces réfléchissantes, les faisant briller sous la lumière.Ce papier photo numérique primé est le choix créatif idéal pour que votre travail se démarque et ait un impact élevé. La surface brillante n'est pas écrasante, ajoutant plutôt une finition luxueuse, tandis que les couleurs brillent presque grâce à la base réfléchissante à la lumière. Titanium Gloss 300 imprime avec des détails et une clarté incroyables et fonctionne extrêmement bien avec des images qui ont des couleurs vives, des noirs profonds et des zones blanches/argent qui permettent à la base métallique de transparaisse.
|
||||
|
||||
Ce papier enduit de résine a un poids de 300 g/m2 qui se nourrit sans effort à travers n'importe quelle imprimante à jet d'encre tout en ayant une sensation de haute qualité à portée de main.
|
||||
|
||||
**Titanium Gloss 300 est parfait pour...**
|
||||
|
||||
- Images avec de l'eau, du métal ou des sujets réfléchissants
|
||||
- Couleurs vives et monochromes contrastés
|
||||
- Images avec des zones blanches et des reflets pour permettre la base métallique pour briller
|
||||
|
||||
https://www.permajet.com/product/titanium-gloss-300/
|
||||
|
||||
|
||||
|
||||
# Titanium Lustre 280
|
||||
|
||||
Titanium Lustre 280 est un papier jet d'encre primé avec une base métallique unique et une surface éclatée subtile. Les images sautent de la page avec une apparence dramatique et un haut niveau de détail.
|
||||
|
||||
Ce papier photo numérique fonctionne particulièrement bien avec les images monochromes et HDR, sa base métallique argentée se prêtant à de larges gammes de tons et à des images à contraste élevé. Les subtiles ondulations de la surface brillante captent magnifiquement la lumière, ajoutant un éclat aux sujets qui contiennent du métal ou une surface réfléchissante, tandis que la base en papier métallique ajoute une sensation fidèle à la vie. Cela fait de Titanium Lustre 280 un choix créatif et remarquable pour cette œuvre spéciale.
|
||||
|
||||
Ce papier photo numérique enduit de résine a un poids de 280 g/m2 qui alimente sans effort n'importe quelle imprimante à jet d'encre tout en ayant une sensation de haute qualité à portée de main.
|
||||
|
||||
**Titanium Lustre 280 est parfait pour...**
|
||||
|
||||
- Images avec de l'eau, du métal ou des sujets réfléchissants
|
||||
- Couleurs vives et monochromes contrastés
|
||||
- Images avec des zones blanches et des reflets pour permettre la base métallique pour briller
|
||||
|
||||
https://www.permajet.com/product/titanium-lustre-280/
|
||||
|
||||
|
||||
|
||||
# Ultra Pearl 295
|
||||
|
||||
Ultra Pearl 295 est un papier jet d'encre blanc brillant avec une surface traditionnelle en perles prononcée. La base blanche brillante soulève les images et ajoute un look net adapté à un travail audacieux et discret. Il a un Dmax élevé qui imprime des noirs profonds et riches qui contrastent magnifiquement avec la teinte de base.
|
||||
|
||||
Ce papier photo numérique est particulièrement adapté au travail commercial, de la photographie scolaire aux mariages, grâce à sa surface robuste résistante aux éraflures et à ses propriétés anti-scan uniques, qui dissuadent toute tentative de reproduire vos impressions.
|
||||
|
||||
Ultra Pearl a un poids de 295 g/m2 qui passera sans effort à travers n'importe quelle imprimante à jet d'encre tout en ayant une sensation de haute qualité à portée de main. Sa supercouche microporeuse de protection UV ajoute un haut niveau de résistance à l'humidité et à la décoloration, garantissant que vos photographies et vos œuvres d'art sont fantastiques pour les années à venir.
|
||||
|
||||
**Ultra Pearl 295 est parfait pour...**
|
||||
|
||||
- Impressions qui seront beaucoup manipulées, signalisation intérieure
|
||||
- Photographie d'école et de studio - grâce à la couche anti-scan !
|
||||
- Images avec des noirs profonds
|
||||
|
||||
https://www.permajet.com/product/ultra-pearl-295/
|
||||
232
docs/Divers/alfred.md
Normal file
@@ -0,0 +1,232 @@
|
||||
# Alfred
|
||||
|
||||
|
||||
|
||||
### StackExchange Search for Alfred
|
||||
|
||||
https://github.com/deanishe/alfred-stackexchange
|
||||
|
||||
- `stack [<query>]` — Choose a StackExchange site to search.
|
||||
- `↩` — Select site
|
||||
- `⌘↩` — Set as default site
|
||||
- `⌥↩` — Reveal site icon in Finder
|
||||
- `⌘C` — Copy site ID to clipboard (for adding Script Filters)
|
||||
- `.so <query>` — Search StackOverflow.com for `<query>`. See below for syntax.
|
||||
- `↩` or `⌘+NUM` — Open result in default browser
|
||||
- `⌘L` — Show full question title in Alfred's Large Text window
|
||||
|
||||
Prefix a word in your `<query>` with `.` (full stop) to indicate that it's a tag, e.g `requests .python` will search for answers tagged `python` with the query `requests`.
|
||||
|
||||
|
||||
|
||||
### GitHub Repos workflow for Alfred
|
||||
|
||||
http://www.packal.org/workflow/github-repos
|
||||
|
||||
- `gh <query>` — Recherche globale
|
||||
- `repo <query>` — Recherche dans repos perso
|
||||
|
||||
|
||||
|
||||
### Google Suggest
|
||||
|
||||
- `g <query>`
|
||||
|
||||
|
||||
|
||||
### Amazon Suggest
|
||||
|
||||
- `amazon <query>`
|
||||
|
||||
|
||||
|
||||
### Search Notes.app with Alfred
|
||||
|
||||
https://github.com/sballin/alfred-search-notes-app
|
||||
|
||||
- `n <query>` — Recherche un titre ou crée une nouvelle note si non trouvée
|
||||
- `nb <query>` — Recherche dans les titres et les corps
|
||||
- `nf <query>` — Recherche nom de dossier
|
||||
|
||||
#### Result actions
|
||||
|
||||
- **enter** to open the note/folder or create a new note if none was found
|
||||
- **shift+enter** to search for your Alfred query using the Notes in-app search
|
||||
- **cmd+enter** to copy the note body to the clipboard
|
||||
- **alt+enter** to copy a link to the note to the clipboard
|
||||
|
||||
#### Note linking
|
||||
|
||||
You can generate links to any of your notes and use them on macOS or iOS. Copy the note URL by pressing alt+enter on an Alfred result or paste it using the snippet. This will generate two links. The first one works on macOS Big Sur (11) and newer, and the second one works on iOS.
|
||||
|
||||
|
||||
|
||||
### Font Awesome workflow for Alfred
|
||||
|
||||
https://github.com/ruedap/alfred-font-awesome-workflow
|
||||
|
||||
- `fa <query>`
|
||||
|
||||
|
||||
|
||||
- `Enter`: Paste class name (**for coding HTML/CSS**. e.g. `fa-arrow-circle-o-right`)
|
||||
- `Ctrl + Enter`: Paste character name and ligatures shoud convert the letter into the correct symbol. (**for designing in Photoshop, Illustrator, etc**)
|
||||
- `Shift + Enter`: Paste character code (e.g. `f18e`)
|
||||
- `Command + Enter`: Open in browser (e.g. http://fontawesome.io/icon/arrow-circle-o-right)
|
||||
|
||||
|
||||
|
||||
### Alfred Keywords
|
||||
|
||||
https://github.com/pochemuto/alfred-help-workflow
|
||||
|
||||
- `?` — affiche tous les mots-clés de tous les workflows
|
||||
|
||||
|
||||
|
||||
### alfred-show-network-info
|
||||
|
||||
https://github.com/jeppestaerk/alfred-show-network-info
|
||||
|
||||
- `ip4`
|
||||
|
||||
|
||||
|
||||
### Alfred Password Generator
|
||||
|
||||
https://github.com/deanishe/alfred-pwgen
|
||||
|
||||
- `pwgen [<strength>]` —
|
||||
- `pwlen [<length>]` —
|
||||
- `pwconf [<query>]` —
|
||||
|
||||
|
||||
|
||||
### Mac App Store Search
|
||||
|
||||
http://www.packal.org/workflow/mac-app-store-search
|
||||
|
||||
- `mas <query>`
|
||||
|
||||
|
||||
|
||||
### Search Browser tabs
|
||||
|
||||
https://github.com/luceat-lux-vestra/search-browser-tabs-for-alfred
|
||||
|
||||
- `tabs <query>`
|
||||
|
||||
|
||||
|
||||
### Play Song
|
||||
|
||||
https://github.com/caleb531/play-song
|
||||
|
||||
- `playsong hey jude` — Playing a song
|
||||
- `playsongin abbey road` — playsongin abbey road
|
||||
- `playsongby beatles` — playsongby beatles
|
||||
- `playalbum pet sounds` — Playing an album
|
||||
- `playalbumby beach boys` — playalbumby beach boys
|
||||
- `playartist killers` — Playing an artist
|
||||
- `playgenre alternative` — Playing a genre
|
||||
- `playplaylist favorites` — Playing a playlist
|
||||
- `shuffleon` — Controlling the Music app's global shuffle setting
|
||||
`shuffleoff` —
|
||||
`shuffletoggle` —
|
||||
|
||||
|
||||
|
||||
### Search-Alfred-Workflows
|
||||
|
||||
https://github.com/Acidham/search-alfred-workflows
|
||||
|
||||
- alf <request>
|
||||
|
||||
|
||||
|
||||
- `ENTER` — Shows a list of keywords in the workflow and starts the workflow with a keyword
|
||||
- `SHIFT` — Shows the workflow description , associated keywords and keyboard Shortcuts
|
||||
- `CMD` — For addtional Actions:
|
||||
- Copy path to Clipboard
|
||||
- Open WF Folder in Terminal
|
||||
- If you would like to use other terminal than macOS terminal.app change config in Alfred > Features > Terminal to custom
|
||||
- Reveal in Finder
|
||||
- Open in FileManager (if defined)
|
||||
|
||||
##
|
||||
|
||||
# alfred-markdown-search
|
||||
|
||||
https://github.com/leafney/alfred-markdown-search
|
||||
|
||||
- `mdd` — les 20 derniers fichiers
|
||||
- `mdd -t php` — recherche par mot-clé dans le titre
|
||||
- `mdd php` — recherche pleine par mot-clé
|
||||
- `mdd -t golang python` — recherche 'golang' dans le titre et 'python' dans le contenu
|
||||
- `mdd -t golang,python`— recherche 'golang' et 'python' dans le titre
|
||||
- `mdd -t golang,python mysql` — recherche 'golang' et 'python' dans le titre , et 'mysql' dans le contenu
|
||||
|
||||
|
||||
|
||||
## alfred tldr
|
||||
|
||||
https://github.com/konoui/alfred-tldr
|
||||
|
||||
- `tldr` <query>
|
||||
|
||||
Options
|
||||
`--version`/`-v` option shows the current version of the client.
|
||||
`--update`/`-u` option updates local database (tldr repository).
|
||||
`--platform`/`-p` option selects platform from `linux`,`osx`,`sunos`,`windows`.
|
||||
`--language`/`-L` option selects preferred language for the page.
|
||||
|
||||
##
|
||||
|
||||
### Alfred Sonos Controller
|
||||
|
||||
https://github.com/karimkaylani/alfred-sonoscontroller
|
||||
|
||||
- `soco`
|
||||
|
||||
|
||||
|
||||
### alfred-wordpress-developer-workflow
|
||||
|
||||
https://github.com/keesiemeijer/alfred-wordpress-developer-workflow
|
||||
|
||||
|
||||
|
||||
### Sublime Text Projects Alfred Workflow
|
||||
|
||||
https://github.com/deanishe/alfred-sublime-text
|
||||
|
||||
|
||||
|
||||
### alfred_remote_IINA_Controller
|
||||
|
||||
https://github.com/qiujie8092916/alfred_remote_IINA_Controller
|
||||
|
||||
|
||||
|
||||
### Cheatsheet
|
||||
|
||||
https://github.com/mutdmour/alfred-workflow-cheatsheet
|
||||
|
||||
## alfred-amphetamine
|
||||
|
||||
https://github.com/demartini/alfred-amphetamine
|
||||
|
||||
### Alfred Browser Tabs
|
||||
|
||||
https://github.com/epilande/alfred-browser-tabs
|
||||
|
||||
### Joplin Noteplan Actions
|
||||
|
||||
https://github.com/beet/joplin_alfred_actions
|
||||
|
||||
###
|
||||
|
||||
|
||||
|
||||
https://pacmax.org
|
||||
|
||||
196
docs/Divers/bash/HereDoc.md
Normal file
@@ -0,0 +1,196 @@
|
||||
# HereDoc
|
||||
|
||||
|
||||
|
||||
- **Commande** - Toute commande (chat, wc, courrier, etc.) qui accepte la redirection.
|
||||
- **Opérateur de redirection (`<<`)** - L'opérateur par défaut pour HereDoc est `**<<**`. Il redirige le bloc de code vers la commande pour le traitement.
|
||||
- **Delimiter Token** - The delimiter token denotes the start and end of the document (code block). The delimiter token can be anything but it should be identical. Typically you will see `EOF` is used as delimiter
|
||||
|
||||
|
||||
|
||||
#### Afficher une chaîne multi-ligne avec HereDoc
|
||||
|
||||
```bash
|
||||
$ cat << EOF
|
||||
Souvent, pour s’amuser, les hommes d’équipage
|
||||
Prennent des albatros, vastes oiseaux des mers,
|
||||
Qui suivent, indolents compagnons de voyage,
|
||||
Le navire glissant sur les gouffres amers.EOF
|
||||
heredoc
|
||||
EOF
|
||||
|
||||
Souvent, pour s’amuser, les hommes d’équipage
|
||||
Prennent des albatros, vastes oiseaux des mers,
|
||||
Qui suivent, indolents compagnons de voyage,
|
||||
Le navire glissant sur les gouffres amers.EOF
|
||||
heredoc
|
||||
```
|
||||
|
||||
#### Compter des lignes
|
||||
|
||||
```bash
|
||||
$ wc -l << BLK
|
||||
Souvent, pour s’amuser, les hommes d’équipage
|
||||
Prennent des albatros, vastes oiseaux des mers,
|
||||
Qui suivent, indolents compagnons de voyage,
|
||||
Le navire glissant sur les gouffres amers.EOF
|
||||
heredoc
|
||||
BLK
|
||||
|
||||
5
|
||||
```
|
||||
|
||||
#### Redirection et pipe
|
||||
|
||||
```bash
|
||||
$ cat << EOF > /tmp/heredoc.txt
|
||||
Souvent, pour s’amuser, les hommes d’équipage
|
||||
Prennent des albatros, vastes oiseaux des mers,
|
||||
Qui suivent, indolents compagnons de voyage,
|
||||
Le navire glissant sur les gouffres amers.
|
||||
EOF
|
||||
|
||||
$ bat /tmp/heredoc.txt
|
||||
Souvent, pour s’amuser, les hommes d’équipage
|
||||
Prennent des albatros, vastes oiseaux des mers,
|
||||
Qui suivent, indolents compagnons de voyage,
|
||||
Le navire glissant sur les gouffres amers.
|
||||
```
|
||||
|
||||
#### Suppression des Tab
|
||||
|
||||
Faire suivre l'opérateur de redirection par "-"
|
||||
|
||||
```bash
|
||||
$ cat <<- err_msg
|
||||
Souvent, pour s’amuser, les hommes d’équipage
|
||||
Prennent des albatros, vastes oiseaux des mers,
|
||||
Qui suivent, indolents compagnons de voyage,
|
||||
Le navire glissant sur les gouffres amers.
|
||||
err_msg
|
||||
|
||||
Souvent, pour s’amuser, les hommes d’équipage
|
||||
Prennent des albatros, vastes oiseaux des mers,
|
||||
Qui suivent, indolents compagnons de voyage,
|
||||
Le navire glissant sur les gouffres amers.
|
||||
```
|
||||
|
||||
#### Expansion de variables et commandes
|
||||
|
||||
```bash
|
||||
AUTHOR="OSTechNix"
|
||||
|
||||
cat << EOF
|
||||
Author: ${AUTHOR} # USER DEFINED VARIABLE
|
||||
Article: Bash Heredoc
|
||||
I am using the ${SHELL} shell # ENV VARIABLE
|
||||
$(whoami) # EXTERNAL COMMAND
|
||||
EOF
|
||||
|
||||
Author: OSTechNix # USER DEFINED VARIABLE
|
||||
Article: Bash Heredoc
|
||||
I am using the /bin/zsh shell # ENV VARIABLE
|
||||
bruno # EXTERNAL COMMAND
|
||||
```
|
||||
|
||||
Supprimer l'expansion (cat << 'EOF'):
|
||||
|
||||
```bash
|
||||
AUTHOR="OSTechNix"
|
||||
|
||||
cat << 'EOF'
|
||||
Author: ${AUTHOR} # USER DEFINED VARIABLE
|
||||
Article: Bash Heredoc
|
||||
I am using the ${SHELL} shell # ENV VARIABLE
|
||||
$(whoami) # EXTERNAL COMMAND
|
||||
EOF
|
||||
|
||||
Author: ${AUTHOR} # USER DEFINED VARIABLE
|
||||
Article: Bash Heredoc
|
||||
I am using the ${SHELL} shell # ENV VARIABLE
|
||||
$(whoami) # EXTERNAL COMMAND
|
||||
```
|
||||
|
||||
#### Commentaire multi-lignes:
|
||||
|
||||
```bash
|
||||
: << 'COMMENTS'
|
||||
Souvent, pour s’amuser, les hommes d’équipage
|
||||
Prennent des albatros, vastes oiseaux des mers,
|
||||
Qui suivent, indolents compagnons de voyage,
|
||||
Le navire glissant sur les gouffres amers.
|
||||
COMMENTS
|
||||
|
||||
```
|
||||
|
||||
#### Echapper les caractères spéciaux:
|
||||
|
||||
```bash
|
||||
# SINGLE QUOTES ESCAPE
|
||||
cat << 'EOF'
|
||||
I am using the ${SHELL} shell # ENV VARIABLE
|
||||
$(whoami) # EXTERNAL COMMAND
|
||||
EOF
|
||||
|
||||
I am using the ${SHELL} shell # ENV VARIABLE
|
||||
$(whoami) # EXTERNAL COMMAND
|
||||
|
||||
# DOUBLE QUOTES ESCAPE
|
||||
cat << "EOF"
|
||||
I am using the ${SHELL} shell # ENV VARIABLE
|
||||
$(whoami) # EXTERNAL COMMAND
|
||||
EOF
|
||||
|
||||
I am using the ${SHELL} shell # ENV VARIABLE
|
||||
$(whoami) # EXTERNAL COMMAND
|
||||
|
||||
# BACKSLASH ESCAPE
|
||||
cat << \EOF
|
||||
I am using the ${SHELL} shell # ENV VARIABLE
|
||||
$(whoami) # EXTERNAL COMMAND
|
||||
EOF
|
||||
|
||||
I am using the ${SHELL} shell # ENV VARIABLE
|
||||
$(whoami) # EXTERNAL COMMAND
|
||||
|
||||
# BACKSLASH ESCAPE (one charactere)
|
||||
cat << EOF
|
||||
I am using the \${SHELL} shell # ENV VARIABLE
|
||||
$(whoami) # EXTERNAL COMMAND
|
||||
EOF
|
||||
|
||||
I am using the ${SHELL} shell # ENV VARIABLE
|
||||
bruno # EXTERNAL COMMAND
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Exemples d'utilisation:
|
||||
|
||||
```bash
|
||||
$ ssh -T user@host << EOF
|
||||
Command 1...
|
||||
Command 2..
|
||||
.....
|
||||
Command N..
|
||||
EOF
|
||||
```
|
||||
|
||||
```bash
|
||||
# add -T flag to ssh command which will disable pseudo-terminal allocation.
|
||||
|
||||
declare -a server=( host1 host2 host3 )
|
||||
for host in ${server[@]}
|
||||
do
|
||||
ssh -T user@${host} << EOF
|
||||
echo "Running at host - ${host}"
|
||||
if [[ ! -f /home/ostechnix/test ]];then
|
||||
touch /home/ostechnix/test
|
||||
echo "File Created"
|
||||
else
|
||||
echo "File exists"
|
||||
fi
|
||||
EOF
|
||||
done
|
||||
```
|
||||
|
||||
106
docs/Divers/bash/basename.md
Normal file
@@ -0,0 +1,106 @@
|
||||
# Basename
|
||||
|
||||
|
||||
|
||||
### basename
|
||||
|
||||
Récupérer la dernière partie d'un chemin (nom du fichier):
|
||||
|
||||
```bash
|
||||
basename /usr/local/etc/php/8.0/conf.d/ext-apcu.ini
|
||||
|
||||
ext-apcu.ini
|
||||
```
|
||||
Récupérer la dernière partie d'un chemin (dossier):
|
||||
|
||||
```bash
|
||||
basename /usr/local/etc/php/8.0/conf.d/
|
||||
|
||||
conf.d
|
||||
```
|
||||
|
||||
Récupérer le nom de fichier sans l'extension
|
||||
|
||||
```bash
|
||||
basename -s .ini /usr/local/etc/php/8.0/conf.d/ext-apcu.ini
|
||||
|
||||
ext-apcu
|
||||
```
|
||||
|
||||
Sur plusieurs chemins:
|
||||
|
||||
```bash
|
||||
basename -a -s .ini /usr/local/etc/php/8.0/conf.d/ext-apcu.ini
|
||||
|
||||
/usr/local/etc/php/7.3/conf.d/ext-ssh2.ini
|
||||
ext-apcu
|
||||
ext-ssh2
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### dirname
|
||||
|
||||
Récupérer le chemin (sans le nom du fichier):
|
||||
|
||||
```bash
|
||||
dirname /usr/local/etc/php/8.0/conf.d/ext-apcu.ini
|
||||
|
||||
/usr/local/etc/php/8.0/conf.d
|
||||
```
|
||||
|
||||
Si le chemin n'est pas indiqué:
|
||||
|
||||
```bash
|
||||
/usr/local/etc/php/7.3/conf.d
|
||||
dirname ext-apcu.ini
|
||||
.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### $0
|
||||
|
||||
Récupérer le chemin du script courant:
|
||||
|
||||
```bash
|
||||
nano chemins.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash title="chemins.sh"
|
||||
#!/usr/local/bin/bash
|
||||
|
||||
echo "Chemin du script: " $0
|
||||
echo "Le script exécuté a comme basename `basename "$0"`, dirname `dirname "$0"`"
|
||||
echo "Le répertoire courant est `pwd`"
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash title="./chemins.sh"
|
||||
Chemin du script: ./chemins.sh
|
||||
Le script exécuté a comme basename chemins.sh, dirname .
|
||||
Le répertoire courant est /Users/bruno/Documents/shell_scripts
|
||||
```
|
||||
|
||||
```bash title="/Users/bruno/Documents/shell_scripts/chemins.sh"
|
||||
Chemin du script: /Users/bruno/Documents/shell_scripts/chemins.sh
|
||||
Le script exécuté a comme basename chemins.sh, dirname /Users/bruno/Documents/shell_scripts
|
||||
Le répertoire courant est /Users/bruno/Documents/shell_scripts
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### realpath
|
||||
|
||||
```bash
|
||||
fullPATH=$(realpath "$0")
|
||||
|
||||
echo "fullPATH: $fullPATH"
|
||||
fullPATH: /Users/bruno/Documents/Scripts/bash/handbrake_for_plex.sh
|
||||
```
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
|
||||
Ajouter un préfixe à la ligne d'un fichier texte:
|
||||
#### Ajouter un préfixe à la ligne d'un fichier texte:
|
||||
|
||||
```bash
|
||||
brew list | sed -e 's/^/brew install /' > brew-list.txt
|
||||
@@ -16,7 +16,7 @@ sed -e 's/$/suffix/'
|
||||
|
||||
|
||||
|
||||
Cherche tous les .jpg d'un répertoire et les effacer:
|
||||
#### Cherche tous les .jpg d'un répertoire et les effacer:
|
||||
|
||||
```bash
|
||||
find . -name '*jpg' -exec rm {} +
|
||||
@@ -24,14 +24,15 @@ find . -name '*jpg' -exec rm {} +
|
||||
|
||||
|
||||
|
||||
Concaténer tous les .csv:
|
||||
#### Concaténer tous les .csv:
|
||||
|
||||
```bash
|
||||
find . -type f -iname "*.csv" -exec cat {} \; > toutes.txt
|
||||
```
|
||||
|
||||
|
||||
Couleurs dans le terminal:
|
||||
|
||||
#### Couleurs dans le terminal:
|
||||
|
||||
```bash
|
||||
export UNDERLINE=$(tput sgr 0 1)
|
||||
@@ -61,7 +62,9 @@ for i in {0..255}; do echo "$(tput setaf $i)test"; done
|
||||
|
||||
```
|
||||
|
||||
Supprimer récursivement tous les fichiers .DS_ST0RE:
|
||||
|
||||
|
||||
#### Supprimer récursivement tous les fichiers .DS_ST0RE:
|
||||
|
||||
```bash
|
||||
sudo find / -name ".DS_Store" -depth -exec rm {} \;
|
||||
@@ -75,7 +78,9 @@ find . -name '*.DS_Store' -type f -delete
|
||||
find . -name '.DS_Store' -type f -print -exec rm -f {} +
|
||||
```
|
||||
|
||||
Commentaire multi-lignes:
|
||||
|
||||
|
||||
#### Commentaire multi-lignes:
|
||||
|
||||
```bash
|
||||
res1=$(gdate +%s.%N)
|
||||
@@ -99,15 +104,17 @@ echo -e "\e[1;34m $dd $dh $dm $ds \e[0m"
|
||||
END_COMMENT
|
||||
```
|
||||
|
||||
Créer une playlist .m3u:
|
||||
|
||||
|
||||
#### Créer une playlist .m3u:
|
||||
|
||||
```bash
|
||||
$ ~/Music/Shaka Ponk - Apelogies/CD1 master*
|
||||
# Musepack(mpc) Monkey's Audio(ape) WavPack(wv) Apple alac(m4a)
|
||||
|
||||
❯ printf "#EXTM3U\n" > playlist.m3u
|
||||
printf "#EXTM3U\n" > playlist.m3u
|
||||
|
||||
❯ ls -1v | grep -E '.mp3|.mp4|.m4a|.aac|.alac|.flac|.ogg|.mpc|.ape|.wma|.wav' >> playlist.m3u
|
||||
ls -1v | grep -E '.mp3|.mp4|.m4a|.aac|.alac|.flac|.ogg|.mpc|.ape|.wma|.wav' >> playlist.m3u
|
||||
|
||||
#EXTM3U
|
||||
01. ————————THE GREATEST TITS.mp3
|
||||
@@ -130,11 +137,35 @@ $ ~/Music/Shaka Ponk - Apelogies/CD1 master*
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ printf "#EXTM3U\n" > playlist.m3u
|
||||
❯ find . -name '*.mp3' | sort >> playlist.m3u
|
||||
printf "#EXTM3U\n" > playlist.m3u
|
||||
find . -name '*.mp3' | sort >> playlist.m3u
|
||||
```
|
||||
|
||||
```bash
|
||||
for i in {1..5}; do printf "#EXTM3U\n" > ${i}star.m3u; find . -type f -exec grep -i -l --text "rating.$i" '{}' \; >> ${i}star.m3u; done
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Remplacer les espaces dans les noms de dossiers/fichiers:
|
||||
|
||||
```bash
|
||||
find ./thumsup -name "* *" -print0 | sort -rz | while read -d $'\0' f; do mv -v "$f" "$(dirname "$f")/$(basename "${f// /_}")"; done
|
||||
r
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Connaitre le nom du Terminal:
|
||||
|
||||
```bash
|
||||
$ ps -p $$ -o args,ppid
|
||||
ARGS PPID
|
||||
-zsh 705
|
||||
|
||||
$ ps -p 705 -o args # <- PPID
|
||||
ARGS
|
||||
/usr/bin/login -fqpl bruno /Applications/iTerm.app/Contents/MacO
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ $ history
|
||||
|
||||
|
||||
|
||||
#### Commandes:
|
||||
|
||||
```bash
|
||||
$ history | grep 'chmod'
|
||||
250 sudo chmod -R 755 gallery/
|
||||
@@ -49,6 +51,71 @@ $ history | grep 'chmod'
|
||||
526 history | grep 'chmod'
|
||||
```
|
||||
|
||||
Excécuter une commande de l'historique d'après son nombre (!#):
|
||||
|
||||
```bash title="!507"
|
||||
$ !507
|
||||
cd .ssh/
|
||||
drwx------ 1 bruno users 124 Mar 15 19:23 .
|
||||
drwxr-xr-x 1 bruno users 812 Mar 16 09:31 ..
|
||||
-rw------- 1 bruno users 5325 Mar 31 2020 _authorized_keys.bak
|
||||
-rw------- 1 bruno users 8200 Mar 11 14:30 authorized_keys
|
||||
-rw------- 1 bruno users 3326 Nov 19 2019 id_rsa
|
||||
-rw-r--r-- 1 bruno users 734 Nov 19 2019 id_rsa.pub
|
||||
-rw-r--r-- 1 bruno users 550 Mar 15 11:00 known_hosts
|
||||
bruno@DS916:~/.ssh $
|
||||
```
|
||||
|
||||
Excécuter 2 commandes en arrière:
|
||||
|
||||
```bash title="!-2"
|
||||
$ !-2
|
||||
|
||||
# 10 commandes en arrière
|
||||
$ !-10
|
||||
```
|
||||
|
||||
Ré-excécuter la dernière commande (!!):
|
||||
|
||||
```bash title="!!"
|
||||
$ cat .npmrc
|
||||
#prefix=/var/services/homes/bruno/.npm-packages
|
||||
tmp=/tmp
|
||||
|
||||
$ !!
|
||||
cat .npmrc
|
||||
#prefix=/var/services/homes/bruno/.npm-packages
|
||||
tmp=/tmp
|
||||
|
||||
# !! est équivalent à !-1
|
||||
```
|
||||
|
||||
Relancer la dernière commande avec sudo comme préfixe:
|
||||
|
||||
```bash title="sudo !!"
|
||||
$ nano /etc/fstab
|
||||
|
||||
$ sudo !!
|
||||
sudo nano /etc/fstab
|
||||
|
||||
```
|
||||
|
||||
Relancer la dernière commande avec 'keygen':
|
||||
|
||||
```bash title="!keygen"
|
||||
$ !keygen
|
||||
ssh-keygen -t rsa -b 1024
|
||||
```
|
||||
|
||||
Rechercher la dernière commande avec 'keygen' sans l'exécuter:
|
||||
|
||||
```bash title="!keygen:p"
|
||||
# on ajoute :p après
|
||||
|
||||
$ !keygen:p
|
||||
ssh-keygen -t rsa -b 1024
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
@@ -73,7 +140,7 @@ $ history
|
||||
5039* 916e
|
||||
```
|
||||
|
||||
|
||||
Grep:
|
||||
|
||||
```bash
|
||||
$ history | grep mas
|
||||
@@ -86,3 +153,7 @@ $ history | grep mas
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Arguments:
|
||||
|
||||
|
||||
57
docs/Divers/bash/curl.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# curl
|
||||
|
||||
#
|
||||
|
||||
#### Envoyer un fichier sur un ftp (Photomanager iPad):
|
||||
|
||||
```bash
|
||||
curl -T /Users/bruno/Pictures/_Canon/Export/2023/Janvier/2023-01-21_FauconPelerin_0518.jpg ftp://192.168.2.112:2121 -u anonymous:
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Envoyer plusieurs fichiers sur un ftp (funnymac):
|
||||
|
||||
```bash
|
||||
find /Users/bruno/Pictures/_Canon/Export/2023/Janvier/ -type f | xargs -L 1 bash -c '/opt/homebrew/opt/curl/bin/curl --user funnymac:a3XELN4PHTYF9fFHtsY97eshXBxxFo -T $1 sftp://ftp.cluster011.ovh.net:22/home/funnymac/www/ftp/${1##*/}' \;
|
||||
```
|
||||
|
||||
```bash
|
||||
for file in /folder/path/*
|
||||
do
|
||||
curl -u username:password -T ${file} http://www.example.com/folder/${file}
|
||||
done
|
||||
```
|
||||
|
||||
```bash
|
||||
# Si le dossier juin n'existe pas sur le ftp, on le crée:
|
||||
|
||||
find /Users/bruno/Desktop/Juin -type f | xargs -L 1 bash -c '/opt/homebrew/opt/curl/bin/curl --user funnymac:a3XELN4PHTYF9fFHtsY97eshXBxxFo --ftp-create-dirs -T $1 sftp://ftp.cluster011.ovh.net:22/home/funnymac/www/ftp/juin/${1##*/}' \;
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Télécharger un fichier depuis un ftp (funnymac):
|
||||
|
||||
```bash
|
||||
/opt/homebrew/opt/curl/bin/curl --user funnymac:a3XELN4PHTYF9fFHtsY97eshXBxxFo -O sftp://ftp.cluster011.ovh.net:22/home/funnymac/8_2022.jpg
|
||||
```
|
||||
|
||||
#### Télécharger plusieurs fichiers depuis un ftp (funnymac):
|
||||
|
||||
```bash
|
||||
/opt/homebrew/opt/curl/bin/curl --user funnymac:a3XELN4PHTYF9fFHtsY97eshXBxxFo -T '{2023-01-31_RuBlanc_0627,2023-01-31_RuBlanc_0623}.jpg' sftp://ftp.cluster011.ovh.net:22/home/funnymac/www/ftp/ \;
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
-Z, --parallel
|
||||
-#, --progress-bar
|
||||
-Q, --quote <command>
|
||||
-S, --show-error
|
||||
-s, --silent
|
||||
|
||||
```
|
||||
|
||||
39
docs/Divers/bash/getopts.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# getopts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| getopts | getopt (BSD) | getopt (GNU) |
|
||||
| ------------------ | -------------------------------- | ------------------------------------------------- |
|
||||
| builtin Bash | bin: <br />/usr/bin/getopt<br /> | bin:<br />/opt/homebrew/opt/gnu-getopt/bin/getopt |
|
||||
| option courte (-h) | | option longue (--help, -h) |
|
||||
| - | | gère les flags vides |
|
||||
| OPTIN et OPTARG | | |
|
||||
|
||||
|
||||
|
||||
#### Syntaxe:
|
||||
|
||||
```bash
|
||||
getopts optstring varname [arg ...]
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### optstring:
|
||||
|
||||
- si une lettre est suivi par : , l'option attend un argument
|
||||
- si optstring commence par : , la variable shell OPTARG est définie sur le caractère d'option trouvé, mais aucune sortie n'est écrite sur l'erreur standard ; sinon, la variable shell OPTARG n'est pas définie et un message de diagnostic est écrit sur l'erreur standart
|
||||
|
||||
```bash
|
||||
# optstring "hf"
|
||||
$ ./soco-cli-gui.sh -k
|
||||
./soco-cli-gui.sh : option non permise -- k
|
||||
Invalid option: -.
|
||||
|
||||
# optstring ":hf"
|
||||
$ ./soco-cli-gui.sh -k
|
||||
Invalid option: -k.
|
||||
```
|
||||
|
||||
32
docs/Divers/bash/image.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Afficher une image dans le terminal
|
||||
|
||||
|
||||
|
||||
### iTerm2
|
||||
|
||||
```bash
|
||||
printf "\n\033]1337;File=;inline=1:`cat soco-cli-logo-01-large.png | base64`\a\n"
|
||||
|
||||
printf "\n\033]1337;File=;width=200px;inline=1:`cat soco-cli-logo-01-large.png | base64`\a\n"
|
||||
```
|
||||
|
||||
https://iterm2.com/documentation-images.html
|
||||
|
||||
|
||||
|
||||
### imgcat
|
||||
|
||||
https://github.com/olivere/iterm2-imagetools
|
||||
|
||||
```bash
|
||||
imgcat soco-cli-logo-01-large.png
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### jouer un son
|
||||
|
||||
```bash
|
||||
echo -en "\007"
|
||||
```
|
||||
|
||||
81
docs/Divers/bash/json.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# json
|
||||
|
||||
|
||||
|
||||
```json
|
||||
{
|
||||
"request_id": "9a081c0c-9401-7eca-f55d-50e3b7c0301c",
|
||||
"lease_id": "",
|
||||
"renewable": false,
|
||||
"lease_duration": 2764800,
|
||||
"data": {
|
||||
"password": "test123",
|
||||
"username": "testuser1"
|
||||
},
|
||||
"wrap_info": null,
|
||||
"warnings": null,
|
||||
"auth": null
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
$ jq '.data.password, .data.username' data.json
|
||||
"test123"
|
||||
"testuser1"
|
||||
```
|
||||
|
||||
|
||||
|
||||
```json
|
||||
{
|
||||
"langs": ["JavaScript", "Ruby"]
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
$ jq -r '.langs[]' languages.json
|
||||
JavaScript
|
||||
Ruby
|
||||
```
|
||||
|
||||
|
||||
|
||||
```json
|
||||
{
|
||||
"italian" : {
|
||||
"name" : [
|
||||
"gatto",
|
||||
"cane",
|
||||
"pasta",
|
||||
"telefono",
|
||||
"libro"
|
||||
],
|
||||
"adjective" : [
|
||||
"pesante",
|
||||
"sottile",
|
||||
"giallo",
|
||||
"stretto"
|
||||
]
|
||||
},
|
||||
"english" : {
|
||||
"name" : [
|
||||
"fish",
|
||||
"book",
|
||||
"guitar",
|
||||
"piano"
|
||||
],
|
||||
"adjective" : [
|
||||
"dirty",
|
||||
"good",
|
||||
"ugly",
|
||||
"great"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
$ jq '.english.adjective[1]' file.js
|
||||
good
|
||||
```
|
||||
|
||||
36
docs/Divers/bash/passwords.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Passwords
|
||||
|
||||
|
||||
|
||||
### Stocker un mot-de-passe, un token dans la Keychain:
|
||||
|
||||
```bash
|
||||
$ security add-generic-password -s gh_access_tokens -a bruno -w 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
|
||||
```
|
||||
|
||||
### Récupérer le mot-de-pass depuius la keychain:
|
||||
|
||||
```bash
|
||||
$ security find-generic-password -w -s gh_access_tokens
|
||||
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
|
||||
|
||||
$ gh_access_tokens=$(security find-generic-password -w -s gh_access_tokens)
|
||||
```
|
||||
|
||||
https://scriptingosx.com/2021/04/get-password-from-keychain-in-shell-scripts/
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ security unlock-keychain -p API_KEYCHAIN_PASS KEYCHAINPATH
|
||||
|
||||
# API_KEYCHAIN_PASS : mot de passe de session
|
||||
# KEYCHAINPATH : login.keychain, /Library/Keychains/System.keychain, ~/Library/Keychains/login.keychain
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ security lock-keychain KEYCHAINPATH
|
||||
```
|
||||
|
||||
93
docs/Divers/bash/printf.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# printf
|
||||
|
||||
|
||||
|
||||
| Character | Usage |
|
||||
| --------- | -------------------------------------------------------- |
|
||||
| %s | String |
|
||||
| %c | Single character |
|
||||
| %d | Integers |
|
||||
| %o | Octal integers |
|
||||
| %u | unsigned integer |
|
||||
| %x | Hexadecimal integers (minuscule) |
|
||||
| %X | Hexadecimal integers (majuscule) |
|
||||
| %f | Floating point |
|
||||
| %e | floating point number in scientific notation (minuscule) |
|
||||
| %E | floating point number in scientific notation (majuscule) |
|
||||
| %b | String with backslash escape character |
|
||||
| %% | Percent sign |
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
printf "\t %3s %-40s \n" "${index}." "${track}"
|
||||
|
||||
# tab
|
||||
# chaine de 3 caractères alignés à droite
|
||||
# chaine de 40 caractères alignés à gauche
|
||||
```
|
||||
|
||||
```
|
||||
9. Party!
|
||||
10. Shooters
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Modificateur de précision:
|
||||
|
||||
. (point) suivi d'un nombre spécifie le nombre de chiffres à afficher.
|
||||
|
||||
```bash
|
||||
$ printf "Number: %.5d\n" 23
|
||||
|
||||
Number: 00023
|
||||
```
|
||||
|
||||
avec une chaine:
|
||||
|
||||
```bash
|
||||
printf "Nom: %.7s\n" Terminator
|
||||
Nom: Termina
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Afficher une ligne de tiret:
|
||||
|
||||
```bash
|
||||
printf "%80s\n" " " | tr ' ' '-'
|
||||
|
||||
------------------------------------------------------------------------------------------------
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Afficher une chaine avec des accents:
|
||||
|
||||
```bash
|
||||
title="France Inter 95.9 (Émissions-débats France)"
|
||||
|
||||
# https://unix.stackexchange.com/questions/609125/padding-unicode-strings-with-bashs-printf
|
||||
bytes=$(printf '%s' "$title" | wc -c)
|
||||
chars=$(printf '%s' "$title" | wc -m)
|
||||
n=$((50+bytes-chars))
|
||||
|
||||
printf '%-${n}s' "${title}"
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Afficher une chaine en couleur
|
||||
|
||||
```bash
|
||||
red="\033[1;31m"
|
||||
reset="\033[0m"
|
||||
|
||||
printf " %-11s %-35b \n" "Width:" "${red}${width}${reset}"
|
||||
|
||||
# %b ARGUMENT as a string with '\' escapes interpreted, except that octal
|
||||
# escapes are of the form \0 or \0NNN
|
||||
```
|
||||
|
||||
@@ -2,28 +2,6 @@
|
||||
|
||||
|
||||
|
||||
#### Variables:
|
||||
|
||||
##### Incrémenter une variable:
|
||||
|
||||
```bash
|
||||
i=$((i+1)) user 0m0.992s
|
||||
i=$((i++)) user 0m0.964s
|
||||
((i=i+1)) user 0m0.760s
|
||||
((i+=1)) user 0m0.700s
|
||||
((i++)) user 0m0.644s
|
||||
((++i)) user 0m0.556s
|
||||
let "i=i+1" user 0m1.116s
|
||||
let "i+=1" user 0m1.100s
|
||||
let "i++" user 0m1.008s
|
||||
let i=i+1 user 0m0.952s
|
||||
let i+=1 user 0m1.040s
|
||||
let i++ user 0m0.820s
|
||||
declare -i i; i=i+1 user 0m0.528s
|
||||
declare -i i; i+=1 user 0m0.492s
|
||||
i=0; i=$(expr $i + 1) user 0m5.464s
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Beep:
|
||||
@@ -135,3 +113,26 @@ status=$?
|
||||
if [ $status -ne 0 ]; then
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Nombres de lignes:
|
||||
|
||||
```bash
|
||||
# grep
|
||||
nb=$(echo -n "$albums" | grep -c '^')
|
||||
|
||||
#awk
|
||||
nb=$(awk 'END { print NR }' <<< "$albums")
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Convertir un script bash en application macOS:
|
||||
|
||||
[mac-appify](https://pypi.org/project/mac-appify/)
|
||||
|
||||
```bash
|
||||
$ appify script.sh name.app
|
||||
$ appify script.sh name.app Icon.png
|
||||
```
|
||||
|
||||
|
||||
47
docs/Divers/bash/rematch.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# Regular Expression Matching (REMATCH)
|
||||
|
||||
|
||||
|
||||
http://molk.ch/tips/gnu/bash/rematch.html
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
FILE="/Users/bruno/Downloads/Better.Call.Saul.S06E07.FRENCH.LD.AMZN.WEB-DL.x264-FRATERNiTY.mkv"
|
||||
|
||||
# Extension video file
|
||||
DEST_EXT=mp4
|
||||
|
||||
filename=$(basename "$FILE")
|
||||
filename=${filename%.*}
|
||||
|
||||
# Series: SxxEyy
|
||||
REGEX="([sS]([0-9]{2,}|[X]{2,})[eE]([0-9]{2,}|[Y]{2,}))"
|
||||
|
||||
|
||||
if [[ $filename =~ $REGEX ]]; then
|
||||
MATCH0="${BASH_REMATCH[0]}"
|
||||
echo "$MATCH0" # S06E07
|
||||
|
||||
MATCH1="${BASH_REMATCH[1]}"
|
||||
echo "$MATCH1" # S06E07
|
||||
|
||||
MATCH2="${BASH_REMATCH[2]}"
|
||||
echo "$MATCH2" # 06
|
||||
|
||||
MATCH3="${BASH_REMATCH[3]}"
|
||||
echo "$MATCH3" # 07
|
||||
|
||||
e=$(echo ${filename%$MATCH0*} | sed 's/\./\ /g' | xargs)
|
||||
echo "$e" # Better Call Saul
|
||||
|
||||
new_name="$e - $MATCH0.$DEST_EXT"
|
||||
echo "$new_name" # Better Call Saul - S06E07.
|
||||
|
||||
else
|
||||
echo "no match"
|
||||
fi
|
||||
```
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
|
||||
#### Concaténer une chaine:
|
||||
### Concaténer une chaine:
|
||||
|
||||
```bash
|
||||
upd+="$name "
|
||||
@@ -10,7 +10,7 @@ upd+="$name "
|
||||
|
||||
|
||||
|
||||
#### Trim une chaine:
|
||||
### Trim une chaine:
|
||||
|
||||
1. sed
|
||||
|
||||
@@ -75,9 +75,19 @@ $ echo " Une chaine entourée d'espaces " | xargs -0
|
||||
Une chaine entourée d'espaces
|
||||
```
|
||||
|
||||
4.
|
||||
|
||||
```bash
|
||||
trim () {
|
||||
read -rd '' $1 <<<"${!1}"
|
||||
}
|
||||
|
||||
trim foo
|
||||
```
|
||||
|
||||
|
||||
#### Longueur d'une chaine:
|
||||
|
||||
### Longueur d'une chaine:
|
||||
|
||||
```bash
|
||||
$ echo -n "Longueur de la chaine:" | wc -c
|
||||
@@ -93,7 +103,9 @@ $ echo ${#var}
|
||||
|
||||
|
||||
|
||||
#### Sous-chaine:
|
||||
### Sous-chaine:
|
||||
|
||||
https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Parameter-Expansion
|
||||
|
||||
```bash
|
||||
$ string=abcABC123ABCabc
|
||||
@@ -113,12 +125,20 @@ $ echo ${string:7}
|
||||
$ echo ${string:7:3}
|
||||
23A
|
||||
|
||||
# Obtenir les 2 premieres caractères:
|
||||
# Obtenir les 2 premiers caractères:
|
||||
$ echo ${string:0:2}
|
||||
ab
|
||||
echo "$string" | awk '{print substr($0,0,2)}'
|
||||
ab
|
||||
|
||||
# Supprimer le dernier caractère:
|
||||
$ echo ${string:0:-1}
|
||||
abcABC123ABCab
|
||||
|
||||
# Remplacer certains caractères par un autre:
|
||||
$ echo ${string//[ABC]/:}
|
||||
abc:::123:::abc
|
||||
|
||||
# Obtenir les 4 derniers caractères:
|
||||
$ echo ${stringZ: -4} # Notez l'espace
|
||||
Cabc
|
||||
@@ -137,7 +157,7 @@ filename="${filename%.*}"
|
||||
|
||||
|
||||
|
||||
#### Remplacement de sous-chaine:
|
||||
### Remplacement de sous-chaine:
|
||||
|
||||
```bash
|
||||
$ string=abcABC123ABCabc
|
||||
@@ -166,7 +186,7 @@ ABC123ABC
|
||||
|
||||
http://tldp.org/LDP/abs/html/string-manipulation.html
|
||||
|
||||
#### Majuscule / Capitalize:
|
||||
### Majuscule / Capitalize:
|
||||
|
||||
```bash
|
||||
string=bonjour
|
||||
@@ -181,13 +201,51 @@ echo ${string^^}
|
||||
BONJOUR
|
||||
|
||||
echo $string | tr '[:lower:]' '[:upper:]'
|
||||
echo $string | awk '{print toupper($0)}'
|
||||
echo $string | tr '[a-z]' '[A-Z]'
|
||||
BONJOUR
|
||||
|
||||
|
||||
string=HelLo
|
||||
|
||||
# 1ere lettre en minuscule (Bash 4)
|
||||
echo ${string,}
|
||||
helLo
|
||||
|
||||
# Met en minuscule toute la chaine
|
||||
echo ${string,,}
|
||||
hello
|
||||
|
||||
echo $string | awk '{print tolower($0)}'
|
||||
echo $string | tr '[:upper:]' '[:lower:]'
|
||||
|
||||
|
||||
```
|
||||
|
||||
```bash
|
||||
phrase="bonjour tout le monde"
|
||||
|
||||
# Capitalise tous les mots (1)
|
||||
B=( $phrase )
|
||||
caps="${B[@]^}"
|
||||
echo "$caps"
|
||||
Bonjour Tout Le Monde
|
||||
|
||||
# Capitalise tous les mots (2)
|
||||
for i in $phrase; do B=`echo "${i:0:1}" | tr a-z A-Z`${i:1}; caps+="$B "; done
|
||||
echo "$caps"
|
||||
Bonjour Tout Le Monde
|
||||
|
||||
# Capitalise tous les mots (3)
|
||||
caps=$(echo "${phrase}" | awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1')
|
||||
echo "$caps"
|
||||
Bonjour Tout Le Monde
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Parcourrir une variable multi-ligne:
|
||||
### Parcourrir une variable multi-ligne:
|
||||
|
||||
```bash
|
||||
dependencies=$(echo "CairoSVG,setuptools" | xargs pipdeptree -r -p )
|
||||
@@ -210,12 +268,14 @@ done <<< "$dependencies"
|
||||
|
||||
[[ STRING =~ REGEX ]]
|
||||
|
||||
[Regular Expression Matching](rematch.md)
|
||||
|
||||
Chaine commençant par:
|
||||
|
||||
```bash
|
||||
# String est une url ?
|
||||
|
||||
if [[ $string =~ ^http ]]
|
||||
if [[ $string =~ ^http ]]; then
|
||||
```
|
||||
|
||||
Chaine se terminant par:
|
||||
@@ -223,7 +283,7 @@ Chaine se terminant par:
|
||||
```bash
|
||||
# String est un fichier .mp3 ?
|
||||
|
||||
if [[ $string =~ .mp3$ ]]
|
||||
if [[ $string =~ .mp3$ ]]; then
|
||||
```
|
||||
|
||||
Adresse IP:
|
||||
@@ -238,3 +298,409 @@ Email:
|
||||
if [[ "$email" =~ "^[A-Za-z0-9._%+-]+<b>@</b>[A-Za-z0-9.-]+<b>\.</b>[A-Za-z]{2,4}$" ]]
|
||||
```
|
||||
|
||||
|
||||
|
||||
Rechercher une sous-chaine
|
||||
|
||||
```bash
|
||||
name=testjohntext
|
||||
|
||||
if [[ "$name" == *john* ]]; then
|
||||
echo "The string \"john\" was found in the variable \$name"
|
||||
fi
|
||||
|
||||
[[ "$name" == *john* ]] && echo "The string \"john\" was found in the variable \$name"
|
||||
The string "john" was found in the variable $name
|
||||
|
||||
```
|
||||
|
||||
Regex
|
||||
|
||||
```bash
|
||||
mytest="The quick brown fox"
|
||||
|
||||
[[ "$mytest" =~ The..uick.b..w* ]] && echo "We found a match"
|
||||
We found a match
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### IFS (internet field separator)
|
||||
|
||||
```bash
|
||||
$ old_IFS=$IFS
|
||||
|
||||
$ IFS=-
|
||||
|
||||
$ read day month year
|
||||
25-12-2013
|
||||
|
||||
$ echo $day
|
||||
25
|
||||
|
||||
$ echo $month
|
||||
12
|
||||
|
||||
$ echo $year
|
||||
2013
|
||||
$ IFS=old_IFS
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ reg=("Bourgogne" "Burgundy" "Bourgogne Franche-Comté" "Côte d'or" "cotedor")
|
||||
|
||||
$ echo "$reg"
|
||||
Bourgogne Burgundy Bourgogne Franche-Comté Côte d'or cotedor
|
||||
|
||||
|
||||
$ t=${reg[@]}
|
||||
|
||||
$ echo "$t"
|
||||
Bourgogne Burgundy Bourgogne Franche-Comté Côte d'or cotedor
|
||||
|
||||
|
||||
# ${A[@]} is essentially the same as ${A[*]}, differing only when they are in double quotes. When double quoted, * uses the first character of IFS as the separator.
|
||||
|
||||
$ t=${reg[*]}
|
||||
|
||||
$ echo "$t"
|
||||
Bourgogne Burgundy Bourgogne Franche-Comté Côte d'or cotedor
|
||||
|
||||
|
||||
$ t=${reg[@]}
|
||||
|
||||
$ S=${t// /}
|
||||
|
||||
$ echo "$S"
|
||||
BourgogneBurgundyBourgogneFranche-ComtéCôted'orcotedor
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
| **Parameter Expansion** | **Description** |
|
||||
| --------------------------- | ------------------------------------------------------------ |
|
||||
| ${variable:-value} | Si la variable est <u>unset</u> ou <u>undefined</u>, développez la **valeur**. |
|
||||
| ${variable:=value} | Si la variable est <u>unset</u> ou <u>undefined</u>, définissez la **valeur** sur la variable. |
|
||||
| ${variable:+value} | Si la variable est <u>set</u> ou <u>defined</u>, développez la **valeur**. |
|
||||
| ${variable:?value} | Si la variable est <u>unset</u> ou <u>undefined</u>, le développement de mot (ou un message à cet effet si mot n'est pas présent) est <u>écrit dans l'erreur standard</u> et le shell, s'il n'est pas interactif, se termine. Sinon, la valeur du paramètre est remplacée. |
|
||||
| ${#variable} | <u>Longueur</u> de la variable.<br />Pour un tableau, le nombre d'éléments |
|
||||
| ${variable/#pattern/string} | Si le modèle existe au début de la variable, remplacez l'occurrence par une chaîne. |
|
||||
| ${variable/%pattern/string} | Si le modèle existe à la fin de la variable, remplacez l'occurrence par une chaîne. |
|
||||
|
||||
|
||||
|
||||
| | **Rechercher / remplacer** |
|
||||
| --------------------------- | ------------------------------------------------------------ |
|
||||
| ${variable/pattern/string} | Remplacez la partie de la variable par une chaîne où le modèle correspond pour la première fois. |
|
||||
| ${variable//pattern/string} | Remplacez toutes les occurrences de la variable par une chaîne où tous les modèles correspondent. |
|
||||
| | |
|
||||
| | |
|
||||
|
||||
|
||||
|
||||
| | **Sous-chaines** |
|
||||
| --------------------------- | ------------------------------------------------------------ |
|
||||
| ${variable:start:length} | La sous-chaîne récupérera de la position de <u>départ</u> à la position de <u>longueur</u> de la variable. |
|
||||
| ${variable:(-start):length} | idem en partant de la fin |
|
||||
| ${variable:start} | La sous-chaîne récupérera de la position de <u>départ</u> à la partie restante de la variable. |
|
||||
| ${variable:(-start)} | idem en partant de la fin |
|
||||
|
||||
|
||||
|
||||
| | **Suppression de sous-chaines** |
|
||||
| -------------------- | ------------------------------------------------------------ |
|
||||
| ${variable#pattern} | Supprimez la correspondance la plus courte depuis le début de la variable où le modèle correspond.<br /><br />Remove the shortest match from the beginning of the variable where the pattern matches. |
|
||||
| ${variable##pattern} | Supprimez la correspondance la plus longue depuis le début de la variable où le modèle correspond. |
|
||||
| ${variable%pattern} | Supprimez la correspondance la plus courte à partir de la fin de la variable où le modèle correspond. |
|
||||
| ${variable%%pattern} | Supprimez la correspondance la plus longue à partir de la fin de la variable où le modèle correspond. |
|
||||
|
||||
|
||||
|
||||
| | **Changement de case** |
|
||||
| ------------- | ------------------------------- |
|
||||
| ${variable^} | Met la 1ere lettre en majuscule |
|
||||
| ${variable^^} | Met tout le mot en majuscule |
|
||||
| ${variable,} | Met la 1ere lettre en minuscule |
|
||||
| ${variable,,} | Met tout le mot en minuscule |
|
||||
| ${variable~} | Inverse la 1ere lettre |
|
||||
| ${variable~~} | Inverse tout le mot |
|
||||
|
||||
|
||||
|
||||
#### **${variable:-value}**:
|
||||
|
||||
```bash
|
||||
# si la variable est unset ou undefined, développez la valeur:
|
||||
|
||||
# 1. myvar n'est pas définie
|
||||
$ echo "${myvar:-bash}"
|
||||
bash
|
||||
|
||||
$ echo $myvar
|
||||
|
||||
|
||||
# 2. myvar est définie
|
||||
$ myvar=3
|
||||
$ echo "${myvar:-bash}"
|
||||
3
|
||||
|
||||
$ echo $myvar
|
||||
3
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable:=value}**
|
||||
|
||||
```bash
|
||||
# Si la variable est unset ou undefined, définissez la valeur sur la variable:
|
||||
|
||||
# 1. myvar n'est pas définie
|
||||
$ echo "${myvar:=bash}"
|
||||
bash
|
||||
|
||||
$ echo $myvar
|
||||
bash
|
||||
|
||||
# 2. myvar est définie
|
||||
$ myvar=zsh
|
||||
$ echo "${myvar:=bash}"
|
||||
zsh
|
||||
|
||||
$ echo $myvar
|
||||
zsh
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable:+value}**
|
||||
|
||||
```bash
|
||||
# Si la variable est set ou defined, développez la valeur:
|
||||
|
||||
# 1. myvar n'est pas définie
|
||||
$ echo "${myvar:+python}"
|
||||
|
||||
|
||||
# 2. myvar est définie
|
||||
$ myvar=zsh
|
||||
$ echo "${myvar:+python}"
|
||||
python
|
||||
|
||||
$ echo $myvar
|
||||
zsh
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable:?value}**
|
||||
|
||||
```bash
|
||||
|
||||
# 1. myvar n'est pas définie
|
||||
$ echo "${myvar:?bash}"
|
||||
bash: myvar: bash
|
||||
|
||||
# 2. myvar est définie
|
||||
$ myvar=zsh
|
||||
$ echo "${myvar:?bash}"
|
||||
zsh
|
||||
|
||||
$ echo $myvarzsh
|
||||
zsh
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable:start:length}**
|
||||
|
||||
```bash
|
||||
# La sous-chaîne récupérera de la position de départ à la position de longueur de la variable.
|
||||
|
||||
$ myvar="La sous-chaîne récupérera de la position de départ à la position de longueur de la variable."
|
||||
|
||||
$ echo "${myvar:15:35}"
|
||||
récupérera de la position de départ
|
||||
|
||||
$ echo "${myvar:(-15):35}" # Séparer l'offset des : avec les parenthèses ()
|
||||
de la variable.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable:start}**
|
||||
|
||||
```bash
|
||||
# La sous-chaîne récupérera de la position de départ à la partie restante de la variable.
|
||||
|
||||
$ myvar="La sous-chaîne récupérera de la position de départ à la partie restante de la variable."
|
||||
|
||||
$ echo "${myvar:15}"
|
||||
récupérera de la position de départ à la partie restante de la variable.
|
||||
|
||||
$ echo "${myvar:(-15)}" # Séparer l'offset des : avec les parenthèses ()
|
||||
de la variable.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${\#variable}** **${\#array}**
|
||||
|
||||
```bash
|
||||
# Longueur de la variable.
|
||||
|
||||
$ myvar="Longueur de la variable."
|
||||
$ echo "${#myvar}"
|
||||
24
|
||||
|
||||
$ array=("name" "word")
|
||||
$ echo "${#array}"
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable/pattern/string}**
|
||||
|
||||
```bash
|
||||
# Remplacez la partie de la variable par une chaîne où le modèle correspond pour la première fois.
|
||||
|
||||
$ myvar="Remplacez la partie de la variable par une chaîne où le modèle correspond pour la première fois."
|
||||
$ echo "${myvar/la/the}"
|
||||
Rempthecez la partie de la variable par une chaîne où le modèle correspond pour la première fois.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable//pattern/string}**
|
||||
|
||||
```bash
|
||||
# Remplacez toutes les occurrences de la variable par une chaîne où tous les modèles correspondent.
|
||||
|
||||
$ myvar="Remplacez toutes les occurrences de la variable par une chaîne où tous les modèles correspondent."
|
||||
$ echo "${myvar//les/the}"
|
||||
Remplacez toutes the occurrences de la variable par une chaîne où tous the modèthe correspondent.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable/#pattern/string}**
|
||||
|
||||
```bash
|
||||
# Si le modèle existe au début de la variable, remplacez l'occurrence par une chaîne.
|
||||
|
||||
$ myvar="Si le modèle existe au début de la variable, remplacez l'occurrence par une chaîne"
|
||||
$ echo "${myvar/#les/If}"
|
||||
Si le modèle existe au début de la variable, remplacez l'occurrence par une chaîne
|
||||
|
||||
$ echo "${myvar/#Si/If}"
|
||||
If le modèle existe au début de la variable, remplacez l'occurrence par une chaîne
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable/%pattern/string}**
|
||||
|
||||
```bash
|
||||
# Si le modèle existe à la fin de la variable, remplacez l'occurrence par une chaîne.
|
||||
|
||||
$ myvar="Si le modèle existe à la fin de la variable, remplacez l'occurrence par une chaîne."
|
||||
|
||||
$ echo "${myvar/%chaine./laisse.}" # i
|
||||
Si le modèle existe à la fin de la variable, remplacez l'occurrence par une chaîne.
|
||||
|
||||
$ echo "${myvar/%chaîne/laisse}" # î
|
||||
Si le modèle existe à la fin de la variable, remplacez l'occurrence par une laisse
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable#pattern}**
|
||||
|
||||
```bash
|
||||
# Supprimez la correspondance la plus courte depuis le début de la variable où le modèle correspond.
|
||||
# Remove the shortest match from the beginning of the variable where the pattern matches.
|
||||
|
||||
$ myvar="Supprimez la correspondance la plus courte depuis le début de la variable où le modèle correspond."
|
||||
|
||||
$ echo "${myvar#*la}" # du début au 1er la
|
||||
correspondance la plus courte depuis le début de la variable où le modèle correspond.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable##pattern}**
|
||||
|
||||
```bash
|
||||
# Supprimez la correspondance la plus longue depuis le début de la variable où le modèle correspond.
|
||||
|
||||
$ myvar="Supprimez la correspondance la plus longue depuis le début de la variable où le modèle correspond."
|
||||
|
||||
$ echo "${myvar##*la}" # du début au dernier la
|
||||
variable où le modèle correspond.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable%pattern}**
|
||||
|
||||
```bash
|
||||
# Supprimez la correspondance la plus courte à partir de la fin de la variable où le modèle correspond.
|
||||
|
||||
$ myvar="Supprimez la correspondance la plus courte à partir de la fin de la variable où le modèle correspond."
|
||||
|
||||
$ echo "${myvar%la*}"
|
||||
Supprimez la correspondance la plus courte à partir de la fin de
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **${variable%%pattern}**
|
||||
|
||||
```bash
|
||||
# Supprimez la correspondance la plus longue à partir de la fin de la variable où le modèle correspond.
|
||||
|
||||
$ myvar="Supprimez la correspondance la plus longue à partir de la fin de la variable où le modèle correspond."
|
||||
|
||||
$ echo "${myvar%%la*}"
|
||||
Supprimez
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### **Exemples avec les chemins / fichiers:**
|
||||
|
||||
```bash
|
||||
$ PATHNAME=/Users/bruno/Pictures/Export/2022/Juillet/2022-07-01_Chevrette_3462.jpg
|
||||
|
||||
# Obtenir le répertoire:
|
||||
$ echo ${PATHNAME%/*}
|
||||
/Users/bruno/Pictures/Export/2022/Juillet
|
||||
|
||||
# Obtenir le nom de fichier:
|
||||
$ echo ${PATHNAME##*/}
|
||||
2022-07-01_Chevrette_3462.jpg
|
||||
|
||||
|
||||
$ FILENAME=2022-07-01_Chevrette_3462.jpg
|
||||
|
||||
# Obtenir le nom de fichier sans extension:
|
||||
$ echo ${FILENAME%.*}
|
||||
2022-07-01_Chevrette_3462
|
||||
|
||||
# Obtenir l'extension:
|
||||
$ echo ${FILENAME##*.}
|
||||
jpg
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
https://wiki.bash-hackers.org/syntax/pe#substring_removal
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,12 +2,19 @@
|
||||
|
||||
|
||||
|
||||
#### Création d'un tableau (et initialisation):
|
||||
### Création d'un tableau (et initialisation):
|
||||
|
||||
##### Tableau indicé:
|
||||
#### Tableau indicé:
|
||||
|
||||
```bash
|
||||
# Création:
|
||||
$ tableau_indi=()
|
||||
$ declare -a tableau_indi
|
||||
```
|
||||
|
||||
```bash
|
||||
$ tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||
```
|
||||
|
||||
Les indices sont assignés automatiquement, à partir de 0.
|
||||
@@ -20,88 +27,135 @@ chene à l'indice 0, érable le 2, saule le 5, hetre le 7. Les indices 3 et 4 so
|
||||
|
||||
|
||||
|
||||
##### Tableau associatif:
|
||||
#### Tableau associatif:
|
||||
|
||||
```bash
|
||||
$ tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
```
|
||||
|
||||
|
||||
|
||||
##### Avec declare:
|
||||
|
||||
```bash
|
||||
$ declare -a tableau_indi
|
||||
# Création:
|
||||
$ declare -A tableau_asso
|
||||
```
|
||||
|
||||
Initialisation:
|
||||
|
||||
```bash
|
||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||
$ tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
```
|
||||
|
||||
Tableau en lecture seule:
|
||||
|
||||
```bash
|
||||
$ readonly -a tableau_indi_ro=( "un" "deux" "trois" "quatre" )
|
||||
$ readonly -A tableau_asso_ro=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
# Returns all indizes and their items (doesn't work with associative arrays)
|
||||
$ echo ${tableau_asso[@]}
|
||||
gland faine sirop
|
||||
|
||||
# Returns all items
|
||||
$ echo ${tableau_asso[*]}
|
||||
gland faine sirop
|
||||
|
||||
# Returns all indizes
|
||||
$ echo ${!tableau_asso[*]}
|
||||
erable chene hetre
|
||||
|
||||
# Number elements
|
||||
$ echo ${#tableau_asso[*]}
|
||||
3
|
||||
|
||||
# Length of $nth item
|
||||
${#tableau_asso[$n]}
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Affichage du tableau:
|
||||
#### Tableau en lecture seule:
|
||||
|
||||
```bash
|
||||
$ readonly -a tableau_indi_ro=( "un" "deux" "trois" "quatre" )
|
||||
$ declare -r -a tableau_indi_ro=( "un" "deux" "trois" "quatre" )
|
||||
```
|
||||
|
||||
```bash
|
||||
$ readonly -A tableau_asso_ro=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
$ declare -r -A tableau_asso_ro=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Affichage du tableau:
|
||||
|
||||
L’affichage de l’ensemble d’un tableau se fait avec la syntaxe `${montableau[*]}` ou`${montableau[@]}`
|
||||
|
||||
```bash
|
||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||
|
||||
$ echo ${tableau_indi[@]}
|
||||
un deux trois quatre
|
||||
$ echo ${tableau_indi[*]}
|
||||
un deux trois quatre
|
||||
|
||||
$ echo ${tableau_indi[2]}
|
||||
deux
|
||||
```
|
||||
|
||||
|
||||
```bash
|
||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
|
||||
$ echo ${tableau_asso[@]}
|
||||
gland faine sirop
|
||||
$ echo ${tableau_asso[*]}
|
||||
gland faine sirop
|
||||
|
||||
$ echo ${tableau_asso[erable]}
|
||||
sirop
|
||||
```
|
||||
|
||||
https://ostechnix.com/bash-for-loop-shell-scripting/#loop-over-array-elements
|
||||
|
||||
|
||||
#### Lecture d'un élément:
|
||||
|
||||
### Lecture d'un élément:
|
||||
|
||||
```bash
|
||||
$ tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||
|
||||
$ echo ${tableau_indi[2]}
|
||||
deux
|
||||
$ echo $tableau_indi
|
||||
un deux trois quatre # !!! normalement 'un'
|
||||
|
||||
un # zsh: un deux trois quatre
|
||||
```
|
||||
|
||||
```bash
|
||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
|
||||
$ echo ${tableau_asso["erable"]}
|
||||
# !!!! rien sur zsh !!!!
|
||||
sirop # !!!! rien sur zsh !!!!
|
||||
$ echo ${tableau_asso[erable]}
|
||||
sirop
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Ajouter un élément:
|
||||
### Ajouter un élément:
|
||||
|
||||
```bash
|
||||
ARRAY=()
|
||||
ARRAY+=('foo')
|
||||
ARRAY+=('bar')
|
||||
$ tableau_indi=()
|
||||
|
||||
$ tableau_indi+=('cinq')
|
||||
$ tableau_indi+=('six')
|
||||
```
|
||||
|
||||
```bash
|
||||
$ tableau_asso+=([pommier]="pomme")
|
||||
|
||||
$ tableau_asso[pommier]="pomme"
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Modification d'un élément:
|
||||
### Modification d'un élément:
|
||||
|
||||
```bash
|
||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||
|
||||
$ tableau_indi[0]="zero"
|
||||
$ echo ${tableau_indi[@]}
|
||||
zero deux trois quatre
|
||||
```
|
||||
|
||||
Si le tableau n’existe pas, il sera créé comme un tableau indicé :
|
||||
|
||||
@@ -112,85 +166,225 @@ $ echo ${tableau_indi[1]}
|
||||
chene
|
||||
```
|
||||
|
||||
Il n’est pas possible de créer un tableau associatif en lui assignant un élément, il faut le déclarer explicitement avant l’assignation
|
||||
Il n’est pas possible de créer un tableau associatif en lui assignant un élément, il faut le déclarer explicitement (declare -A tableau_asso) avant l’assignation.
|
||||
|
||||
|
||||
|
||||
#### Afficher la liste des clés:
|
||||
### Afficher la liste des clés:
|
||||
|
||||
```bash
|
||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||
|
||||
$ echo ${!tableau_indi[@]}
|
||||
zsh: event not found: tableau_indi[@] # !!!
|
||||
0 1 2 3 #zsh: event not found: tableau_indi[@] # !!!
|
||||
```
|
||||
|
||||
```bash
|
||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
|
||||
$ echo ${!tableau_asso[@]}
|
||||
zsh: event not found: tableau_asso[@] # !!!
|
||||
erable chene hetre # zsh: event not found: tableau_asso[@] # !!!
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Obtenir la taille d'un tableau:
|
||||
### Afficher la liste des clés/valeurs:
|
||||
|
||||
```bash
|
||||
$ for val in ${!tableau_indi[@]}
|
||||
do
|
||||
echo "index = ${val} , value = ${tableau_indi[$val]}"
|
||||
done
|
||||
|
||||
index = 0 , value = un
|
||||
index = 1 , value = deux
|
||||
index = 2 , value = trois
|
||||
index = 3 , value = quatre
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ for elem in "${!tableau_asso[@]}";
|
||||
do
|
||||
echo "key : ${elem}" - - "value: ${tableau_asso[${elem}]}";
|
||||
done
|
||||
|
||||
key : erable - - value: sirop
|
||||
key : chene - - value: gland
|
||||
key : hetre - - value: faine
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Obtenir la taille d'un tableau:
|
||||
|
||||
```bash
|
||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||
|
||||
$ echo ${#tableau_indi[@]}
|
||||
4
|
||||
```
|
||||
|
||||
```bash
|
||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
|
||||
$ echo ${#tableau_asso[@]}
|
||||
3
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Supprimer un élément:
|
||||
### Supprimer un élément:
|
||||
|
||||
```bash
|
||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||
|
||||
$ echo ${tableau_indi[@]}
|
||||
un deux trois quatre
|
||||
|
||||
$ echo ${#tableau_indi[@]}
|
||||
4 # 4 éléments
|
||||
|
||||
$ unset tableau_indi[1]
|
||||
zsh: no matches found: tableau_indi[1]
|
||||
# zsh: no matches found: tableau_indi[1]
|
||||
|
||||
$ echo ${!tableau_indi[@]}
|
||||
zsh: event not found: tableau_indi[@]
|
||||
0 2 3 # zsh: event not found: tableau_indi[@]
|
||||
|
||||
$ echo ${tableau_indi[@]}
|
||||
un deux trois quatre
|
||||
un trois quatre
|
||||
|
||||
$ echo ${#tableau_indi[@]}
|
||||
3 # 3 éléments
|
||||
```
|
||||
|
||||
```bash
|
||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
|
||||
$ echo ${tableau_asso[@]}
|
||||
gland faine sirop
|
||||
|
||||
$ echo ${#tableau_asso[@]}
|
||||
3 # 3 éléments
|
||||
|
||||
$ unset tableau_asso['erable']
|
||||
zsh: no matches found: tableau_asso[erable]
|
||||
# zsh: no matches found: tableau_asso[erable]
|
||||
|
||||
$ echo ${!tableau_asso[@]}
|
||||
zsh: event not found: tableau_asso[@]
|
||||
chene hetre # zsh: event not found: tableau_asso[@]
|
||||
|
||||
$ echo ${tableau_asso[@]}
|
||||
gland faine sirop
|
||||
gland faine
|
||||
|
||||
$ echo ${#tableau_asso[@]}
|
||||
2 # 2 éléments
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Supprimer un tableau entier:
|
||||
### Vider un tableau:
|
||||
|
||||
```bash
|
||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||
|
||||
$ unset tableau_indi
|
||||
# unset tableau_indi[@]
|
||||
# unset tableau_indi[*]
|
||||
$ echo ${tableau_indi[@]}
|
||||
un deux trois quatre
|
||||
|
||||
$ declare -a tableau_indi=()
|
||||
|
||||
$ echo ${tableau_indi[@]}
|
||||
|
||||
```
|
||||
|
||||
```bash
|
||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
|
||||
$ echo ${tableau_asso[@]}
|
||||
gland faine sirop
|
||||
|
||||
$ declare -A tableau_asso=()
|
||||
|
||||
$ echo ${tableau_asso[@]}
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Supprimer un tableau entier:
|
||||
|
||||
```bash
|
||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||
|
||||
$ echo ${tableau_indi[@]}
|
||||
un deux trois quatre
|
||||
|
||||
$ unset tableau_indi
|
||||
|
||||
$ echo ${tableau_indi[@]}
|
||||
|
||||
```
|
||||
|
||||
```bash
|
||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
|
||||
$ echo ${tableau_asso[@]}
|
||||
gland faine sirop
|
||||
|
||||
$ unset tableau_asso
|
||||
|
||||
$ echo ${tableau_asso[@]}
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Vérifier si un élément est présent dans le tableau:
|
||||
|
||||
```bash
|
||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||
|
||||
$ if [[ -n "${tableau_asso[erable]}" ]]; then echo "Element is present"; else echo "Element not present"; fi
|
||||
Element is present
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Mettre la sortie d'une commande dans un tableau:
|
||||
|
||||
```bash
|
||||
$ path_list=( $(echo $PATH | tr ":" "\n") )
|
||||
|
||||
$ echo ${path_list[@]}
|
||||
/Users/bruno/.zinit/plugins/sei40kr---fast-alias-tips-bin /Users/bruno/.zinit/polaris/bin /Users/bruno/perl5/bin /Users/bruno/.nvm/versions/node/v18.13.0/bin /Users/bruno/Library/Python/3.9/bin /opt/homebrew/opt/grep/libexec/gnubin /opt/homebrew/opt/coreutils/libexec/gnubin /opt/homebrew/opt/ruby/bin /opt/homebrew/opt/unzip/bin /opt/homebrew/opt/ssh-copy-id/bin /opt/homebrew/opt/python/libexec/bin /opt/homebrew/bin /opt/homebrew/sbin /usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin /usr/local/MacGPG2/bin /Library/Apple/usr/bin /Users/bruno/.cargo/bin /Users/bruno/.local/bin /opt/homebrew/opt/fzf/bin /Users/bruno/.yarn/bin /Users/bruno/.local/bin /Users/bruno/go/bin /Users/bruno/.zinit/plugins/kazhala---dotbare
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Slicing
|
||||
|
||||
```bash
|
||||
${array[@]:index:length}
|
||||
```
|
||||
|
||||
```bash
|
||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||
|
||||
$ echo ${tableau_indi[@]}
|
||||
un deux trois quatre
|
||||
|
||||
# Affiche de la position 2 à la fin
|
||||
$ echo ${tableau_indi[@]:2}
|
||||
trois quatre
|
||||
|
||||
# Affiche 2 éléments à partir de la position 1
|
||||
$ echo ${tableau_indi[@]:1:2}
|
||||
deux trois
|
||||
|
||||
# Affiche 2 éléments à partir du début
|
||||
$ echo ${tableau_indi[@]::2}
|
||||
un deux # zsh: closing brace expected
|
||||
|
||||
$ echo ${!tableau_indi[@]}
|
||||
zsh: event not found: tableau_indi[@]
|
||||
```
|
||||
|
||||
|
||||
100
docs/Divers/bash/translate.md
Normal file
@@ -0,0 +1,100 @@
|
||||
# Translate
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#### deep-cli
|
||||
|
||||
https://github.com/eggplants/deepl-cli
|
||||
|
||||
```bash
|
||||
$ deepl --fr fr --to en -s <<'A'
|
||||
bonjour
|
||||
A
|
||||
Hello
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### translate shell
|
||||
|
||||
https://github.com/soimort/translate-shell
|
||||
|
||||
```bash
|
||||
# transfert to locale
|
||||
$ trans -b dog
|
||||
chien
|
||||
|
||||
$ trans dog
|
||||
dog
|
||||
/dôɡ/
|
||||
|
||||
(♂) chien
|
||||
(♀) chienne
|
||||
|
||||
Définitions de dog
|
||||
[ English -> Français ]
|
||||
|
||||
nom
|
||||
(le) chien
|
||||
dog, hound, cock, hanger
|
||||
(le) mâle
|
||||
male, buck, bull, cock, stag, dog
|
||||
(la) fille moche
|
||||
dog
|
||||
|
||||
verbe
|
||||
suivre de près
|
||||
monitor, dog
|
||||
suivre comme un chien
|
||||
dog
|
||||
|
||||
dog
|
||||
chien
|
||||
|
||||
# translate to target
|
||||
$ trans -b :de dog
|
||||
Hund
|
||||
|
||||
$ trans -b -t de dog
|
||||
Hund
|
||||
|
||||
# translate from source
|
||||
$ trans -b en: dog
|
||||
chien
|
||||
|
||||
$ trans -b -s en dog
|
||||
chien
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
API DeepL
|
||||
|
||||
https://www.deepl.com/docs-api/introduction/
|
||||
|
||||
```bash
|
||||
$ curl -X POST 'https://api-free.deepl.com/v2/translate' \
|
||||
--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \
|
||||
--data-urlencode 'text=Hello, world!' \
|
||||
--data-urlencode 'target_lang=DE'
|
||||
|
||||
{"translations":[{"detected_source_language":"EN","text":"Hallo, Welt!"}]}%
|
||||
```
|
||||
|
||||
```bash
|
||||
translate() {
|
||||
|
||||
deepl=$(curl -s -X POST 'https://api-free.deepl.com/v2/translate' \
|
||||
--header "Authorization: DeepL-Auth-Key $DEEPL_KEY" \
|
||||
--data-urlencode "text=$2" \
|
||||
--data-urlencode "target_lang=$1"
|
||||
)
|
||||
echo "$deepl" | jq -r .'translations[].text'
|
||||
}
|
||||
|
||||
translate "DE" "il fait beau !"
|
||||
```
|
||||
|
||||
171
docs/Divers/bash/variables.md
Normal file
@@ -0,0 +1,171 @@
|
||||
# Variables
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#### Assignation
|
||||
|
||||
```bash
|
||||
varname=value
|
||||
|
||||
echo $varname
|
||||
```
|
||||
|
||||
|
||||
Si une variable n'a pas été affectée avant, elle sera vide (pas d'erreur).
|
||||
|
||||
```bash
|
||||
echo $varname
|
||||
varname=value
|
||||
echo $varname
|
||||
|
||||
<vide>
|
||||
value
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Declarer
|
||||
|
||||
restreint la valeur de la variable à l'option
|
||||
|
||||
```bash
|
||||
declare option variablename
|
||||
```
|
||||
|
||||
option peut être:
|
||||
|
||||
- -r read only variable
|
||||
- -i integer variable
|
||||
- -a array variable
|
||||
- -f for funtions
|
||||
- -x declares and export to subsequent commands via the environment.
|
||||
|
||||
```bash
|
||||
declare -a z
|
||||
|
||||
# z sera un tableau
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Variable locale
|
||||
|
||||
la portée de la variable reste à l'instérieur de la finction
|
||||
|
||||
```bash
|
||||
ma_fonction() {
|
||||
local lvar="Local content"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Variable globale (environment variables)
|
||||
|
||||
la variable est disponible à tous les scripts
|
||||
|
||||
```bash
|
||||
$ printenv
|
||||
LC_TERMINAL_VERSION=3.4.19
|
||||
COLORFGBG=15;0
|
||||
ITERM_PROFILE=access_log
|
||||
XPC_FLAGS=0x0
|
||||
SHELL=/bin/zsh
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Test si la variable est un entier
|
||||
|
||||
```bash
|
||||
[[ $1 == ?(-)+([[:digit:]]) ]] && echo "$1 is an integer"
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Incrémenter une variable:
|
||||
|
||||
```bash
|
||||
i=$((i+1)) user 0m0.992s
|
||||
i=$((i++)) user 0m0.964s
|
||||
((i=i+1)) user 0m0.760s
|
||||
((i+=1)) user 0m0.700s
|
||||
((i++)) user 0m0.644s
|
||||
((++i)) user 0m0.556s
|
||||
let "i=i+1" user 0m1.116s
|
||||
let "i+=1" user 0m1.100s
|
||||
let "i++" user 0m1.008s
|
||||
let i=i+1 user 0m0.952s
|
||||
let i+=1 user 0m1.040s
|
||||
let i++ user 0m0.820s
|
||||
declare -i i; i=i+1 user 0m0.528s
|
||||
declare -i i; i+=1 user 0m0.492s
|
||||
i=0; i=$(expr $i + 1) user 0m5.464s
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Opération mathématiques:
|
||||
|
||||
|
||||
|
||||
https://www.gnu.org/software/bash/manual/html_node/Arithmetic-Expansion.html
|
||||
|
||||
https://www.gnu.org/software/bash/manual/html_node/Shell-Arithmetic.html
|
||||
|
||||
##### Multiplication:
|
||||
|
||||
```bash
|
||||
$ echo "$((5 * 3.15))"
|
||||
15.75
|
||||
|
||||
$ echo "5 * 3.15" | bc -l
|
||||
15.75
|
||||
|
||||
$ echo 5 3.15\*p | dc
|
||||
15.75
|
||||
```
|
||||
|
||||
##### Soustraction:
|
||||
|
||||
```bash
|
||||
$ echo "5 - 3.15" | bc -l
|
||||
1.85
|
||||
|
||||
$ echo "5 3.15 - p" | dc
|
||||
1.85schell
|
||||
|
||||
$ echo "$((5 - 3.15))"
|
||||
1.8500000000000001
|
||||
```
|
||||
|
||||
##### Addition:
|
||||
|
||||
```bash
|
||||
$ echo "5 + 3.15" | bc -l
|
||||
8.15
|
||||
|
||||
$ echo "$((5 + 3.15))"
|
||||
8.1500000000000004
|
||||
|
||||
$ ((add=5 + 3))
|
||||
$ echo $add
|
||||
8
|
||||
|
||||
```
|
||||
|
||||
##### Division:
|
||||
|
||||
```bash
|
||||
$ echo "5 / 3.15" | bc -l
|
||||
1.58730158730158730158
|
||||
|
||||
$ echo "$((20 / 4))"
|
||||
5
|
||||
|
||||
$ echo "$((5 / 2))"
|
||||
2
|
||||
```
|
||||
|
||||
184
docs/Divers/diraction.md
Normal file
@@ -0,0 +1,184 @@
|
||||
# diractions
|
||||
|
||||
|
||||
|
||||
https://github.com/AdrieanKhisbe/diractions
|
||||
|
||||
|
||||
|
||||
#### Configuration:
|
||||
|
||||
Fichier de configuration Diraction:
|
||||
|
||||
`DIRACTION_DEF_FILE = "~/.diractions"`
|
||||
|
||||
|
||||
|
||||
On peut l'éditer:
|
||||
|
||||
```bash
|
||||
$ nano ~/.diractions
|
||||
```
|
||||
|
||||
```ini
|
||||
canon "$HOME/Pictures/Raw"
|
||||
docs "$HOME/Documents/docs"
|
||||
74ini /opt/homebrew/etc/php/7.4
|
||||
80ini /opt/homebrew/etc/php/8.0
|
||||
apache /opt/homebrew/etc/httpd
|
||||
```
|
||||
|
||||
ou créer ses directions:
|
||||
|
||||
```bash
|
||||
$ diraction create <nom> <repertoire>
|
||||
```
|
||||
|
||||
ou sauver le répertoire courant:
|
||||
|
||||
```bash
|
||||
$ diraction save <nom>
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Utilisation:
|
||||
|
||||
Il suffit de taper le nom de la direction:
|
||||
|
||||
```bash
|
||||
~
|
||||
❯ canon
|
||||
|
||||
~/Pictures/Raw
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Sous-commandes:
|
||||
|
||||
`l | ls`
|
||||
|
||||
```bash
|
||||
$ 74ini ls
|
||||
total 84
|
||||
drwxr-xr-x 12 bruno admin 384 jul 29 18:35 conf.d
|
||||
-rw-r--r-- 1 bruno admin 1397 jul 28 22:49 pear.conf
|
||||
-rw-r--r-- 1 bruno admin 5422 jul 28 22:49 php-fpm.conf
|
||||
drwxr-xr-x 3 bruno admin 96 jul 28 22:49 php-fpm.d
|
||||
-rw-r--r-- 1 bruno admin 72665 jul 28 22:49 php.ini
|
||||
|
||||
```
|
||||
|
||||
`t | tree`
|
||||
|
||||
```bash
|
||||
$ 74ini tree
|
||||
/opt/homebrew/etc/php/7.4
|
||||
├── conf.d
|
||||
│ ├── apcu.ini
|
||||
│ ├── ext-opcache.ini
|
||||
│ ├── igbinary.ini
|
||||
│ ├── imagick.ini
|
||||
│ ├── mcrypt.ini
|
||||
│ ├── memcached.ini
|
||||
│ ├── msgpack.ini
|
||||
│ ├── ssh2.ini
|
||||
│ ├── xdebug.ini
|
||||
│ └── yaml.ini
|
||||
├── pear.conf
|
||||
├── php-fpm.conf
|
||||
├── php-fpm.d
|
||||
│ └── www.conf
|
||||
└── php.ini
|
||||
|
||||
```
|
||||
|
||||
`ed | edit <filename>`
|
||||
|
||||
```bash
|
||||
$ 74ini ed php.ini
|
||||
|
||||
# ouvre /opt/homebrew/etc/php/7.4/php.ini dans $EDITOR
|
||||
```
|
||||
|
||||
`o | open <filename>`
|
||||
|
||||
```bash
|
||||
$ 74ini o php.ini
|
||||
|
||||
# ouvre /opt/homebrew/etc/php/7.4/php.ini dans Nova / bbedit
|
||||
|
||||
$ 74ini o
|
||||
|
||||
# ouvre le dossier /opt/homebrew/etc/php/7.4/ dans le finder
|
||||
```
|
||||
|
||||
`w | where | ?`
|
||||
|
||||
```bash
|
||||
$ 74ini w
|
||||
/opt/homebrew/etc/php/7.4
|
||||
```
|
||||
|
||||
`i | interactive | prompt | shell`
|
||||
|
||||
```bash
|
||||
$ 74ini i
|
||||
Entering interactive mode in /opt/homebrew/etc/php/7.4 folder:
|
||||
\>\>\
|
||||
```
|
||||
|
||||
`e | exec <quoted command>`
|
||||
|
||||
```bash
|
||||
$ canon e "mv 2021.jpg 2021.png"
|
||||
```
|
||||
|
||||
`c | cd <subdir>`
|
||||
|
||||
```bash
|
||||
~
|
||||
$ canon c 2021
|
||||
|
||||
~/Pictures/Raw/2021
|
||||
|
||||
```
|
||||
|
||||
`/ <subdir> | /<subdir>`
|
||||
|
||||
```bash
|
||||
~
|
||||
$ canon / 2021
|
||||
|
||||
~/Pictures/Raw/2021
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Commandes globales:
|
||||
|
||||
`diraction disable <dirname>`: désactive l'alias
|
||||
|
||||
`diraction enable <dirname>`: active l'alias
|
||||
|
||||
`diraction destroy <dirname>`: supprime l'alias
|
||||
|
||||
`diraction destroy-all`: supprime toutes les directions (requiert l'argument -f ou --force)
|
||||
|
||||
`diraction reset`: destroy the diraction and reload them from the configuration
|
||||
|
||||
`diraction -h | --help`: aide
|
||||
|
||||
|
||||
|
||||
#### Préférences:
|
||||
|
||||
- DIRACTION_AUTO_CONFIG
|
||||
- DIRACTION_DEF_FILE
|
||||
- DIRACTION_EDITOR
|
||||
- DIRACTION_INTERACTIVE_PROMPT
|
||||
- DIRACTION_EXPORT_VARIABLES
|
||||
- DIRACTION_READONLY_VARIABLES
|
||||
|
||||
@@ -395,8 +395,6 @@ drwxr-xr-x 1 root root 196 Mar 15 09:35 public
|
||||
|
||||
|
||||
|
||||
## emby
|
||||
|
||||
|
||||
|
||||
https://github.com/mickael-kerjean/filestash/wiki/Release-0.2:-Photo-Management
|
||||
|
||||
@@ -4,6 +4,25 @@ https://docs.docker.com/
|
||||
|
||||
|
||||
|
||||
### macOS
|
||||
|
||||
Docker ne fonctionne pas nativement sur Mac car le noyau de macOS n'est pas compatible (BSD vs Linux). Docker fonctionne en fait dans une machine virtuelle utilisant HyperKit.
|
||||
|
||||
Le fichier Docker.raw que vous avez mentionné ci-dessus est le disque virtuel de cette machine virtuelle.
|
||||
|
||||
Toutes les images Docker sont stockées à l'intérieur de la machine virtuelle (dans le fichier Docker.raw), vous ne pouvez donc pas les voir sur le système de fichiers du Mac.
|
||||
|
||||
```bash
|
||||
~/Library/Containers/com.docker.docker/Data/vms/0/data
|
||||
.rw-r--r--@ 60Gi bruno staff 6 jan 16:01 23 jul 2021 Docker.raw
|
||||
```
|
||||
|
||||
Régler la taille et l'emplacement de la VM: Dashboard -> Settings -> Resources -> Advanced (réduire la taille de la VM supprime les images,containers et volumes)
|
||||
|
||||
https://docs.docker.com/desktop/faqs/macfaqs/
|
||||
|
||||
|
||||
|
||||
### Containers installés:
|
||||
|
||||
#### Synology Docker GUI:
|
||||
@@ -15,7 +34,7 @@ https://docs.docker.com/
|
||||
| hoobs | hoobs/hoobs:latest | | |
|
||||
| photonix | damianmoore/photonix:latest | | |
|
||||
| PiHole | pihole/pihole:latest | | |
|
||||
| f | linuxserver/photoshow:latest | | |
|
||||
| photoshow | linuxserver/photoshow:latest | | |
|
||||
|
||||
#### Portainer:
|
||||
|
||||
@@ -49,13 +68,13 @@ uid=1026(bruno) gid=100(users) groups=100(users),101(administrators)
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ id
|
||||
$ id
|
||||
uid=501(bruno) gid=20(staff) groups=20(staff),12(everyone)...
|
||||
|
||||
❯ id -u
|
||||
$ id -u
|
||||
501
|
||||
|
||||
❯ id -g
|
||||
$ id -g
|
||||
20
|
||||
```
|
||||
|
||||
@@ -70,7 +89,7 @@ chown 1000:1000 /volume1/docker/personal/ghost/ghost
|
||||
Créer un fichier **docker-compose.yml** dans **/volume1/docker/personal/ghost**
|
||||
(pas de TAB)
|
||||
|
||||
```
|
||||
```bash
|
||||
/volume1/docker/personal/ghost $ sudo docker-compose up -d
|
||||
```
|
||||
|
||||
@@ -93,20 +112,22 @@ Stopping photoprism_photoprism_1 ... done
|
||||
|
||||
Pour mettre à jour le container, supprimer le container dans la GUI et relancer `docker-compose up -d`
|
||||
|
||||
```
|
||||
```bash
|
||||
/volume1/docker/personal/ghost $ sudo docker-compose pull
|
||||
/volume1/docker/personal/ghost $ sudo docker-compose up -d
|
||||
```
|
||||
|
||||
```
|
||||
docker-compose up --force-recreate --build -d
|
||||
```bash
|
||||
$ docker-compose up --force-recreate --build -d
|
||||
```
|
||||
|
||||
http://tonylawrence.com/posts/unix/synology/free-your-synology-ports/
|
||||
|
||||
|
||||
Arreter un container:
|
||||
docker-compose down
|
||||
|
||||
```bash
|
||||
$ docker-compose down
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -116,15 +137,15 @@ Arreter un container:
|
||||
**Liste des containers qui tournent:**
|
||||
|
||||
```bash
|
||||
❯ docker ps (Docker <1.13)
|
||||
❯ docker container ls
|
||||
$ docker ps (Docker <1.13)
|
||||
$ docker container ls
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
104f0c7e80a1 postgres:11.1-alpine "docker-entrypoint.s…" About an hour ago Up About an hour 5432/tcp photonix-postgres
|
||||
4c66e278fd6d gitlab/gitlab-ce:latest "/assets/wrapper" 9 months ago Up 2 hours (unhealthy) 0.0.0.0:922->22/tcp, 0.0.0.0:81->80/tcp, 0.0.0.0:444->443/tcp gitlab
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ docker container ls --format 'table {{.Names}}\t{{.Status}}'
|
||||
$ docker container ls --format 'table {{.Names}}\t{{.Status}}'
|
||||
NAMES STATUS
|
||||
watchtower Up 38 minutes
|
||||
portainer Up 2 hours
|
||||
@@ -133,7 +154,7 @@ homebridge Up 2 days
|
||||
bizmodeller-mymediaforalexa-amd641 Up 13 days
|
||||
PiHole Up 3 weeks (healthy)
|
||||
|
||||
❯ docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}\t{{.Networks}}\t{{.Mounts}}"
|
||||
$ docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}\t{{.Networks}}\t{{.Mounts}}"
|
||||
CONTAINER ID IMAGE COMMAND CREATED AT STATUS PORTS NAMES NETWORKS MOUNTS
|
||||
18fba7e277be portainer/portainer-ce "/portainer" 2020-11-09 22:22:47 +0100 CET Up 15 hours 0.0.0.0:8000->8000/tcp, 0.0.0.0:9000->9000/tcp portainer bridge portainer_data,/run/host-serv…
|
||||
|
||||
@@ -142,8 +163,8 @@ CONTAINER ID IMAGE COMMAND CREATED AT
|
||||
**Liste des containers stoppés:**
|
||||
|
||||
```bash
|
||||
❯ docker ps --filter "status=exited"
|
||||
❯ docker container ls -f "status=exited"
|
||||
$ docker ps --filter "status=exited"
|
||||
$ docker container ls -f "status=exited"
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
842cbbada398 damianmoore/photonix:latest "/bin/sh -c ./system…" About an hour ago Exited (137) 50 minutes ago photonix
|
||||
23c90981855b redis:3.2.8 "docker-entrypoint.s…" About an hour ago Exited (0) 50 minutes ago photonix-redis
|
||||
@@ -154,8 +175,8 @@ d2b481b91f10 portainer/portainer "/portainer" 9 mon
|
||||
**Liste de tous les containers:**
|
||||
|
||||
```bash
|
||||
❯ docker ps --all
|
||||
❯ docker container ls --all
|
||||
$ docker ps --all
|
||||
$ docker container ls --all
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
842cbbada398 damianmoore/photonix:latest "/bin/sh -c ./system…" About an hour ago Exited (137) 54 minutes ago photonix
|
||||
104f0c7e80a1 postgres:11.1-alpine "docker-entrypoint.s…" About an hour ago Up About an hour 5432/tcp photonix-postgres
|
||||
@@ -168,43 +189,56 @@ d2b481b91f10 portainer/portainer "/portainer" 9 mon
|
||||
**Liste des ID des containers qui tournent:**
|
||||
|
||||
```bash
|
||||
❯ docker ps -q
|
||||
❯ docker container ls -q
|
||||
$ docker ps -q
|
||||
$ docker container ls -q
|
||||
104f0c7e80a1
|
||||
4c66e278fd6d
|
||||
```
|
||||
|
||||
**Démarrer un container:**
|
||||
|
||||
```bash
|
||||
# Démarre un container déjà crée mais arrêté.
|
||||
|
||||
$ docker start photoprism_photoprism_1
|
||||
photoprism_photoprism_1
|
||||
$ docker start 4beabb9fd090
|
||||
4beabb9fd090
|
||||
```
|
||||
|
||||
**Stopper un container:**
|
||||
|
||||
```bash
|
||||
❯ docker stop gitlab
|
||||
❯ docker stop 4c66e278fd6d
|
||||
$ docker stop gitlab
|
||||
gitlab
|
||||
$ docker stop 4c66e278fd6d
|
||||
4c66e278fd6d
|
||||
```
|
||||
|
||||
**Stopper tous les containers:**
|
||||
|
||||
```bash
|
||||
❯ docker container stop $(docker container ls -aq)
|
||||
$ docker container stop $(docker container ls -aq)
|
||||
```
|
||||
|
||||
|
||||
**Stopper tous les containers associés à une image:**
|
||||
|
||||
```bash
|
||||
❯ docker ps -q --filter ancestor=IMAGE_NAME | xargs docker stop
|
||||
$ docker ps -q --filter ancestor=IMAGE_NAME | xargs docker stop
|
||||
```
|
||||
|
||||
|
||||
**Supprimer un container:**
|
||||
|
||||
```bash
|
||||
❯ docker container rm d2b481b91f10 9763d849e8b1
|
||||
$ docker container rm d2b481b91f10 9763d849e8b1
|
||||
d2b481b91f10
|
||||
9763d849e8b1
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ sudo docker rm b5576f445729
|
||||
$ sudo docker rm b5576f445729
|
||||
Error response from daemon: You cannot remove a running container b5576f44572913f1154e429b2bc84f84e696f4006adbaf8c2fb44f9dc1ff013a. Stop the container before attempting removal or force remove
|
||||
|
||||
$ sudo docker rm b5576f445729 --force
|
||||
@@ -214,21 +248,37 @@ b5576f445729
|
||||
**Supprimer tous les containers:**
|
||||
|
||||
```bash
|
||||
❯ docker container rm $(docker container ls -aq)
|
||||
$ docker container rm $(docker container ls -aq)
|
||||
```
|
||||
|
||||
**Exécuter une commande dans un container:**
|
||||
|
||||
```
|
||||
❯ sudo docker container ls --format 'table {{.ID}}\t{{.Names}}'
|
||||
```bash
|
||||
$ sudo docker container ls --format 'table {{.ID}}\t{{.Names}}'
|
||||
CONTAINER ID NAMES
|
||||
700a2cd00cba lychee
|
||||
❯ sudo docker container exec 700a2cd00cba hostname
|
||||
$ sudo docker container exec 700a2cd00cba hostname
|
||||
700a2cd00cba
|
||||
❯ sudo docker container exec 700a2cd00cba hostname -I
|
||||
$ sudo docker container exec 700a2cd00cba hostname -I
|
||||
172.18.0.3
|
||||
```
|
||||
|
||||
**Créer et démarrer un container:**
|
||||
|
||||
```bash
|
||||
$ docker container run
|
||||
```
|
||||
|
||||
```bash
|
||||
$ docker run
|
||||
```
|
||||
|
||||
**Renommer un container:**
|
||||
|
||||
```bash
|
||||
$ docker rename photoprism_photoprism_1 photoprism_1
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Images:
|
||||
@@ -236,7 +286,7 @@ CONTAINER ID NAMES
|
||||
**Liste des images:**
|
||||
|
||||
```bash
|
||||
❯ docker image ls
|
||||
$ docker image ls
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
oznu/homebridge latest 3fa073f20624 4 days ago 625MB
|
||||
hoobs/hoobs latest c35c2f7222f3 4 days ago 558MB
|
||||
@@ -251,7 +301,7 @@ v2tec/watchtower latest 3069a9fb302a 2 ye
|
||||
Changer le [format de la sortie](https://docs.docker.com/engine/reference/commandline/images/#format-the-output):
|
||||
|
||||
```
|
||||
❯ docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}\t{{.Size}}"
|
||||
$ docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}\t{{.Size}}"
|
||||
REPOSITORY TAG IMAGE ID CREATED AT SIZE
|
||||
oznu/homebridge latest 3fa073f20624 2020-11-06 07:05:24 +0100 CET 625MB
|
||||
hoobs/hoobs latest c35c2f7222f3 2020-11-05 15:17:26 +0100 CET 558MB
|
||||
@@ -272,19 +322,19 @@ Sur une connection ssh: `ssh foo@bar docker images --format "$(jq .imagesFormat
|
||||
**Supprimer une image:**
|
||||
|
||||
```bash
|
||||
❯ docker image rm 75835a67d134
|
||||
$ docker image rm 75835a67d134
|
||||
```
|
||||
|
||||
**Supprimer toutes les images non référencées par un container existant:**
|
||||
|
||||
```bash
|
||||
❯ docker image prune -a
|
||||
$ docker image prune -a
|
||||
```
|
||||
|
||||
Infos sur une image:
|
||||
|
||||
```bash
|
||||
❯ docker image inspect 79aeacedba12
|
||||
$ docker image inspect 79aeacedba12
|
||||
[
|
||||
{
|
||||
"Id": "sha256:79aeacedba12f180af279aa030c7a64a0b2a9dc428a1dc1c4c074caafa05426d",
|
||||
@@ -301,7 +351,7 @@ Infos sur une image:
|
||||
|
||||
# Date de création d'une image:
|
||||
|
||||
❯ docker image inspect 79aeacedba12 | grep 'Created'
|
||||
$ docker image inspect 79aeacedba12 | grep 'Created'
|
||||
"Created": "2020-10-24T08:06:20.266765865Z",
|
||||
|
||||
```
|
||||
@@ -313,7 +363,7 @@ Infos sur une image:
|
||||
**Liste des volumes:**
|
||||
|
||||
```bash
|
||||
❯ docker volume ls
|
||||
$ docker volume ls
|
||||
DRIVER VOLUME NAME
|
||||
local 4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
|
||||
local 9d1fbf38c96c6474e159d512ff218c67ff7307c42f46cb01724358db854f3dd9
|
||||
@@ -324,15 +374,15 @@ local portainer_data
|
||||
|
||||
**Supprimer un volume:**
|
||||
|
||||
```
|
||||
❯ docker volume rm 4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
|
||||
```bash
|
||||
$ docker volume rm 4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
|
||||
4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
|
||||
```
|
||||
|
||||
**Supprimer tous les volumes inutilisés:**
|
||||
|
||||
```
|
||||
❯ docker volume prune
|
||||
```bash
|
||||
$ docker volume prune
|
||||
WARNING! This will remove all local volumes not used by at least one container.
|
||||
Are you sure you want to continue? [y/N] y
|
||||
Total reclaimed space: 0B
|
||||
@@ -344,8 +394,8 @@ Total reclaimed space: 0B
|
||||
|
||||
**Liste des réseaux:**
|
||||
|
||||
```
|
||||
❯ docker network ls
|
||||
```bash
|
||||
$ docker network ls
|
||||
NETWORK ID NAME DRIVER SCOPE
|
||||
cb8db3bfdaa8 bridge bridge local
|
||||
5a1ec0a7d634 host host local
|
||||
@@ -356,14 +406,14 @@ a522745b92b7 pixapop_default bridge local
|
||||
|
||||
**Supprimer tous les réseaux inutilisés:**
|
||||
|
||||
```
|
||||
❯ docker network prune
|
||||
```bash
|
||||
$ docker network prune
|
||||
```
|
||||
|
||||
**Supprimer tous les réseaux crées il y a plus de 12h:**
|
||||
|
||||
```
|
||||
❯ docker network prune --filter "until=12h"
|
||||
```bash
|
||||
$ docker network prune --filter "until=12h"
|
||||
WARNING! This will remove all custom networks not used by at least one container.
|
||||
Are you sure you want to continue? [y/N] y
|
||||
```
|
||||
@@ -373,7 +423,7 @@ Are you sure you want to continue? [y/N] y
|
||||
## Stats:
|
||||
|
||||
```bash
|
||||
❯ docker stats
|
||||
$ docker stats
|
||||
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDSCONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
|
||||
18fba7e277be portainer 0.00% 11.86MiB / 1.941GiB 0.60% 773kB / 6.04MB 287kB / 3.53MB 12
|
||||
```
|
||||
@@ -383,7 +433,7 @@ CONTAINER ID NAME CPU % MEM USAGE / LIMIT
|
||||
## Prune:
|
||||
|
||||
```bash
|
||||
❯ sudo docker system prune
|
||||
$ sudo docker system prune
|
||||
Password:
|
||||
WARNING! This will remove:
|
||||
- all stopped containers
|
||||
@@ -513,11 +563,11 @@ b47b4299cc38 bizmodeller-mymediaforalexa-amd641 0.0.0.0:52050-52051->52
|
||||
|
||||
```bash
|
||||
~/Documents/docker master* ⇡
|
||||
❯ docker volume create portainer_data
|
||||
$ docker volume create portainer_data
|
||||
portainer_data
|
||||
|
||||
~/Documents/docker master* ⇡
|
||||
❯ docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
|
||||
$ docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
|
||||
Unable to find image 'portainer/portainer-ce:latest' locally
|
||||
latest: Pulling from portainer/portainer-ce
|
||||
d1e017099d17: Already exists
|
||||
@@ -644,16 +694,16 @@ Entry | Description | Equivalent
|
||||
|
||||
|
||||
|
||||
```
|
||||
docker top
|
||||
```bash
|
||||
$ docker top
|
||||
|
||||
❯ docker service ls
|
||||
$ docker service ls
|
||||
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
|
||||
|
||||
❯ docker node ls
|
||||
$ docker node ls
|
||||
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
|
||||
|
||||
❯ docker config ls
|
||||
$ docker config ls
|
||||
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
|
||||
|
||||
```
|
||||
|
||||
329
docs/Divers/dotbare.md
Normal file
@@ -0,0 +1,329 @@
|
||||
# dotbare
|
||||
|
||||
https://github.com/kazhala/dotbare
|
||||
|
||||
|
||||
|
||||
### Installation
|
||||
|
||||
#### Dépendances
|
||||
|
||||
```bash
|
||||
brew install fzf tree bat (ou highlight, coderay) delta (ou diff-so-fancy)
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### zsh:
|
||||
|
||||
```bash
|
||||
# zinit
|
||||
|
||||
zinit light kazhala/dotbare
|
||||
|
||||
# antibody
|
||||
|
||||
antibody bundle kazhala/dotbare
|
||||
```
|
||||
|
||||
ou
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/kazhala/dotbare.git ~/.dotbare
|
||||
|
||||
puis source ~/.dotbare/dotbare.plugin.zsh dans les fichiers .zshrc
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### bash:
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/kazhala/dotbare.git ~/.dotbare
|
||||
|
||||
puis source ~/.dotbare/dotbare.plugin.bash dans les fichiers .bashrc ou .bash_profile
|
||||
```
|
||||
|
||||
#####
|
||||
|
||||
#### Initialisation:
|
||||
|
||||
```bash
|
||||
# init dépôt git bare (dans $HOME/.cfg).
|
||||
|
||||
$ dotbare finit
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Utilisation:
|
||||
|
||||
#### Ajouter les fichiers à suivre:
|
||||
|
||||
```bash
|
||||
# Fichiers
|
||||
|
||||
$ dotbare fadd -f
|
||||
# ou
|
||||
$ dotbare add [FIELNAME]
|
||||
|
||||
# Répertoires
|
||||
|
||||
$ dotbare fadd -d
|
||||
# ou
|
||||
$ dotbare add [DIRECTORY]
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Commit changes and push to remote:
|
||||
|
||||
```bash
|
||||
$ dotbare commit -m "First commit"
|
||||
$ dotbare remote add origin [URL]
|
||||
$ dotbare push -u origin master
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Alias:
|
||||
|
||||
```bash
|
||||
alias dbpush='dotbare push -u mbv master'
|
||||
alias dbadd='dotbare add -f $1'
|
||||
alias dbcomm='dotbare commit -am $1'
|
||||
alias dbback='dotbare fbackup'
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Préférences:
|
||||
|
||||
```bash
|
||||
# Default value
|
||||
export DOTBARE_DIR="$HOME/.cfg"
|
||||
|
||||
export DOTBARE_TREE="$HOME"
|
||||
|
||||
export DOTBARE_BACKUP="${XDG_DATA_HOME:-$HOME/.local/share}/dotbare"
|
||||
|
||||
export DOTBARE_KEY="
|
||||
--bind=alt-a:toggle-all # toggle all selection
|
||||
--bind=alt-j:jump # label jump mode, sort of like vim-easymotion
|
||||
--bind=alt-0:top # set cursor back to top
|
||||
--bind=alt-s:toggle-sort # toggle sorting
|
||||
--bind=alt-t:toggle-preview # toggle preview
|
||||
"
|
||||
|
||||
export DOTBARE_FZF_DEFAULT_OPTS="--preview-window=right:65%"
|
||||
|
||||
export DOTBARE_PREVIEW="cat -n {}"
|
||||
|
||||
export DOTBARE_DIFF_PAGER="delta --diff-so-fancy --line-numbers"
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### fbackup:
|
||||
|
||||
D'après la variable DOTBARE_BACKUP
|
||||
|
||||
- Backup files to /Users/bruno/.local/share/dotbare.
|
||||
- This is useful when untracking files or migrating to new machines.
|
||||
- Default: backup all tracked files using cp command to /Users/bruno/.local/share/dotbare directory.
|
||||
|
||||
```bash
|
||||
# -$HOME/.local/share/dotbare
|
||||
|
||||
#Sauvegarger tous les fichiers:
|
||||
|
||||
$ dotbare fbackup
|
||||
|
||||
# Pour choisir les fichiers à backuper:
|
||||
|
||||
$ dotbare fbackup -s
|
||||
|
||||
# -s, --select list all tracked files and only backup the selected files.
|
||||
# -p PATH, --path PATH specify path of files to backup.
|
||||
# -m, --move use 'mv' instead of the default 'cp' command to backup.
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### fedit:
|
||||
|
||||
- Select files/commits through fzf and edit selected files/commits in EDITOR.
|
||||
- Default: list all tracked dotfiles and edit the selected files.
|
||||
|
||||
```bash
|
||||
$ dotbare fedit
|
||||
|
||||
# -h, --help show this help message and exit.
|
||||
# -m uniquement les fichiers modifiés
|
||||
# -c affiche les commits
|
||||
```
|
||||
|
||||
#### fgrep:
|
||||
|
||||
- Grep words within tracked files and select to edit matches.
|
||||
|
||||
```bash
|
||||
$ dotbare fgrep
|
||||
|
||||
# -h, --help show this help message and exit.
|
||||
# -c COL, --col COL specify the column number to start searching.
|
||||
# -f, --full include all column during search, as if using '--col 1'.
|
||||
```
|
||||
|
||||
#### flog:
|
||||
|
||||
- Interactive log viewer with action menu.
|
||||
- Action menu contains options including revert|reset|edit|checkout|exit.
|
||||
- Default: list all commits and prompt a menu to select action to perform.
|
||||
|
||||
```bash
|
||||
$ dotbare flog
|
||||
|
||||
# -h, --help show this help message and exit.
|
||||
# -r, --revert revert the selected commit and skip action menu.
|
||||
# -R, --reset reset HEAD back to selected commit and skip action menu.
|
||||
# -e, --edit edit selected commit through interactive rebase and skip action menu.
|
||||
# -c, --checkout checkout selected commit and skip action menu.
|
||||
# -y, --yes acknowledge all actions that will be taken and skip confirmation.
|
||||
```
|
||||
|
||||
#### freset:
|
||||
|
||||
- Reset(unstage) the selected staged files. (Default)
|
||||
- Reset the HEAD to certain commits by using -c flag.
|
||||
|
||||
```bash
|
||||
$ dotbare freset
|
||||
|
||||
# -h, --help show this help message and exit.
|
||||
# -c, --commit reset HEAD to certain commit, default --mixed flag, reset HEAD to certain commit put all changes into modified state.
|
||||
# -S, --soft reset commit using --soft flag, reset HEAD to certain commit without modify working tree.
|
||||
# -H, --hard reset commit using --hard flag, reset HEAD to certain commit discard all changes from the working tree.
|
||||
# -y, --yes acknowledge all actions that will be taken and skip confirmation.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### fcheckout:
|
||||
|
||||
- Select files/commit/branch through fzf and checkout the selected objects.
|
||||
- Files: checkout the version in HEAD or in a specific commit (reset files content back to the selected commit).
|
||||
- Branch: switch to the selected branch.
|
||||
- Commit: switch to a specific commit.
|
||||
- Default: list all modified files and reset selected files back to HEAD.
|
||||
|
||||
```bash
|
||||
$ dotbare fcheckout
|
||||
|
||||
# -h, --help show this help message and exit.
|
||||
# -s, --select list all tracked files and select a commit to checkout the selected files.
|
||||
# -b, --branch list all branch and checkout/switch the selected branch.
|
||||
# -c, --commit list all commits and checkout selected commit.
|
||||
# -y, --yes acknowledge all actions that will be taken and skip confirmation.
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### fstash
|
||||
|
||||
- View and manage stash interactively
|
||||
|
||||
```bash
|
||||
$ dotbare fstash
|
||||
|
||||
# Default: list all stashes and apply the selected stash files
|
||||
|
||||
# -h, --help show this help message and exit.
|
||||
#. -s, --select list modified files and stash the selected files
|
||||
# -d, --delete list all stashes and delete the selected stash files
|
||||
# -p, --pop use 'stash pop' instead of 'stash apply'
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### fstat
|
||||
|
||||
- Display interactive git status menu
|
||||
- Toggle file stage/unstage interactively
|
||||
|
||||
```bash
|
||||
$ dotbare fstat
|
||||
|
||||
# -h, --help show this help message and exit.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### funtrack
|
||||
|
||||
- Untrack selected files from git
|
||||
|
||||
```bash
|
||||
$ dotbare funtrack
|
||||
|
||||
# Default: list all tracked files and permanently untrack the selected files (using git rm --cached filename).
|
||||
# Files will be remove from index while keeping the file in your current system.
|
||||
# However, when your other computers pull down the changes, the untracked files will be deleted.
|
||||
# Make sure to run dotbare fbackup before pulling down the changes.
|
||||
|
||||
# Alternatively use the -t flag (using git update-index --assume-unchanged [path]) to temporarily untrack a file but keeping the files when other computers pull down the changes.
|
||||
|
||||
|
||||
# -h, --help show this help message and exit.
|
||||
# -t, --temp list all trackes files and temporarily ignore changes of the selected files.
|
||||
# -r, --resume list all trackes files and resume tracking changes of the selected files.
|
||||
# -y, --yes acknowledge all actions that will be taken and skip confirmation.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### fupgrade
|
||||
|
||||
- Upgrade dotbare to the latest master
|
||||
|
||||
```bash
|
||||
$ dotbare fupgrade
|
||||
|
||||
# -h, --help show this help message and exit.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Liste des fichiers sauvegardés:
|
||||
|
||||
```bash
|
||||
~/.local/share/dotbare 08:42:08
|
||||
❯ l
|
||||
Permissions Size User Group Date Modified Date Created Name
|
||||
.rwxr-xr-x 1,1Ki bruno staff 25 jul 2021 25 jul 2021 .backup_list.conf*
|
||||
.rwxr-xr-x 2,5Ki bruno staff 25 jul 2021 25 jul 2021 .bash_aliases*
|
||||
.rwxr-xr-x 7,8Ki bruno staff 4 fév 20:07 25 jul 2021 .bash_profile*
|
||||
.rw-r--r-- 259 bruno staff 4 fév 20:07 24 jul 2021 .bashrc
|
||||
drwxr-xr-x - bruno staff 12 aoû 2021 12 aoû 2021 .config/
|
||||
.rw-r--r-- 236 bruno staff 21 nov 2021 1 aoû 2021 .diractions
|
||||
.rwxr-xr-x 21Ki bruno staff 25 jul 2021 25 jul 2021 .dircolors*
|
||||
.rwxr-xr-x 10 bruno staff 25 jul 2021 25 jul 2021 .exclude-rsync.txt*
|
||||
.rw-r--r-- 318 bruno staff 16 fév 15:02 4 aoû 2021 .gitconfig
|
||||
.rwxr-xr-x 134 bruno staff 12 aoû 2021 25 jul 2021 .gitignore*
|
||||
.rw-r--r-- 645 bruno staff 7 aoû 2021 7 aoû 2021 .my.cnf.gpg
|
||||
drwxr-xr-x - bruno staff 5 mai 08:33 12 aoû 2021 .nano/
|
||||
.rw-r--r-- 2,7Ki bruno staff 25 jul 2021 25 jul 2021 .nanorc
|
||||
.rw-r--r--@ 9,7Ki bruno staff 1 aoû 2021 1 aoû 2021 .p10k.zsh
|
||||
drwxr-xr-x - bruno staff 12 aoû 2021 12 aoû 2021 .ssh/
|
||||
.rwxr-xr-x 69 bruno staff 25 jul 2021 25 jul 2021 .ticker.conf*
|
||||
.rwxr-xr-x 355 bruno staff 25 jul 2021 25 jul 2021 .ticker.yaml*
|
||||
.rw-r--r-- 130 bruno staff 17 aoû 2021 23 jul 2021 .zprofile
|
||||
.rwxr-xr-x@ 349 bruno staff 31 jul 2021 31 jul 2021 .zsh_plugins.txt*
|
||||
.rw-r--r-- 28 bruno staff 1 aoû 2021 1 aoû 2021 .zshbookmarks
|
||||
.rw-r--r--@ 25Ki bruno staff 4 mai 08:06 12 aoû 2021 .zshrc
|
||||
.rw-r--r--@ 16Ki bruno staff 31 jul 2021 31 jul 2021 .zshrc-antibody.bak
|
||||
|
||||
```
|
||||
|
||||
@@ -775,6 +775,96 @@ https://blog.zenika.com/2017/01/24/pull-request-demystifie/
|
||||
|
||||
|
||||
|
||||
### Connaitre la version courante:
|
||||
|
||||
```bash
|
||||
$ git show
|
||||
commit a3f86d08322bc3ef14157ced679907b2b8ec27ee (HEAD -> master, tag: debian/1.0.12-5, origin/master, origin/HEAD)
|
||||
Author: James Valleroy <jvalleroy@mailbox.org>
|
||||
Date: Sat Jan 8 21:31:13 2022 -0500
|
||||
|
||||
Release v1.0.12-5 to unstable
|
||||
|
||||
$ git show | grep -m 1 "Release"
|
||||
Release v1.0.12-5 to unstable
|
||||
|
||||
|
||||
$ git show
|
||||
commit a749e724fbeb5cd1b13272a2784c7c2945dc138a (grafted, HEAD -> master, origin/master)
|
||||
Author: Jay Salvat <jay@jaysalvat.com>
|
||||
Date: Sat Jan 30 11:09:55 2021 +0100
|
||||
|
||||
Build v2.5.4
|
||||
|
||||
$ git show | grep -m 1 "Build" | awk -F"v" '{print $2}'
|
||||
2.5.4
|
||||
|
||||
$ ssh -q -t funnymac@ftp.cluster011.ovh.net "cd www/photoblog/js/vegas && git show | grep -m 1 \"Build\"" | awk -F"v" '{print $2}' | sed 's/.$//'
|
||||
2.5.4
|
||||
```
|
||||
|
||||
```bash
|
||||
$ git log
|
||||
commit a749e724fbeb5cd1b13272a2784c7c2945dc138a (grafted, HEAD -> master, origin/master)
|
||||
Author: Jay Salvat <jay@jaysalvat.com>
|
||||
Date: Sat Jan 30 11:09:55 2021 +0100
|
||||
|
||||
Build v2.5.4
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Savoir si mise-à-jour est dispo:
|
||||
|
||||
```bash
|
||||
$ git remote show origin | grep $(git rev-parse --abbrev-ref HEAD) | tail -1
|
||||
master pousse vers master (à jour)
|
||||
```
|
||||
|
||||
!!! warning "Si on a un repo partiel, **git remote** recontruit le repo git"
|
||||
|
||||
```bash
|
||||
$ git remote -v update
|
||||
POST git-upload-pack (188 bytes)
|
||||
Depuis https://salsa.debian.org/php-team/pear/php-gettext
|
||||
= [à jour] master -> origin/master
|
||||
= [à jour] pristine-tar -> origin/pristine-tar
|
||||
= [à jour] upstream -> origin/upstream
|
||||
```
|
||||
|
||||
```bash
|
||||
$ git remote update
|
||||
|
||||
$ git status -uno
|
||||
Sur la branche master
|
||||
Votre branche est à jour avec 'origin/master'.
|
||||
|
||||
rien à valider (utilisez -u pour afficher les fichiers non suivis)
|
||||
```
|
||||
|
||||
```bash
|
||||
$ git remote update
|
||||
|
||||
$git show-branch origin/master
|
||||
[origin/master] Release v1.0.12-6 to unstable
|
||||
```
|
||||
|
||||
```bash
|
||||
local_commit=$(git rev-list --all -n1)
|
||||
remote_commit=$(git ls-remote origin master)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ git ls-remote origin master
|
||||
7abeca2bd7df910ac546e06a62c128a40f56874a refs/heads/master
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### => [Session de travail avec git](git-session.md) <=
|
||||
|
||||
#### => [Synchroniser 2 dépôts (--bare)](sync-repo.md) <=
|
||||
|
||||
@@ -6,12 +6,20 @@ https://gitea.io/en-us/
|
||||
|
||||
|
||||
|
||||
#### Installer Gitea
|
||||
#### Installer Gitea sur Synology:
|
||||
|
||||
IL faut créer le paquet Gitea:
|
||||
Il faut créer le paquet Gitea:
|
||||
|
||||
https://github.com/flipswitchingmonkey/gitea-spk
|
||||
|
||||
Pour DSM7, le paquet est dispo sur le repo SynoCommunity:
|
||||
|
||||
https://github.com/SynoCommunity/spksrc/pull/5028
|
||||
|
||||
#### Installer Gitea depuis les binaires:
|
||||
|
||||
https://docs.gitea.io/en-us/install-from-binary/#recommended-server-configuration
|
||||
|
||||
|
||||
|
||||
#### Importer un repo local dans Gitea:
|
||||
|
||||
88
docs/Divers/git/github.md
Normal file
@@ -0,0 +1,88 @@
|
||||
# GitHub
|
||||
|
||||
|
||||
|
||||
### Cloner juste un sous-dossier d'un repo:
|
||||
|
||||
```bash
|
||||
~/Documents $ git init vegas
|
||||
|
||||
~/Documents
|
||||
$ cd vegas
|
||||
drwxr-xr-x@ - bruno staff 17 nov 16:14 17 nov 16:14 -I .git/
|
||||
|
||||
~/Documents/vegas master
|
||||
$ git remote add origin https://github.com/jaysalvat/vegas.git
|
||||
|
||||
~/Documents/vegas master
|
||||
$ git config core.sparsecheckout true
|
||||
|
||||
~/Documents/vegas master
|
||||
$ echo "dist/*" >> .git/info/sparse-checkout
|
||||
|
||||
~/Documents/vegas master
|
||||
$ git pull --depth=1 origin master
|
||||
remote: Enumerating objects: 56, done.
|
||||
remote: Counting objects: 100% (56/56), done.
|
||||
remote: Compressing objects: 100% (41/41), done.
|
||||
remote: Total 56 (delta 16), reused 39 (delta 14), pack-reused 0
|
||||
Dépaquetage des objets: 100% (56/56), 89.72 Kio | 1.91 Mio/s, fait.
|
||||
Depuis https://github.com/jaysalvat/vegas
|
||||
* branch master -> FETCH_HEAD
|
||||
* [nouvelle branche] master -> origin/master
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Récupérer un sous-dossier d'un repo:
|
||||
|
||||
```bash
|
||||
$ svn export --force https://github.com/jaysalvat/vegas/trunk/dist
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Télécharger la dernière release:
|
||||
|
||||
```bash
|
||||
$ wget -O vegas.zip https://github.com/jaysalvat/vegas/archive/refs/heads/master.zip
|
||||
```
|
||||
|
||||
|
||||
|
||||
Dernier tag d'un repo:
|
||||
|
||||
```bash
|
||||
$ curl -s 'https://github.com/go-gitea/gitea/tags/'|grep -Eo "$Version v[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}"|sort -r|head -n1
|
||||
v1.22.0
|
||||
|
||||
$ curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/go-gitea/gitea/tags | jq -r '.[0].name'
|
||||
v1.22.0-dev
|
||||
|
||||
```
|
||||
|
||||
Récupérer tous les tags d'un repo:
|
||||
|
||||
```bash
|
||||
$ curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/go-gitea/gitea/tags | jq -r '.'
|
||||
[
|
||||
{
|
||||
"name": "v1.22.0-dev",
|
||||
"zipball_url": "https://api.github.com/repos/go-gitea/gitea/zipball/refs/tags/v1.22.0-dev",
|
||||
"tarball_url": "https://api.github.com/repos/go-gitea/gitea/tarball/refs/tags/v1.22.0-dev",
|
||||
"commit": {
|
||||
"sha": "d7f73a1334ab7a97d4e055b7c58cdd9ac303f77a",
|
||||
"url": "https://api.github.com/repos/go-gitea/gitea/commits/d7f73a1334ab7a97d4e055b7c58cdd9ac303f77a"
|
||||
},
|
||||
"node_id": "MDM6UmVmNzI0OTU1Nzk6cmVmcy90YWdzL3YxLjIyLjAtZGV2"
|
||||
},
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
$ curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/go-gitea/gitea/releases/latest | jq -r '.'
|
||||
```
|
||||
|
||||
@@ -83,6 +83,16 @@ GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmess
|
||||
|
||||
|
||||
|
||||
### Installer une application:
|
||||
|
||||
```bash
|
||||
GO111MODULE=on go install github.com/olivere/iterm2-imagetools/cmd/imgcat@latest
|
||||
|
||||
GO111MODULE=on go install github.com/olivere/iterm2-imagetools/cmd/imgls@latest
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Créer une application:
|
||||
|
||||
Dans le dossier **src**, créer un nouveau dossier pour l'application **hello**:
|
||||
|
||||
9
docs/Divers/iTerm2.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# iTerm2
|
||||
|
||||
|
||||
|
||||
### Afficher des images dans iTerm:
|
||||
|
||||
https://iterm2.com/documentation-images.html
|
||||
|
||||
https://github.com/olivere/iterm2-imagetools
|
||||
445
docs/Divers/images/avif.md
Normal file
@@ -0,0 +1,445 @@
|
||||
# avif
|
||||
|
||||
|
||||
|
||||
<u>Convertisseur:</u>
|
||||
|
||||
- squoosh-cli
|
||||
|
||||
- avif-cli
|
||||
- cavif-rs
|
||||
- sharp
|
||||
- [avif.io](https://avif.io/)
|
||||
- [squoosh](https://squoosh.app/)
|
||||
- [XnConvert](https://www.xnview.com/fr/xnconvert/)
|
||||
- libheif
|
||||
- avifenc
|
||||
- go-avif
|
||||
- AVIFQuickLook
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### [squoosh-cli](https://www.npmjs.com/package/@squoosh/cli)
|
||||
|
||||
Supporte mozjpeg, webp, avif, jxl, wp2
|
||||
|
||||
Les options sont visibles dans [codecs.ts](https://github.com/GoogleChromeLabs/squoosh/blob/dev/libsquoosh/src/codecs.ts)
|
||||
|
||||
#### Installation:
|
||||
|
||||
```bash
|
||||
$ npm i -g @squoosh/cli
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Usage:
|
||||
|
||||
```bash
|
||||
Usage: squoosh-cli [options] <files...>
|
||||
|
||||
Options:
|
||||
-d, --output-dir <dir> Output directory (default: ".")
|
||||
-s, --suffix <suffix> Append suffix to output files (default: "")
|
||||
--max-optimizer-rounds <rounds> Maximum number of compressions to use for auto optimizations (default: "6")
|
||||
--optimizer-butteraugli-target <butteraugli distance> Target Butteraugli distance for auto optimizer (default: "1.4")
|
||||
--resize [config] Resize the image before compressing
|
||||
--quant [config] Reduce the number of colors used (aka. paletting)
|
||||
--rotate [config] Rotate image
|
||||
--mozjpeg [config] Use MozJPEG to generate a .jpg file with the given configuration
|
||||
--webp [config] Use WebP to generate a .webp file with the given configuration
|
||||
--avif [config] Use AVIF to generate a .avif file with the given configuration
|
||||
--jxl [config] Use JPEG-XL to generate a .jxl file with the given configuration
|
||||
--wp2 [config] Use WebP2 to generate a .wp2 file with the given configuration
|
||||
--oxipng [config] Use OxiPNG to generate a .png file with the given configuration
|
||||
-h, --help display help for command
|
||||
```
|
||||
|
||||
```bash
|
||||
$ squoosh-cli --webp true -d webp ./2022-04-28_Biche_8247_8b.png
|
||||
1/1 ✔ Squoosh results:
|
||||
./2022-04-28_Biche_8247_8b.png: 2.18MB
|
||||
└ webp/2022-04-28_Biche_8247_8b.webp → 75.00KB (3.37%)
|
||||
```
|
||||
|
||||
```bash
|
||||
$ squoosh-cli --output-dir 'squoosh-cli' --mozjpeg '{
|
||||
"quality":70,
|
||||
"baseline":false,
|
||||
"arithmetic":false,
|
||||
"progressive":true,
|
||||
"op timize_coding":true,
|
||||
"smoothing":0,
|
||||
"color_space":3,
|
||||
"quant_table":3,
|
||||
"trellis_multipass":false,
|
||||
"trellis_opt_zero":false,
|
||||
"trellis_opt_table":false,
|
||||
"trellis_loops":1,
|
||||
"auto_subsample":true,
|
||||
"chroma_sub sample":2,
|
||||
"separate_chroma_quality":false,
|
||||
"chroma_quality":75
|
||||
}' png/2022-04-16_Brocard_8990_8b.png
|
||||
|
||||
1/1 ✔ Squoosh results:
|
||||
2022-04-16_Brocard_8990_8b.png: 1.93MB
|
||||
└ 2022-04-16_Brocard_8990_8b.jpg → 83.67KB (4.24%)
|
||||
```
|
||||
|
||||
```bash
|
||||
find . -name "*.jpg" -exec bash -c 'file="{}"; squoosh-cli --mozjpeg auto "$file"' \;
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ squoosh-cli --output-dir 'squoosh-cli' --avif '{
|
||||
"cqLevel":33,
|
||||
"cqAlphaLevel":-1,
|
||||
"denoiseLevel":0,
|
||||
"tileColsLog2":0,
|
||||
"tileRowsLog2":0,
|
||||
"speed":6,
|
||||
"subsample":1,
|
||||
"chromaDeltaQ":false,
|
||||
"sharpness":0,
|
||||
"tune":0
|
||||
}' png/*.png
|
||||
|
||||
$ squoosh-cli --output-dir 'squoosh-cli' --avif "{}" png/*.png
|
||||
```
|
||||
|
||||
|
||||
|
||||
### ImageMagick
|
||||
|
||||
Mettre des options avec [define](https://imagemagick.org/script/defines.php).
|
||||
|
||||
#### Usage:
|
||||
|
||||
```bash
|
||||
❯ magick -quality 75 png/2022-04-16_Brocard_8990_8b.png magick/2022-04-16_Brocard_8990_8b.avif
|
||||
|
||||
❯ magick -define heic:speed=2 png/2022-04-16_Brocard_8990_8b.png magick/2022-04-16_Brocard_8990_8b_2.avif
|
||||
|
||||
❯ convert -define heic:speed=2 png/2022-04-16_Brocard_8990_8b.png magick/2022-04-16_Brocard_8990_8b_2.avif
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ for image in png/*.png ; do convert "$image" "${image%.*}.avif" ; done
|
||||
```
|
||||
|
||||
|
||||
|
||||
### [avif-cli](https://github.com/lovell/avif-cli)
|
||||
|
||||
#### Installation:
|
||||
|
||||
```bash
|
||||
$ npm install avif
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Usage:
|
||||
|
||||
```bash
|
||||
❯ npx avif --input="5_2019.jpg" --quality=70
|
||||
|
||||
❯ npx avif --input="**/*.{png}" --output="./avif-cli" --quality=70
|
||||
```
|
||||
|
||||
```bash
|
||||
#!/bin/sh
|
||||
set -o noglob
|
||||
IFS=$'\n'
|
||||
|
||||
quality=70
|
||||
#quality='lossless'
|
||||
images=$(find ./png -type f -name *.png)
|
||||
|
||||
for img in $images; do
|
||||
file=$(basename "$img")
|
||||
avif_out="avif-cli"
|
||||
|
||||
#webp_out=$img.webp
|
||||
|
||||
if [ ! -f $avif_out ]; then
|
||||
if [ "$quality" != "lossless" ]; then
|
||||
npx avif --input="$img" --output="./$avif_out" --quality=$quality
|
||||
else
|
||||
npx avif --input="$img" --output="./$avif_out" --lossless
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
|
||||
### [cavif-rs](https://github.com/kornelski/cavif-rs)
|
||||
|
||||
Convert JPEG/PNG images to AVIF image format (based on AV1/rav1e)
|
||||
|
||||
#### Installation:
|
||||
|
||||
```bash
|
||||
$ cargo install cavif
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Usage:
|
||||
|
||||
```bash
|
||||
❯ cavif --quality 90 2022-04-16_Brocard_8990_8b.png
|
||||
2022-04-16_Brocard_8990_8b.avif: 524KB (522893B color, 0B alpha, 242B HEIF)
|
||||
```
|
||||
|
||||
```bash
|
||||
#!/bin/sh
|
||||
set -o noglob
|
||||
IFS=$'\n'
|
||||
|
||||
quality=70
|
||||
images=$(find ./png -type f -name *.png)
|
||||
|
||||
for img in $images; do
|
||||
file=$(basename "$img")
|
||||
avif_out="cavif/${file%.*}_q$quality.avif"
|
||||
|
||||
if [ ! -f $avif_out ]; then
|
||||
cavif --quality $quality $img -o $avif_out
|
||||
fi
|
||||
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
|
||||
### [sharp](https://sharp.pixelplumbing.com)
|
||||
|
||||
#### Installation:
|
||||
|
||||
```bash
|
||||
$ npm install sharp
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Usage:
|
||||
|
||||
sharp-example.js
|
||||
|
||||
```javascript
|
||||
const sharp = require('sharp')
|
||||
|
||||
const convertToAVIF = () => {
|
||||
sharp('path_to_image')
|
||||
.toFormat('avif', {palette: true})
|
||||
.toFile(__dirname + 'path_to_output_image')
|
||||
}
|
||||
|
||||
convertToAVIF()
|
||||
```
|
||||
|
||||
```bash
|
||||
# path_to_image : ./imgs/example.jpg
|
||||
# path_to_output_image : /sharp-compressed/compressed-example.avif
|
||||
|
||||
$ node sharp-example.js
|
||||
```
|
||||
|
||||
|
||||
|
||||
### [libheif](https://github.com/strukturag/libheif)
|
||||
|
||||
libheif is an ISO/IEC 23008-12:2017 HEIF and AVIF (AV1 Image File Format) file format decoder and encoder.
|
||||
|
||||
#### Installation:
|
||||
|
||||
```bash
|
||||
|
||||
./autogen.sh
|
||||
./configure
|
||||
go env -w GO111MODULE=off
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Usage:
|
||||
|
||||
```bash
|
||||
❯ heif-enc 2022-04-28_Biche_8247_8b.png -A -o 2022-04-28_Biche_8247_8b_3.avif
|
||||
libpng warning: iCCP: known incorrect sRGB profile
|
||||
|
||||
❯ heif-enc 2022-04-28_Biche_8247_8b.png -A -L -p chroma=444 --matrix_coefficients=0 -o 2022-04-28_Biche_8247_8b_3.avif (lossless)
|
||||
libpng warning: iCCP: known incorrect sRGB profile
|
||||
```
|
||||
|
||||
```bash
|
||||
# Paramètres par défaut
|
||||
|
||||
❯ heif-enc -P
|
||||
Parameters for encoder `x265 HEVC encoder (3.4+31-6722fce1f)`:
|
||||
quality, default=50, [0;100]
|
||||
lossless, default=false
|
||||
preset, default=slow, { ultrafast,superfast,veryfast,faster,fast,medium,slow,slower,veryslow,placebo }
|
||||
tune, default=ssim, { psnr,ssim,grain,fastdecode }
|
||||
tu-intra-depth, default=2, [1;4]
|
||||
complexity, [0;100]
|
||||
chroma, default=420, { 420,422,444 }
|
||||
```
|
||||
|
||||
```bash
|
||||
#!/bin/sh
|
||||
set -o noglob
|
||||
IFS=$'\n'
|
||||
|
||||
#quality=70
|
||||
quality='lossless'
|
||||
images=$(find ./png -type f -name *.png)
|
||||
|
||||
for img in $images; do
|
||||
file=$(basename "$img")
|
||||
avif_out="heif-enc/${file%.*}_q$quality.avif"
|
||||
|
||||
#webp_out=$img.webp
|
||||
|
||||
if [ ! -f $avif_out ]; then
|
||||
if [ "$quality" != "lossless" ]; then
|
||||
heif-enc "$img" -A -q $quality -o "$avif_out"
|
||||
else
|
||||
heif-enc "$img" -A -L -p chroma=444 --matrix_coefficients=0 -o "$avif_out"
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
|
||||
### avifenc
|
||||
|
||||
https://web.dev/compress-images-avif/
|
||||
|
||||
x64
|
||||
|
||||
#### Installation:
|
||||
|
||||
```bash
|
||||
$ brew install joedrago/repo/avifenc
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Usage:
|
||||
|
||||
```bash
|
||||
$ avifenc --max 63 image.jpg image.avif
|
||||
```
|
||||
|
||||
|
||||
|
||||
### avifenc (libavif)
|
||||
|
||||
#### Installation:
|
||||
|
||||
```bash
|
||||
$ brew install libavif
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Usage:
|
||||
|
||||
```bash
|
||||
❯ avifenc --min 0 --max 63 -a end-usage=q -a cq-level=18 -a tune=ssim png/2022-04-16_Brocard_8990_8b.png avifenc/2022-04-16_Brocard_8990_8b.avif
|
||||
```
|
||||
|
||||
```bash
|
||||
# 8 thread
|
||||
|
||||
❯ avifenc --min 0 --max 63 -a end-usage=q -a cq-level=18 -a tune=ssim --jobs 8 png/2022-04-16_Brocard_8990_8b.png avifenc/2022-04-16_Brocard_8990_8b.avif
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ avifenc --speed 0 --min 25 --max 35 png/2022-04-16_Brocard_8990_8b.png avifenc/2022-04-16_Brocard_8990_8b.avif
|
||||
libpng warning: iCCP: known incorrect sRGB profile
|
||||
Successfully loaded: png/2022-04-16_Brocard_8990_8b.png
|
||||
AVIF to be written: (Lossy)
|
||||
* Resolution : 1600x1067
|
||||
* Bit Depth : 8
|
||||
* Format : YUV444
|
||||
* Alpha : Not premultiplied
|
||||
* Range : Full
|
||||
* Color Primaries: 2
|
||||
* Transfer Char. : 2
|
||||
* Matrix Coeffs. : 6
|
||||
* ICC Profile : Present (3144 bytes)
|
||||
* XMP Metadata : Absent (0 bytes)
|
||||
* EXIF Metadata : Absent (0 bytes)
|
||||
* Transformations: None
|
||||
* Progressive : Unavailable
|
||||
Encoding with AV1 codec 'aom' speed [0], color QP [25 (Medium) <-> 35 (Low)], alpha QP [0 (Lossless) <-> 0 (Lossless)], tileRowsLog2 [0], tileColsLog2 [0], 1 worker thread(s), please wait...
|
||||
Encoded successfully.
|
||||
* Color AV1 total size: 70133 bytes
|
||||
* Alpha AV1 total size: 0 bytes
|
||||
Wrote AVIF: avifenc/2022-04-16_Brocard_8990_8b.avif
|
||||
```
|
||||
|
||||
```bash
|
||||
#!/bin/sh
|
||||
set -o noglob
|
||||
IFS=$'\n'
|
||||
|
||||
#quality=70
|
||||
quality='lossless'
|
||||
images=$(find ./png -type f -name *.png)
|
||||
|
||||
for img in $images; do
|
||||
file=$(basename "$img")
|
||||
avif_out="avifenc/${file%.*}_q$quality.avif"
|
||||
|
||||
#webp_out=$img.webp
|
||||
|
||||
if [ ! -f $avif_out ]; then
|
||||
if [ "$quality" != "lossless" ]; then
|
||||
#npx avif --input="$img" --output="./$avif_out" --quality=$quality
|
||||
avifenc --min 0 --max 63 -a end-usage=q -a cq-level=18 -a tune=ssim --jobs 8 $img $avif_out
|
||||
else
|
||||
#npx avif --input="$img" --output="./$avif_out" --lossless
|
||||
avifenc -l --jobs 8 $img $avif_out
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
|
||||
### [go-avif](https://github.com/Kagami/go-avif)
|
||||
|
||||
go-avif implements AVIF (AV1 Still Image File Format) encoder for Go using libaom, the high quality AV1 codec.
|
||||
x64
|
||||
|
||||
|
||||
|
||||
### [AVIFQuickLook](https://github.com/dreampiggy/AVIFQuickLook)
|
||||
|
||||
|
||||
|
||||
### Bench
|
||||
|
||||
Conversion de 70 PNG 8bits:
|
||||
|
||||
| avif-cli | avifenc (libavif) | cavif | heif-enc (libheif) | squoosh-cli | |
|
||||
| -------- | ----------------- | ----- | ------------------ | ----------- | ---- |
|
||||
| 148s | 23s | 183s | 92s | 107s | |
|
||||
|
||||
511
docs/Divers/images/exif.md
Normal file
@@ -0,0 +1,511 @@
|
||||
# exif
|
||||
|
||||
|
||||
|
||||
### Supprimer les exifs:
|
||||
|
||||
#### Avec exiv2:
|
||||
|
||||
```bash
|
||||
# exiv2
|
||||
|
||||
exiv2 rm 12-2017.jpg
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Avec exiftool:
|
||||
|
||||
```bash
|
||||
# Crée une copie de l'original (12_2017-2.jpg_original)
|
||||
|
||||
exiftool -all= 12_2017-2.jpg
|
||||
Warning: ICC_Profile deleted. Image colors may be affected - 12_2017-2.jpg
|
||||
1 image files updated
|
||||
|
||||
|
||||
# Sans backup
|
||||
|
||||
exiftool -overwrite_original -all= 12_2017-2.jpg_original
|
||||
Warning: ICC_Profile deleted. Image colors may be affected - 12_2017-2.jpg_original
|
||||
1 image files updated
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Voir les exifs:
|
||||
|
||||
Afficher tous les tags que exiftool reconnait:
|
||||
|
||||
```bash
|
||||
$ exiftool -list
|
||||
Available tags:
|
||||
A100DataOffset AAFManufacturerID ABDate ABLabel ABRelatedNames AB_UID
|
||||
ACoordOfBottomRightCorner ACoordOfTopRightCorner ADJDebugInfo
|
||||
ADLBracketingStep ADLBracketingType AEAperture AEApertureSteps AEBAutoCancel
|
||||
AEBBracketValue AEBSequence AEBSequenceAutoCancel AEBShotCount AEBXv
|
||||
AEBracketingSteps AECAggressiveness AECCurrentExpIndex AECCurrentSensorLuma
|
||||
.../...
|
||||
Command-line shortcuts:
|
||||
AllDates Canon ColorSpaceTags Common CommonIFD0 LargeTags MakerNotes Nikon
|
||||
Unsafe ls-l
|
||||
|
||||
$ exiftool -list | grep Keyword
|
||||
AppleDataOffsets AppleKeywords AppleMailDateReceived AppleMailDateSent
|
||||
ArchivedFileName Arranger ArrangerKeywords ArtDirector ArtFilter
|
||||
ComponentsInSequence Composer ComposerKeywords ComposerSortOrder Composers
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
AllDates:
|
||||
|
||||
```bash
|
||||
$ exiftool -AllDates 2022-08-12_Chevreuils_6405.jpg
|
||||
Date/Time Original : 2022:08:12 19:55:01
|
||||
Create Date : 2022:08:12 19:55:01
|
||||
Modify Date : 2022:08:14 21:05:21
|
||||
```
|
||||
|
||||
Canon:
|
||||
|
||||
```bash
|
||||
$ exiftool -Canon 2022-08-12_Chevreuils_6405.jpg
|
||||
File Name : 2022-08-12_Chevreuils_6405.jpg
|
||||
Camera Model Name : Canon EOS R6
|
||||
Date/Time Original : 2022:08:12 19:55:01
|
||||
Shutter Speed : 1/1250
|
||||
Aperture : 4.0
|
||||
Metering Mode : Multi-segment
|
||||
Exposure Compensation : +4/3
|
||||
ISO : 320
|
||||
Lens : EF600mm f/4L IS III USM
|
||||
Focal Length : 600.0 mm
|
||||
Image Size : 1600x1067
|
||||
Flash : No Flash
|
||||
White Balance : Manual
|
||||
Sharpness : 40
|
||||
Saturation : +6
|
||||
Color Space : sRGB
|
||||
File Size : 335 kB
|
||||
Serial Number : 083021004471
|
||||
```
|
||||
|
||||
Common:
|
||||
|
||||
```bash
|
||||
$ exiftool -Common 2022-08-12_Chevreuils_6405.jpg
|
||||
File Name : 2022-08-12_Chevreuils_6405.jpg
|
||||
File Size : 335 kB
|
||||
Camera Model Name : Canon EOS R6
|
||||
Date/Time Original : 2022:08:12 19:55:01
|
||||
Image Size : 1600x1067
|
||||
Focal Length : 600.0 mm
|
||||
Shutter Speed : 1/1250
|
||||
Aperture : 4.0
|
||||
ISO : 320
|
||||
White Balance : Manual
|
||||
Flash : No Flash
|
||||
```
|
||||
|
||||
CommonIFD0:
|
||||
|
||||
```bash
|
||||
$ exiftool -CommonIFD0 2022-08-12_Chevreuils_6405.jpg
|
||||
Make : Canon
|
||||
Camera Model Name : Canon EOS R6
|
||||
Software : Adobe Photoshop Lightroom Classic 11.4.1 (Macintosh)
|
||||
Modify Date : 2022:08:14 21:05:21
|
||||
Artist : Pesenti
|
||||
Copyright : clicclac.info
|
||||
```
|
||||
|
||||
LargeTags:
|
||||
|
||||
```bash
|
||||
$ exiftool -LargeTags 2022-08-12_Chevreuils_6405.jpg
|
||||
EXIF : (Binary data 20300 bytes, use -b option to extract)
|
||||
ICC Profile : (Binary data 3144 bytes, use -b option to extract)
|
||||
IPTC : (Binary data 192 bytes, use -b option to extract)
|
||||
Thumbnail Image : (Binary data 19320 bytes, use -b option to extract)
|
||||
XMP : (Binary data 13314 bytes, use -b option to extract)
|
||||
```
|
||||
|
||||
ls-l:
|
||||
|
||||
```bash
|
||||
$ exiftool -ls-l 2022-08-12_Chevreuils_6405.jpg
|
||||
File Permissions : -rw-r--r--
|
||||
File Hard Links : 1
|
||||
File User ID : bruno
|
||||
File Group ID : staff
|
||||
File Size : 334966
|
||||
File Modification Date/Time : 2022:08:14 21:05:22+02:00
|
||||
File Name : 2022-08-12_Chevreuils_6405.jpg
|
||||
```
|
||||
|
||||
Sans option:
|
||||
|
||||
```bash
|
||||
$ exiftool 2022-08-12_Chevreuils_6405.jpg
|
||||
ExifTool Version Number : 12.42
|
||||
File Name : 2022-08-12_Chevreuils_6405.jpg
|
||||
Directory : .
|
||||
File Size : 335 kB
|
||||
File Modification Date/Time : 2022:08:14 21:05:22+02:00
|
||||
File Access Date/Time : 2022:08:15 08:56:12+02:00
|
||||
File Inode Change Date/Time : 2022:08:15 08:56:10+02:00
|
||||
File Permissions : -rw-r--r--
|
||||
File Type : JPEG
|
||||
File Type Extension : jpg
|
||||
MIME Type : image/jpeg
|
||||
Exif Byte Order : Little-endian (Intel, II)
|
||||
Make : Canon
|
||||
Camera Model Name : Canon EOS R6
|
||||
X Resolution : 72
|
||||
Y Resolution : 72
|
||||
Resolution Unit : inches
|
||||
Software : Adobe Photoshop Lightroom Classic 11.4.1 (Macintosh)
|
||||
Modify Date : 2022:08:14 21:05:21
|
||||
Artist : Pesenti
|
||||
Copyright : clicclac.info
|
||||
Exposure Time : 1/1250
|
||||
F Number : 4.0
|
||||
Exposure Program : Shutter speed priority AE
|
||||
ISO : 320
|
||||
Sensitivity Type : Recommended Exposure Index
|
||||
Recommended Exposure Index : 320
|
||||
Exif Version : 0231
|
||||
Date/Time Original : 2022:08:12 19:55:01
|
||||
Create Date : 2022:08:12 19:55:01
|
||||
Offset Time : +02:00
|
||||
Offset Time Original : +02:00
|
||||
Offset Time Digitized : +02:00
|
||||
Shutter Speed Value : 1/1250
|
||||
Aperture Value : 4.0
|
||||
Exposure Compensation : +4/3
|
||||
Max Aperture Value : 4.2
|
||||
Metering Mode : Multi-segment
|
||||
Flash : No Flash
|
||||
Focal Length : 600.0 mm
|
||||
Sub Sec Time Original : 29
|
||||
Sub Sec Time Digitized : 29
|
||||
Color Space : sRGB
|
||||
Focal Plane X Resolution : 1520
|
||||
Focal Plane Y Resolution : 1520
|
||||
Focal Plane Resolution Unit : cm
|
||||
Custom Rendered : Normal
|
||||
Exposure Mode : Auto
|
||||
White Balance : Manual
|
||||
Scene Capture Type : Standard
|
||||
Serial Number : 083021004471
|
||||
Lens Info : 600mm f/?
|
||||
Lens Model : EF600mm f/4L IS III USM
|
||||
Lens Serial Number : 7110000203
|
||||
Compression : JPEG (old-style)
|
||||
Thumbnail Offset : 992
|
||||
Thumbnail Length : 19320
|
||||
Displayed Units X : inches
|
||||
Displayed Units Y : inches
|
||||
Current IPTC Digest : 118667209c5b6206903e30011744a4a4
|
||||
Coded Character Set : UTF8
|
||||
Application Record Version : 4
|
||||
Keywords : accouplement, brocard, capreolus capreolus, chevrette, chevreuil, rut
|
||||
Time Created : 19:55:01+02:00
|
||||
Digital Creation Date : 2022:08:12
|
||||
Digital Creation Time : 19:55:01+02:00
|
||||
By-line : Pesenti
|
||||
Copyright Notice : clicclac.info
|
||||
Copyright Flag : True
|
||||
Photoshop Thumbnail : (Binary data 19320 bytes, use -b option to extract)
|
||||
IPTC Digest : 118667209c5b6206903e30011744a4a4
|
||||
Profile CMM Type : Linotronic
|
||||
Profile Version : 2.1.0
|
||||
Profile Class : Display Device Profile
|
||||
Color Space Data : RGB
|
||||
Profile Connection Space : XYZ
|
||||
Profile Date Time : 1998:02:09 06:49:00
|
||||
Profile File Signature : acsp
|
||||
Primary Platform : Microsoft Corporation
|
||||
CMM Flags : Not Embedded, Independent
|
||||
Device Manufacturer : Hewlett-Packard
|
||||
Device Model : sRGB
|
||||
Device Attributes : Reflective, Glossy, Positive, Color
|
||||
Rendering Intent : Perceptual
|
||||
Connection Space Illuminant : 0.9642 1 0.82491
|
||||
Profile Creator : Hewlett-Packard
|
||||
Profile ID : 0
|
||||
Profile Copyright : Copyright (c) 1998 Hewlett-Packard Company
|
||||
Profile Description : sRGB IEC61966-2.1
|
||||
Media White Point : 0.95045 1 1.08905
|
||||
Media Black Point : 0 0 0
|
||||
Red Matrix Column : 0.43607 0.22249 0.01392
|
||||
Green Matrix Column : 0.38515 0.71687 0.09708
|
||||
Blue Matrix Column : 0.14307 0.06061 0.7141
|
||||
Device Mfg Desc : IEC http://www.iec.ch
|
||||
Device Model Desc : IEC 61966-2.1 Default RGB colour space - sRGB
|
||||
Viewing Cond Desc : Reference Viewing Condition in IEC61966-2.1
|
||||
Viewing Cond Illuminant : 19.6445 20.3718 16.8089
|
||||
Viewing Cond Surround : 3.92889 4.07439 3.36179
|
||||
Viewing Cond Illuminant Type : D50
|
||||
Luminance : 76.03647 80 87.12462
|
||||
Measurement Observer : CIE 1931
|
||||
Measurement Backing : 0 0 0
|
||||
Measurement Geometry : Unknown
|
||||
Measurement Flare : 0.999%
|
||||
Measurement Illuminant : D65
|
||||
Technology : Cathode Ray Tube Display
|
||||
Red Tone Reproduction Curve : (Binary data 2060 bytes, use -b option to extract)
|
||||
Green Tone Reproduction Curve : (Binary data 2060 bytes, use -b option to extract)
|
||||
Blue Tone Reproduction Curve : (Binary data 2060 bytes, use -b option to extract)
|
||||
XMP Toolkit : Adobe XMP Core 7.0-c000 1.000000, 0000/00/00-00:00:00
|
||||
Metadata Date : 2022:08:14 21:05:21+02:00
|
||||
Rating : 4
|
||||
Label : Selection
|
||||
Creator Tool : Adobe Photoshop Lightroom Classic 11.4.1 (Macintosh)
|
||||
Format : image/jpeg
|
||||
Lens : EF600mm f/4L IS III USM
|
||||
Image Number : 0
|
||||
Approximate Focus Distance : 46.1
|
||||
Flash Compensation : 0
|
||||
Firmware : 1.5.2
|
||||
Distortion Correction Already Applied: True
|
||||
Lateral Chromatic Aberration Correction Already Applied: True
|
||||
Vignette Correction Already Applied: True
|
||||
Date Created : 2022:08:12 19:55:01.29+02:00
|
||||
Document ID : xmp.did:3de77c21-df1e-4bd1-9559-2cf2841fbb35
|
||||
Preserved File Name : IMG_6405.CR3
|
||||
Original Document ID : C63EBF3F8F3BED8866DB0BDC4A24F281
|
||||
Instance ID : xmp.iid:3de77c21-df1e-4bd1-9559-2cf2841fbb35
|
||||
Marked : True
|
||||
Raw File Name : 2022-08-12_Chevreuils_6405.CR3
|
||||
Version : 14.4.1
|
||||
Process Version : 11.0
|
||||
Color Temperature : 6050
|
||||
Tint : +4
|
||||
Exposure 2012 : +1.50
|
||||
Contrast 2012 : 0
|
||||
Highlights 2012 : +13
|
||||
Shadows 2012 : +8
|
||||
Whites 2012 : +12
|
||||
Blacks 2012 : 0
|
||||
Texture : +13
|
||||
Clarity 2012 : +16
|
||||
Dehaze : 0
|
||||
Vibrance : +9
|
||||
Saturation : +6
|
||||
Parametric Shadows : 0
|
||||
Parametric Darks : 0
|
||||
Parametric Lights : 0
|
||||
Parametric Highlights : 0
|
||||
Parametric Shadow Split : 25
|
||||
Parametric Midtone Split : 50
|
||||
Parametric Highlight Split : 75
|
||||
Sharpness : 40
|
||||
Sharpen Radius : +1.0
|
||||
Sharpen Detail : 25
|
||||
Sharpen Edge Masking : 0
|
||||
Luminance Smoothing : 0
|
||||
Color Noise Reduction : 25
|
||||
Color Noise Reduction Detail : 50
|
||||
Color Noise Reduction Smoothness: 50
|
||||
Hue Adjustment Red : 0
|
||||
Hue Adjustment Orange : 0
|
||||
Hue Adjustment Yellow : 0
|
||||
Hue Adjustment Green : 0
|
||||
Hue Adjustment Aqua : 0
|
||||
Hue Adjustment Blue : 0
|
||||
Hue Adjustment Purple : 0
|
||||
Hue Adjustment Magenta : 0
|
||||
Saturation Adjustment Red : 0
|
||||
Saturation Adjustment Orange : 0
|
||||
Saturation Adjustment Yellow : 0
|
||||
Saturation Adjustment Green : 0
|
||||
Saturation Adjustment Aqua : 0
|
||||
Saturation Adjustment Blue : 0
|
||||
Saturation Adjustment Purple : 0
|
||||
Saturation Adjustment Magenta : 0
|
||||
Luminance Adjustment Red : 0
|
||||
Luminance Adjustment Orange : 0
|
||||
Luminance Adjustment Yellow : 0
|
||||
Luminance Adjustment Green : 0
|
||||
Luminance Adjustment Aqua : 0
|
||||
Luminance Adjustment Blue : 0
|
||||
Luminance Adjustment Purple : 0
|
||||
Luminance Adjustment Magenta : 0
|
||||
Split Toning Shadow Hue : 0
|
||||
Split Toning Shadow Saturation : 0
|
||||
Split Toning Highlight Hue : 0
|
||||
Split Toning Highlight Saturation: 0
|
||||
Split Toning Balance : 0
|
||||
Color Grade Midtone Hue : 0
|
||||
Color Grade Midtone Sat : 0
|
||||
Color Grade Shadow Lum : 0
|
||||
Color Grade Midtone Lum : 0
|
||||
Color Grade Highlight Lum : 0
|
||||
Color Grade Blending : 50
|
||||
Color Grade Global Hue : 0
|
||||
Color Grade Global Sat : 0
|
||||
Color Grade Global Lum : 0
|
||||
Auto Lateral CA : 1
|
||||
Lens Profile Enable : 1
|
||||
Lens Manual Distortion Amount : 0
|
||||
Vignette Amount : 0
|
||||
Defringe Purple Amount : 0
|
||||
Defringe Purple Hue Lo : 30
|
||||
Defringe Purple Hue Hi : 70
|
||||
Defringe Green Amount : 0
|
||||
Defringe Green Hue Lo : 40
|
||||
Defringe Green Hue Hi : 60
|
||||
Perspective Upright : 0
|
||||
Perspective Vertical : 0
|
||||
Perspective Horizontal : 0
|
||||
Perspective Rotate : 0.0
|
||||
Perspective Aspect : 0
|
||||
Perspective Scale : 100
|
||||
Perspective X : 0.00
|
||||
Perspective Y : 0.00
|
||||
Grain Amount : 0
|
||||
Post Crop Vignette Amount : 0
|
||||
Shadow Tint : 0
|
||||
Red Hue : 0
|
||||
Red Saturation : 0
|
||||
Green Hue : 0
|
||||
Green Saturation : 0
|
||||
Blue Hue : 0
|
||||
Blue Saturation : 0
|
||||
Override Look Vignette : False
|
||||
Tone Curve Name 2012 : Custom
|
||||
Camera Profile : Adobe Standard
|
||||
Camera Profile Digest : 441F68BD6BC3369B59256B103CE2CD5C
|
||||
Lens Profile Setup : Custom
|
||||
Lens Profile Name : Adobe (Canon EF 600mm f/4L IS III USM)
|
||||
Lens Profile Filename : Canon (Canon EF 600mm f4L IS III USM) - RAW.lcp
|
||||
Lens Profile Digest : A58C82ECDC77A3A3EAD3EA167A0DED19
|
||||
Lens Profile Is Embedded : False
|
||||
Lens Profile Distortion Scale : 100
|
||||
Lens Profile Vignetting Scale : 100
|
||||
Has Settings : True
|
||||
Crop Top : 0.174748
|
||||
Crop Left : 0
|
||||
Crop Bottom : 1
|
||||
Crop Right : 0.825252
|
||||
Crop Angle : 0
|
||||
Crop Constrain To Warp : 0
|
||||
Has Crop : True
|
||||
Already Applied : True
|
||||
Creator : Pesenti
|
||||
Rights : clicclac.info
|
||||
Subject : accouplement, brocard, capreolus capreolus, chevrette, chevreuil, rut
|
||||
History Action : derived, saved
|
||||
History Parameters : converted from image/x-canon-cr3 to image/jpeg, saved to new location
|
||||
History Instance ID : xmp.iid:3de77c21-df1e-4bd1-9559-2cf2841fbb35
|
||||
History When : 2022:08:14 21:05:21+02:00
|
||||
History Software Agent : Adobe Photoshop Lightroom Classic 11.4.1 (Macintosh)
|
||||
History Changed : /
|
||||
Derived From Document ID : C63EBF3F8F3BED8866DB0BDC4A24F281
|
||||
Derived From Original Document ID: C63EBF3F8F3BED8866DB0BDC4A24F281
|
||||
Weighted Flat Subject : accouplement, brocard, capreolus capreolus, chevrette, chevreuil, rut
|
||||
Tone Curve PV2012 : 0, 0, 31, 42, 56, 88, 191, 208, 255, 255
|
||||
Tone Curve PV2012 Red : 0, 0, 255, 255
|
||||
Tone Curve PV2012 Green : 0, 0, 255, 255
|
||||
Tone Curve PV2012 Blue : 0, 0, 255, 255
|
||||
Look Name : Adobe Color
|
||||
Look Amount : 1
|
||||
Look UUID : B952C231111CD8E0ECCF14B86BAA7077
|
||||
Look Supports Amount : false
|
||||
Look Supports Monochrome : false
|
||||
Look Supports Output Referred : false
|
||||
Look Group : Profiles
|
||||
Look Parameters Version : 14.4.1
|
||||
Look Parameters Process Version : 11.0
|
||||
Look Parameters Convert To Grayscale: False
|
||||
Look Parameters Camera Profile : Adobe Standard
|
||||
Look Parameters Look Table : E1095149FDB39D7A057BAB208837E2E1
|
||||
Look Parameters Tone Curve PV2012: 0, 0, 22, 16, 40, 35, 127, 127, 224, 230, 240, 246, 255, 255
|
||||
Look Parameters Tone Curve PV2012 Red: 0, 0, 255, 255
|
||||
Look Parameters Tone Curve PV2012 Green: 0, 0, 255, 255
|
||||
Look Parameters Tone Curve PV2012 Blue: 0, 0, 255, 255
|
||||
DCT Encode Version : 100
|
||||
APP14 Flags 0 : [14], Encoded with Blend=1 downsampling
|
||||
APP14 Flags 1 : (none)
|
||||
Color Transform : YCbCr
|
||||
Comment : Optimized by JPEGmini 3.18.9.220874607-AV 0xf034c802
|
||||
Image Width : 1600
|
||||
Image Height : 1067
|
||||
Encoding Process : Baseline DCT, Huffman coding
|
||||
Bits Per Sample : 8
|
||||
Color Components : 3
|
||||
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
|
||||
Aperture : 4.0
|
||||
Image Size : 1600x1067
|
||||
Megapixels : 1.7
|
||||
Scale Factor To 35 mm Equivalent: 3.4
|
||||
Shutter Speed : 1/1250
|
||||
Create Date : 2022:08:12 19:55:01.29+02:00
|
||||
Date/Time Original : 2022:08:12 19:55:01.29+02:00
|
||||
Modify Date : 2022:08:14 21:05:21+02:00
|
||||
Thumbnail Image : (Binary data 19320 bytes, use -b option to extract)
|
||||
Date/Time Created : 2022:08:12 19:55:01+02:00
|
||||
Digital Creation Date/Time : 2022:08:12 19:55:01+02:00
|
||||
Circle Of Confusion : 0.009 mm
|
||||
Depth Of Field : 0.41 m (45.90 - 46.31 m)
|
||||
Field Of View : 1.0 deg
|
||||
Focal Length : 600.0 mm (35 mm equivalent: 2051.8 mm)
|
||||
Hyperfocal Distance : 10243.22 m
|
||||
Light Value : 12.6
|
||||
Lens ID : Canon EF 600mm f/4L IS III USM
|
||||
|
||||
```
|
||||
|
||||
Voir les infos GPS:
|
||||
|
||||
```bash
|
||||
# zsh
|
||||
❯ exiftool 12_2017.jpg -'GPS*'
|
||||
|
||||
# bash
|
||||
❯ exiftool 12_2017.jpg -GPS*
|
||||
GPS Version ID : 2.2.0.0
|
||||
GPS Latitude Ref : North
|
||||
GPS Longitude Ref : East
|
||||
GPS Altitude : 0.7094 m
|
||||
GPS Latitude : 43 deg 31' 30.64" N
|
||||
GPS Longitude : 4 deg 38' 15.31" E
|
||||
GPS Position : 43 deg 31' 30.64" N, 4 deg 38' 15.31" E
|
||||
|
||||
```
|
||||
|
||||
Mots-clé:
|
||||
|
||||
```bash
|
||||
$ exiftool -s -Keywords 2022-08-12_Chevreuils_6405.jpg
|
||||
Keywords : accouplement, brocard, capreolus capreolus, chevrette, chevreuil, rut
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
# Supprimer les coord. GPS:
|
||||
|
||||
❯ exiftool -gps:all= 12_2017.jpg
|
||||
1 image files updated
|
||||
|
||||
❯ exiftool 12_2017.jpg -'GPS*'
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
# Restaurer l'original:
|
||||
|
||||
❯ exiftool -restore_original 12_2017.jpg
|
||||
1 image files found
|
||||
1 image files restored from original
|
||||
|
||||
```
|
||||
|
||||
https://adamtheautomator.com/exiftool/
|
||||
16
docs/Divers/images/heic.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# heic
|
||||
|
||||
|
||||
|
||||
### sips (scriptable image processing system)
|
||||
|
||||
```bash
|
||||
$ sips -s format heic -s formatOptions 50 png/2022-04-16_Brocard_8990_8b.png --out sips/2022-04-16_Brocard_8990_8b.heic
|
||||
/Users/bruno/Desktop/avif/png/2022-04-16_Brocard_8990_8b.png
|
||||
/Users/bruno/Desktop/avif/sips/2022-04-16_Brocard_8990_8b.heic
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
heif-enc - convert image to HEIC/HEIF
|
||||
51
docs/Divers/images/mozjpeg.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# mozjpeg
|
||||
|
||||
|
||||
|
||||
### Installation:
|
||||
|
||||
```bash
|
||||
brew install mozjpeg
|
||||
```
|
||||
|
||||
Si libjpeg est déjà installé, cjpeg et jpegtran sont déjà présent. Il faut linker les binaires de mozjpeg:
|
||||
|
||||
```bash
|
||||
ln -s /opt/homebrew/opt/mozjpeg/bin/cjpeg /usr/local/bin/mozcjpeg
|
||||
ln -s /opt/homebrew/opt/mozjpeg/bin/jpegtran /usr/local/bin/mozjpegtran
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Usage:
|
||||
|
||||
**cjpeg** = lossy (avec pertes).
|
||||
|
||||
**cjpeg** accepte les image aux formats JPEG, PNG, BMP et Targa.
|
||||
|
||||
<u>Options:</u>
|
||||
|
||||
- -quality (entre 5 et 95)(défaut 75)
|
||||
- -progressive (par défaut) sinon -baseline
|
||||
- -optimize (par défaut)
|
||||
- -outfile <name>
|
||||
|
||||
|
||||
|
||||
**jpegtran** = lossless (sans pertes).
|
||||
|
||||
**jpegtran** accepte les image au format JPEG.
|
||||
|
||||
<u>Options:</u>
|
||||
|
||||
- -progressive (défaut) sinon -baseline
|
||||
- -optimize (par défaut)
|
||||
- -outfile <name>
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
❯ mozcjpeg 2022-05-10_Cerf_8869-CR3_DxO_DeepPRIME.png > 5_2022.jpg
|
||||
libpng warning: iCCP: known incorrect sRGB profile
|
||||
```
|
||||
|
||||
273
docs/Divers/images/webp.md
Normal file
@@ -0,0 +1,273 @@
|
||||
# webp
|
||||
|
||||
|
||||
|
||||
#### Convertisseurs:
|
||||
|
||||
- Photoshop 23.2 +
|
||||
- XnConvert
|
||||
- WebPShop
|
||||
- [cwebp](#cwebp)
|
||||
- [squoosh-cli](#squoosh)
|
||||
- [ImageMagick](#ImageMagick)
|
||||
- WebpConvert
|
||||
|
||||
|
||||
|
||||
### <a id="cwebp"></a>cwebp
|
||||
|
||||
Doc: https://developers.google.com/speed/webp/docs/cwebp
|
||||
|
||||
App: https://developers.google.com/speed/webp/docs/precompiled
|
||||
|
||||
#### Installation:
|
||||
|
||||
```bash
|
||||
$ brew install webp
|
||||
```
|
||||
|
||||
#### Aide:
|
||||
|
||||
```bash
|
||||
❯ cwebp -longhelp
|
||||
Usage:
|
||||
cwebp [-preset <...>] [options] in_file [-o out_file]
|
||||
|
||||
If input size (-s) for an image is not specified, it is
|
||||
assumed to be a PNG, JPEG, TIFF or WebP file.
|
||||
Note: Animated PNG and WebP files are not supported.
|
||||
|
||||
Options:
|
||||
-h / -help ............. short help
|
||||
-H / -longhelp ......... long help
|
||||
-q <float> ............. quality factor (0:small..100:big), default=75
|
||||
-alpha_q <int> ......... transparency-compression quality (0..100),
|
||||
default=100
|
||||
-preset <string> ....... preset setting, one of:
|
||||
default, photo, picture,
|
||||
drawing, icon, text
|
||||
-preset must come first, as it overwrites other parameters
|
||||
-z <int> ............... activates lossless preset with given
|
||||
level in [0:fast, ..., 9:slowest]
|
||||
|
||||
-m <int> ............... compression method (0=fast, 6=slowest), default=4
|
||||
-segments <int> ........ number of segments to use (1..4), default=4
|
||||
-size <int> ............ target size (in bytes)
|
||||
-psnr <float> .......... target PSNR (in dB. typically: 42)
|
||||
|
||||
-s <int> <int> ......... input size (width x height) for YUV
|
||||
-sns <int> ............. spatial noise shaping (0:off, 100:max), default=50
|
||||
-f <int> ............... filter strength (0=off..100), default=60
|
||||
-sharpness <int> ....... filter sharpness (0:most .. 7:least sharp), default=0
|
||||
-strong ................ use strong filter instead of simple (default)
|
||||
-nostrong .............. use simple filter instead of strong
|
||||
-sharp_yuv ............. use sharper (and slower) RGB->YUV conversion
|
||||
-partition_limit <int> . limit quality to fit the 512k limit on
|
||||
the first partition (0=no degradation ... 100=full)
|
||||
-pass <int> ............ analysis pass number (1..10)
|
||||
-qrange <min> <max> .... specifies the permissible quality range
|
||||
(default: 0 100)
|
||||
-crop <x> <y> <w> <h> .. crop picture with the given rectangle
|
||||
-resize <w> <h> ........ resize picture (after any cropping)
|
||||
-mt .................... use multi-threading if available
|
||||
-low_memory ............ reduce memory usage (slower encoding)
|
||||
-map <int> ............. print map of extra info
|
||||
-print_psnr ............ prints averaged PSNR distortion
|
||||
-print_ssim ............ prints averaged SSIM distortion
|
||||
-print_lsim ............ prints local-similarity distortion
|
||||
-d <file.pgm> .......... dump the compressed output (PGM file)
|
||||
-alpha_method <int> .... transparency-compression method (0..1), default=1
|
||||
-alpha_filter <string> . predictive filtering for alpha plane,
|
||||
one of: none, fast (default) or best
|
||||
-exact ................. preserve RGB values in transparent area, default=off
|
||||
-blend_alpha <hex> ..... blend colors against background color
|
||||
expressed as RGB values written in
|
||||
hexadecimal, e.g. 0xc0e0d0 for red=0xc0
|
||||
green=0xe0 and blue=0xd0
|
||||
-noalpha ............... discard any transparency information
|
||||
-lossless .............. encode image losslessly, default=off
|
||||
-near_lossless <int> ... use near-lossless image
|
||||
preprocessing (0..100=off), default=100
|
||||
-hint <string> ......... specify image characteristics hint,
|
||||
one of: photo, picture or graph
|
||||
|
||||
-metadata <string> ..... comma separated list of metadata to
|
||||
copy from the input to the output if present.
|
||||
Valid values: all, none (default), exif, icc, xmp
|
||||
|
||||
-short ................. condense printed message
|
||||
-quiet ................. don't print anything
|
||||
-version ............... print version number and exit
|
||||
-noasm ................. disable all assembly optimizations
|
||||
-v ..................... verbose, e.g. print encoding/decoding times
|
||||
-progress .............. report encoding progress
|
||||
|
||||
Experimental Options:
|
||||
-jpeg_like ............. roughly match expected JPEG size
|
||||
-af .................... auto-adjust filter strength
|
||||
-pre <int> ............. pre-processing filter
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Usage:
|
||||
|
||||
```bash
|
||||
$ cwebp -q 90 image.png -o image.webp
|
||||
```
|
||||
|
||||
```bash
|
||||
for infile in Screenshot*.png
|
||||
do
|
||||
echo $infile
|
||||
base=$(basename "$infile" .png)
|
||||
cwebp -preset picture -v "$infile" -o "$base".webp
|
||||
done
|
||||
```
|
||||
|
||||
```bash
|
||||
$ cwebp png/2022-04-16_Brocard_8990_8b.png -q 75 -mt -o cwebp/2022-04-16_Brocard_8990_8b_q75.webp
|
||||
|
||||
$ cwebp png/2022-04-16_Brocard_8990_8b.png -preset photo -mt -o cwebp/2022-04-16_Brocard_8990_8b_preset-photo.webp
|
||||
```
|
||||
|
||||
```bash
|
||||
# lossless
|
||||
|
||||
$ cwebp png/2022-04-16_Brocard_8990_8b.png -z 9 -mt -o cwebp/2022-04-16_Brocard_8990_8b.webp
|
||||
|
||||
$ cwebp png/2022-04-16_Brocard_8990_8b.png -lossless -m 6 -q 100 -mt -o cwebp/2022-04-16_Brocard_8990_8b.webp
|
||||
```
|
||||
|
||||
|
||||
|
||||
### <a id="squoosh"></a>[squoosh-cli](https://www.npmjs.com/package/@squoosh/cli)
|
||||
|
||||
Supporte mozjpeg, webp, avif, jxl, wp2
|
||||
|
||||
Les options sont visibles dans [codecs.ts](https://github.com/GoogleChromeLabs/squoosh/blob/dev/libsquoosh/src/codecs.ts)
|
||||
|
||||
#### Installation:
|
||||
|
||||
```bash
|
||||
$ npm i -g @squoosh/cli
|
||||
```
|
||||
|
||||
#### Usage:
|
||||
|
||||
```bash
|
||||
Usage: squoosh-cli [options] <files...>
|
||||
|
||||
Options:
|
||||
-d, --output-dir <dir> Output directory (default: ".")
|
||||
-s, --suffix <suffix> Append suffix to output files (default: "")
|
||||
--max-optimizer-rounds <rounds> Maximum number of compressions to use for auto optimizations (default: "6")
|
||||
--optimizer-butteraugli-target <butteraugli distance> Target Butteraugli distance for auto optimizer (default: "1.4")
|
||||
--resize [config] Resize the image before compressing
|
||||
--quant [config] Reduce the number of colors used (aka. paletting)
|
||||
--rotate [config] Rotate image
|
||||
--mozjpeg [config] Use MozJPEG to generate a .jpg file with the given configuration
|
||||
--webp [config] Use WebP to generate a .webp file with the given configuration
|
||||
--avif [config] Use AVIF to generate a .avif file with the given configuration
|
||||
--jxl [config] Use JPEG-XL to generate a .jxl file with the given configuration
|
||||
--wp2 [config] Use WebP2 to generate a .wp2 file with the given configuration
|
||||
--oxipng [config] Use OxiPNG to generate a .png file with the given configuration
|
||||
-h, --help display help for command
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ squoosh-cli --webp true -d webp ./2022-04-28_Biche_8247_8b.png
|
||||
1/1 ✔ Squoosh results:
|
||||
./2022-04-28_Biche_8247_8b.png: 2.18MB
|
||||
└ webp/2022-04-28_Biche_8247_8b.webp → 75.00KB (3.37%)
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ squoosh-cli --output-dir 'squoosh-cli' --webp '{
|
||||
"quality":75,
|
||||
"target_size":0,
|
||||
"target_PSNR":0,
|
||||
"method":4,
|
||||
"sns_strength":50,
|
||||
"filter_strength":60,
|
||||
"filter_sharpness":0,
|
||||
"filter_type":1,
|
||||
"partitions":0,
|
||||
"segments":4,
|
||||
"pass":1,
|
||||
"show_compressed":0,
|
||||
"preprocessing":0,
|
||||
"autofilter":0,
|
||||
"partition_limit":0,
|
||||
"alpha_compression":1,
|
||||
"alpha_filtering":1,
|
||||
"alpha_quality":100,
|
||||
"lossless":0,
|
||||
"exact":0,
|
||||
"image_hint":0,
|
||||
"emulate_jpeg_size":0,
|
||||
"thread_level":0,
|
||||
"low_memory":0,
|
||||
"near_lossless":100,
|
||||
"use_delta_palette":0,
|
||||
"use_sharp_yuv":0
|
||||
}' png/*.png
|
||||
```
|
||||
|
||||
|
||||
|
||||
### <a id="ImageMagick"></a>ImageMagick
|
||||
|
||||
[Webp options](https://imagemagick.org/script/webp.php).
|
||||
|
||||
[-define](https://imagemagick.org/script/defines.php) command-line option.
|
||||
|
||||
[Command-line tools](https://imagemagick.org/script/command-line-tools.php)
|
||||
|
||||
[Command-line Options](https://imagemagick.org/script/command-line-options.php#quality)
|
||||
|
||||
#### Usage:
|
||||
|
||||
```bash
|
||||
❯ magick -quality 75 png/2022-04-16_Brocard_8990_8b.png magick/2022-04-16_Brocard_8990_8b.webp
|
||||
|
||||
❯ magick -define heic:speed=2 png/2022-04-16_Brocard_8990_8b.png magick/2022-04-16_Brocard_8990_8b_2.webp
|
||||
|
||||
❯ convert -define heic:speed=2 png/2022-04-16_Brocard_8990_8b.png magick/2022-04-16_Brocard_8990_8b_2.webp
|
||||
```
|
||||
|
||||
```bash
|
||||
magick png/2022-04-16_Brocard_8990_8b.png -quality 50 -define webp:lossless=true png/2022-04-16_Brocard_8990_8b_ll-true.webp
|
||||
|
||||
magick png/2022-04-16_Brocard_8990_8b.png -quality 90 -define webp:lossless=false png/2022-04-16_Brocard_8990_8b_ll-false.webp
|
||||
```
|
||||
|
||||
|
||||
|
||||
### [WebpConvert](https://github.com/rizqirizqi/webpconvert)
|
||||
|
||||
#### Installation:
|
||||
|
||||
```bash
|
||||
$ npm install -g webpconvert
|
||||
```
|
||||
|
||||
#### Options:
|
||||
|
||||
```bash
|
||||
-p, --prefix Specify the prefix of output filename. [chaîne de caractères] [défaut : ""]
|
||||
-s, --suffix Specify the suffix of output filename. [chaîne de caractères] [défaut : ""]
|
||||
-q, --quality Specify the quality of webp image. Lower values yield better compression but the least image quality. [nombre] [défaut : 80]
|
||||
-m, --mute Disable output messages. [booléen] [défaut : false]
|
||||
-h, --help Affiche l'aide [booléen]
|
||||
-v, --version Affiche le numéro de version [booléen]
|
||||
```
|
||||
|
||||
#### Usage:
|
||||
|
||||
```bash
|
||||
❯ webpconvert -q 80 --suffix="webpconvert-q80" png/2022-05-10_Cerf_8817_8b.png webpconvert/2022-05-10_Cerf_8817_8b.webp
|
||||
|
||||
❯ webpconvert -q 80 --suffix="webpconvert-q80" png/ webpconvert/
|
||||
```
|
||||
|
||||
101
docs/Divers/joplin.md
Normal file
@@ -0,0 +1,101 @@
|
||||
# Joplin
|
||||
|
||||
|
||||
|
||||
## Joplin server
|
||||
|
||||
#### Docker:
|
||||
|
||||
`docker-compose.yaml`
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:13.1
|
||||
ports:
|
||||
- "5432:5432"
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /Users/bruno/Documents/docker/joplin-data:/var/lib/postgresql/data
|
||||
environment:
|
||||
- APP_PORT=22300
|
||||
- POSTGRES_PASSWORD=joplin
|
||||
- POSTGRES_USER=joplin
|
||||
- POSTGRES_DB=joplin
|
||||
app:
|
||||
image: joplin/server:latest
|
||||
depends_on:
|
||||
- db
|
||||
ports:
|
||||
- "22300:22300"
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- APP_BASE_URL=https://silverbook.local/joplin
|
||||
- DB_CLIENT=pg
|
||||
- POSTGRES_PASSWORD=joplin
|
||||
- POSTGRES_DATABASE=joplin
|
||||
- POSTGRES_USER=joplin
|
||||
- POSTGRES_PORT=5432
|
||||
- POSTGRES_HOST=db
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Apache:
|
||||
|
||||
Activer les modules dans`httpd.conf`
|
||||
|
||||
```http
|
||||
LoadModule proxy_html_module lib/httpd/modules/mod_proxy_html.so
|
||||
LoadModule proxy_module lib/httpd/modules/mod_proxy.so
|
||||
LoadModule proxy_http_module lib/httpd/modules/mod_proxy_http.so
|
||||
LoadModule ssl_module lib/httpd/modules/mod_ssl.so
|
||||
LoadModule vhost_alias_module lib/httpd/modules/mod_vhost_alias.so
|
||||
```
|
||||
|
||||
Editer le fichier`httpd-vhosts.conf`
|
||||
|
||||
```http
|
||||
<VirtualHost *:443>
|
||||
DocumentRoot "/Users/bruno/Sites"
|
||||
ServerName silverbook.local
|
||||
<Proxy *>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</Proxy>
|
||||
ProxyPass "/joplin" http://localhost:22300
|
||||
ProxyPassReverse "/joplin" http://localhost:22300
|
||||
ProxyPreserveHost On
|
||||
ProxyRequests off
|
||||
SSLEngine on
|
||||
SSLProxyEngine On
|
||||
SSLCertificateFile "/usr/local/etc/httpd/server.crt"
|
||||
SSLCertificateKeyFile "/usr/local/etc/httpd/server.key"
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
<u>Joplin server</u> sera accessible à https://silverbook.local/joplin
|
||||
|
||||
|
||||
|
||||
Pour rendre <u>Joplin server</u> disponible à https://joplin.silverbook.local, modifier le fichier`httpd-vhosts.conf`
|
||||
|
||||
```http
|
||||
<VirtualHost *:443>
|
||||
...
|
||||
ServerName joplin.silverbook.local
|
||||
ProxyPass "/" http://localhost:22300
|
||||
ProxyPassReverse "/" http://localhost:22300
|
||||
...
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
et le fichier `docker-compose.yaml`
|
||||
|
||||
```yaml
|
||||
- APP_BASE_URL=https://joplin.silverbook.local
|
||||
```
|
||||
|
||||
@@ -106,7 +106,7 @@ The hint "Limitations for Android-User: change to “ssl_ecdh_curve prime256v1;
|
||||
|
||||
|
||||
|
||||
[Nextcloud sur NAS Synology](../Synology/nextcloud.md)
|
||||
[Nextcloud sur NAS Synology](../Synology/dsm6/nextcloud.md)
|
||||
|
||||
[Nextcloud sur VPS/Plesk](../Plesk/nextcloud.md)
|
||||
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
|
||||
|
||||
|
||||
### Backup (paramètres et partition JFFS)
|
||||
|
||||
A faire avant la mise-à-jour du firmware;
|
||||
|
||||
Administration -> Restaurer -> **Router settings** -> Enregistrer les Paramètres
|
||||
|
||||
Administration -> Restaurer -> **JFFS Partition** -> Backup JFFS partition
|
||||
|
||||
|
||||
|
||||
### Activer SSH et les scripts JFFS:
|
||||
|
||||
1. Aller à **Administration** puis onglet **Système**.
|
||||
@@ -51,7 +61,7 @@ $ service restart_dnsmasq
|
||||
|
||||
### Dnsmasq:
|
||||
|
||||
Configuration:
|
||||
#### Configuration:
|
||||
|
||||
```bash
|
||||
$ nano /etc/dnsmasq.conf
|
||||
@@ -59,13 +69,13 @@ $ nano /etc/dnsmasq.conf
|
||||
|
||||
|
||||
|
||||
Vérifier la configuration:
|
||||
#### Vérifier la configuration:
|
||||
|
||||
```bash
|
||||
$ dnsmasq --test
|
||||
```
|
||||
|
||||
Vérifier la résolution DNS:
|
||||
#### Vérifier la résolution DNS:
|
||||
|
||||
```bash
|
||||
$ dig clicclac.synology.me +short
|
||||
@@ -97,9 +107,9 @@ clicclac.synology.me. 171 IN A 90.62.226.41
|
||||
|
||||
|
||||
|
||||
Bloquer un domain:
|
||||
#### Bloquer un domain:
|
||||
|
||||
Ajouter dans le dnsmasq.conf:
|
||||
Ajouter dans le fichier `/etc/dnsmasq.conf`:
|
||||
|
||||
```bash
|
||||
address=/blocked.example/
|
||||
@@ -116,6 +126,16 @@ conf-dir=/etc/dnsmasq.d/,*.conf
|
||||
|
||||
|
||||
|
||||
#### Notification de mise-à-jour:
|
||||
|
||||
https://github.com/RMerl/asuswrt-merlin.ng/wiki/Update-Notification-Example
|
||||
|
||||
```bash
|
||||
bruno@RT-AC88U-0928:/bin# /jffs/scripts/update-notification
|
||||
```
|
||||
|
||||
|
||||
|
||||
### amtm
|
||||
|
||||
[amtm](https://diversion.ch/amtm.html) est une GUI qui permet d'installer des scripts dans les routeurs Asus fonctionnant sous le firmware [Asuswrt-Merlin](https://www.asuswrt-merlin.net) (depuis la v384.15, amtm est installé d'office) ([forum](https://www.snbforums.com/threads/amtm-the-asuswrt-merlin-terminal-menu.42415/page-124)).
|
||||
@@ -155,7 +175,11 @@ Modules installés:
|
||||
- Skynet (nécessite un fichier swap de 2 Go):
|
||||
- LED Control: éteint les LED de 21h30 à 7h
|
||||
|
||||
Désinstaller Skynet:
|
||||
|
||||
```bash
|
||||
sh /jffs/scripts/firewall uninstall
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -177,4 +201,8 @@ Asus-wrt vs Asus-Merlin:
|
||||
|
||||
https://www.snbforums.com/threads/dnsmasq-conf-add-without-custom-firmware.43244/
|
||||
|
||||
https://www.snbforums.com/threads/how-to-use-dnsmasq-conf-add.8785/
|
||||
https://www.snbforums.com/threads/how-to-use-dnsmasq-conf-add.8785/
|
||||
|
||||
|
||||
|
||||
https://www.henriksommerfeld.se/firmware-update-notifications-for-my-asus-router/
|
||||
39
docs/Divers/tmux.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# tmux
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ tmux
|
||||
```
|
||||
|
||||
Ctrl + B -> mode Commande
|
||||
|
||||
Ctrl + B puis % : partage l'écran en 2
|
||||
|
||||
Ctrl + B puis -> / <- : passe d'un terminal à l'autre
|
||||
|
||||
|
||||
|
||||
#### Intégration iTerm2
|
||||
|
||||
```bash
|
||||
$ tmux -CC
|
||||
```
|
||||
|
||||
Ouvre une 2e fenêtre, un terminal tmux
|
||||
|
||||
Ctrl + clic sur la fenêtre, choisir *Split Pane Vertically*
|
||||
|
||||
On passe d'un panneau à l'autre par un simple clic.
|
||||
|
||||
|
||||
|
||||
On ferme la fenêtre -> choisir Detach tmux Session
|
||||
|
||||
Sur la 1e fenêtre
|
||||
|
||||
```bash
|
||||
$ tmux -CC attach
|
||||
```
|
||||
|
||||
On retrouve la 2e fenêtre dans le même état (la session précédente est restaurée).
|
||||
348
docs/Divers/wordpress.md
Normal file
@@ -0,0 +1,348 @@
|
||||
# WordPress sur Debian / nginx
|
||||
|
||||
|
||||
|
||||
#### Installation nginx/php/mariadb
|
||||
|
||||
Ajouter le dépôt PPA pour PHP 7.4
|
||||
|
||||
```bash
|
||||
$ sudo apt-get install apt-transport-https lsb-release ca-certificates
|
||||
$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
||||
$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" >> /etc/apt/sources.list.d/php.list
|
||||
apt-get update
|
||||
```
|
||||
|
||||
Installer nginx, mariadb, php7.4 et ses modules
|
||||
|
||||
```bash
|
||||
sudo apt-get install nginx mariadb-server mariadb-client unzip wget git -y
|
||||
|
||||
sudo apt-get install php7.4-fpm php7.4-cli
|
||||
sudo apt-get install php7.4-{bcmath,bz2,curl,imagick,intl,gd,mbstring,mcrypt,memcache,mysql,redis,xdebug,xml,zip}
|
||||
```
|
||||
|
||||
Démarrer nginx et mariadb
|
||||
|
||||
```bash
|
||||
sudo systemctl start nginx.service
|
||||
sudo systemctl enable nginx.service
|
||||
sudo systemctl start mariadb.service
|
||||
sudo systemctl enable mariadb.service
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### PHP
|
||||
|
||||
Voir les logs:
|
||||
|
||||
```bash
|
||||
sudo nano /etc/php/7.4/fpm/php.ini
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### mariadb
|
||||
|
||||
Sécuriser mariadb
|
||||
|
||||
```bash
|
||||
$ sudo mysql_secure_installation
|
||||
```
|
||||
|
||||
Créer la base de donnée wordpress
|
||||
|
||||
```bash
|
||||
$ sudo mysql -u root -p
|
||||
```
|
||||
|
||||
```mysql
|
||||
# Supprimer une ancienne base:
|
||||
# DROP DATABASE wordpress;
|
||||
|
||||
CREATE DATABASE wordpress;
|
||||
GRANT ALL ON wordpress.* TO 'adm_wp'@'localhost' IDENTIFIED BY 'Kpm!65YU';
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installation WordPress
|
||||
|
||||
Télécharger WordPress
|
||||
|
||||
```bash
|
||||
cd /var/www/html
|
||||
sudo wget https://wordpress.org/latest.tar.gz
|
||||
sudo tar -xzvf latest.tar.gz
|
||||
```
|
||||
|
||||
Corriger les autorisations
|
||||
|
||||
```bash
|
||||
#$ sudo chown -R $USER:$USER /var/www/html/wordpress/
|
||||
$ sudo chown -R www-data:www-data /var/www/html/wordpress/
|
||||
$ sudo chmod -R 755 /var/www/html/wordpress/
|
||||
$ find /var/www/html/wordpress/ -type d -exec chmod 755 {} \;
|
||||
$ find /var/www/html/wordpress/ -type f -exec chmod 644 {} \;
|
||||
```
|
||||
|
||||
Configurer WordPress
|
||||
|
||||
```bash
|
||||
$ curl -s https://api.wordpress.org/secret-key/1.1/salt/
|
||||
define('AUTH_KEY', 'nqx$&&2@.PlOv:R-@D5O@1J!fxBV).%}|4$E,<]3V6wK:>s;N*_qZgX1v%Clj.nY');
|
||||
define('SECURE_AUTH_KEY', 'k/iGx=P!Q,I=-f-_JhI-hNNlvL]036/W;h@,-a>l:DN#w}@.RdqehTDC>Da{$`v,');
|
||||
define('LOGGED_IN_KEY', 'e!2g+-jFty5(}j>Oxtdt1+krNu&[TIrP}|)G&0jt%Z+q#+?TTP1mM+MVTH-zD5#w');
|
||||
define('NONCE_KEY', '9 @VoZ.-OVd!wy5mT$?&-$RHIX%xImw]M2jKK+vUet+pImeiNYGx~Jm>shu}p0B7');
|
||||
define('AUTH_SALT', ':pyo`{Fk*YNww+V-]-8Oy|}daBoedBnlO?AWKw;Gj+X9n|qm#Ndk~?R-d`N!I21v');
|
||||
define('SECURE_AUTH_SALT', ' +dgn@u/e#rZ.4(t}#.3d<)Y2>d)3c)t$j>_C^}sEwSK&VZ+]C=b2/.gzyA#.$Kz');
|
||||
define('LOGGED_IN_SALT', 'q1},|Tm|kBb!?H*T`PkGt;}>JF/8fHRRzGaVPB[Et!#gjbm4rjG-}-J`jlzZ<I|E');
|
||||
define('NONCE_SALT', 'I}Sv1zA>I*rW/[3?d[@/jg$=95NqWDdBMf{N>o: G!R fp10Ynyoq-^Hw>-7|LEK');
|
||||
|
||||
```
|
||||
|
||||
```bash
|
||||
$ cp wp-config-sample.php wp-config.php
|
||||
$ nano wp-config.php
|
||||
```
|
||||
|
||||
```php
|
||||
### Modifier les réglages de base de donnée ###
|
||||
|
||||
// ** MySQL settings - You can get this info from your web host ** //
|
||||
/** The name of the database for WordPress */
|
||||
define( 'DB_NAME', 'wordpress' );
|
||||
|
||||
/** MySQL database username */
|
||||
define( 'DB_USER', 'adm_wp' );
|
||||
|
||||
/** MySQL database password */
|
||||
define( 'DB_PASSWORD', 'Kpm!65YU' );
|
||||
|
||||
/** MySQL hostname */
|
||||
define( 'DB_HOST', 'localhost' );
|
||||
|
||||
/** Database Charset to use in creating database tables. */
|
||||
define( 'DB_CHARSET', 'utf8' );
|
||||
|
||||
/** The Database Collate type. Don't change this if in doubt. */
|
||||
define( 'DB_COLLATE', '' );
|
||||
|
||||
|
||||
### Remplacer la section Authentication Unique Keys and Salts. ###
|
||||
|
||||
define('AUTH_KEY', 'nqx$&&2@.PlOv:R-@D5O@1J!fxBV).%}|4$E,<]3V6wK:>s;N*_qZgX1v%Clj.nY');
|
||||
define('SECURE_AUTH_KEY', 'k/iGx=P!Q,I=-f-_JhI-hNNlvL]036/W;h@,-a>l:DN#w}@.RdqehTDC>Da{$`v,');
|
||||
define('LOGGED_IN_KEY', 'e!2g+-jFty5(}j>Oxtdt1+krNu&[TIrP}|)G&0jt%Z+q#+?TTP1mM+MVTH-zD5#w');
|
||||
define('NONCE_KEY', '9 @VoZ.-OVd!wy5mT$?&-$RHIX%xImw]M2jKK+vUet+pImeiNYGx~Jm>shu}p0B7');
|
||||
define('AUTH_SALT', ':pyo`{Fk*YNww+V-]-8Oy|}daBoedBnlO?AWKw;Gj+X9n|qm#Ndk~?R-d`N!I21v');
|
||||
define('SECURE_AUTH_SALT', ' +dgn@u/e#rZ.4(t}#.3d<)Y2>d)3c)t$j>_C^}sEwSK&VZ+]C=b2/.gzyA#.$Kz');
|
||||
define('LOGGED_IN_SALT', 'q1},|Tm|kBb!?H*T`PkGt;}>JF/8fHRRzGaVPB[Et!#gjbm4rjG-}-J`jlzZ<I|E');
|
||||
define('NONCE_SALT', 'I}Sv1zA>I*rW/[3?d[@/jg$=95NqWDdBMf{N>o: G!R fp10Ynyoq-^Hw>-7|LEK');
|
||||
|
||||
|
||||
### Activer les mises à jour ###
|
||||
|
||||
define( 'FS_METHOD', 'direct' );
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Configurer nginx
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/nginx/sites-available/test.conf
|
||||
```
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
#return 302 https://$server_name$request_uri;
|
||||
|
||||
root /var/www/html;
|
||||
index index.php index.html index.htm index.nginx-debian.html;
|
||||
|
||||
location / {
|
||||
if ($request_uri ~ ^/(.*)\.html$) {
|
||||
return 302 /$1;
|
||||
}
|
||||
}
|
||||
|
||||
location /wordpress {
|
||||
try_files $uri $uri/ /wordpress/index.php?$args;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
#include snippets/fastcgi-php.conf;
|
||||
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo ln -s /etc/nginx/sites-available/test.conf /etc/nginx/sites-enabled/default
|
||||
```
|
||||
|
||||
Vérifier la configuration et redémarrer PHP/nginx.
|
||||
|
||||
```bash
|
||||
$ sudo /usr/sbin/nginx -t
|
||||
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
|
||||
nginx: configuration file /etc/nginx/nginx.conf test is successful
|
||||
|
||||
$ sudo systemctl restart nginx php7.4-fpm
|
||||
```
|
||||
|
||||
Aller à http://localhost/wordpress/ pour terminer l'installation de WordPress.
|
||||
|
||||
|
||||
|
||||
#### Échec d’installation : Impossible de créer le dossier » dans WordPress
|
||||
|
||||
Aller dans Outils -> Santé du site
|
||||
|
||||
```bash
|
||||
$ sudo chown -R www-data:www-data wordpress/
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### SSL
|
||||
|
||||
Générer clé et certificat auto-signés:
|
||||
|
||||
```bash
|
||||
$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt
|
||||
```
|
||||
|
||||
Créer un groupe Diffie-Hellman:
|
||||
|
||||
```bash
|
||||
$ sudo openssl dhparam -out /etc/nginx/dhparam.pem 4096
|
||||
```
|
||||
|
||||
Créer un snippet contenant les fichiers des clés et certificats:
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/nginx/snippets/self-signed.conf
|
||||
```
|
||||
|
||||
```nginx
|
||||
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
||||
```
|
||||
|
||||
Créer un snippet contenant les réglages SSL:
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/nginx/snippets/ssl-params.conf
|
||||
```
|
||||
|
||||
```nginx
|
||||
ssl_protocols TLSv1.2;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_dhparam /etc/nginx/dhparam.pem;
|
||||
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
|
||||
ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
|
||||
ssl_session_timeout 10m;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_tickets off; # Requires nginx >= 1.5.9
|
||||
ssl_stapling on; # Requires nginx >= 1.3.7
|
||||
ssl_stapling_verify on; # Requires nginx => 1.3.7
|
||||
resolver 8.8.8.8 8.8.4.4 valid=300s;
|
||||
resolver_timeout 5s;
|
||||
# Disable strict transport security for now. You can uncomment the following
|
||||
# line if you understand the implications.
|
||||
# add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
|
||||
add_header X-Frame-Options DENY;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
```
|
||||
|
||||
Modifier la config nginx pour gérer SSL:
|
||||
|
||||
```bash
|
||||
$ sudo cp /etc/nginx/sites-available/test.conf /etc/nginx/sites-available/test.conf.bak
|
||||
|
||||
$ sudo cp /etc/nginx/sites-available/test.conf
|
||||
```
|
||||
|
||||
```nginx
|
||||
server {
|
||||
#listen 80;
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
include snippets/self-signed.conf;
|
||||
include snippets/ssl-params.conf;
|
||||
|
||||
server_name localhost;
|
||||
#return 302 https://$server_name$request_uri;
|
||||
|
||||
root /var/www/html;
|
||||
index index.php index.html index.htm index.nginx-debian.html;
|
||||
|
||||
location / {
|
||||
if ($request_uri ~ ^/(.*)\.html$) {
|
||||
return 302 /$1;
|
||||
}
|
||||
}
|
||||
|
||||
location /wordpress {
|
||||
try_files $uri $uri/ /wordpress/index.php?$args;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
#include snippets/fastcgi-php.conf;
|
||||
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name localhost;
|
||||
|
||||
# redirection provisoire
|
||||
#return 302 https://$server_name$request_uri;
|
||||
|
||||
# redirection permanente
|
||||
return 301 https://$server_name$request_uri;
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
https://slacker.ro/2019/07/15/how-to-create-a-self-signed-ssl-certificate-for-nginx-on-debian-10/
|
||||
|
||||
|
||||
|
||||
```
|
||||
bruno / MHxhNZ2Ax*@@cvy6XM
|
||||
```
|
||||
|
||||
|
||||
|
||||
30
docs/Divers/zsh/completion.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# completion
|
||||
|
||||
|
||||
|
||||
https://scriptingosx.com/2019/07/moving-to-zsh-part-5-completions/
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
❯ echo $fpath
|
||||
/Users/bruno/.zinit/completions /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/5.8.1/functions /Users/bruno/.zinit/plugins/zsh-users---zsh-completions/src
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
/opt/homebrew/etc/bash_completion.d
|
||||
```
|
||||
|
||||
|
||||
|
||||
### .zshrc
|
||||
|
||||
```bash
|
||||
autoload -U +X compinit && compinit
|
||||
autoload -U +X bashcompinit && bashcompinit
|
||||
|
||||
source /opt/homebrew/etc/bash_completion.d/soco-cli-gui-completion.bash
|
||||
```
|
||||
|
||||
579
docs/Divers/zsh/plugins.md
Normal file
@@ -0,0 +1,579 @@
|
||||
# ZSH Plugins
|
||||
|
||||
|
||||
|
||||
### Plugins (installés)
|
||||
|
||||
#### You Should Use *
|
||||
|
||||
Simple zsh plugin that reminds you that you should use one of your existing aliases for a command you just typed.
|
||||
|
||||
https://github.com/MichaelAquilina/zsh-you-should-use
|
||||
|
||||
```bash
|
||||
antibody bundle MichaelAquilina/zsh-you-should-use
|
||||
```
|
||||
|
||||
```bash
|
||||
zinit light MichaelAquilina/zsh-you-should-use
|
||||
```
|
||||
|
||||
```bash
|
||||
# Config:
|
||||
|
||||
export YSU_MESSAGE_POSITION="after"
|
||||
|
||||
# %alias_type: alias, git alias, global alias
|
||||
# %command: la commande entrée
|
||||
# %alias: l'alias trouvé
|
||||
|
||||
export YSU_MESSAGE_FORMAT="$(tput setaf 1)Hey! I found this %alias_type for %command: %alias$(tput sgr0)"
|
||||
|
||||
# Fonctions
|
||||
check_alias_usage
|
||||
```
|
||||
|
||||
[alias-type](https://github.com/djui/alias-tips)
|
||||
|
||||
|
||||
|
||||
#### zsh-fast-alias-tips
|
||||
|
||||
Helps you remembering the aliases you defined once.
|
||||
|
||||
https://github.com/sei40kr/zsh-fast-alias-tips
|
||||
|
||||
```bash
|
||||
|
||||
```
|
||||
|
||||
```bash
|
||||
zinit ice from'gh-r' as'program'
|
||||
zinit light sei40kr/fast-alias-tips-bin
|
||||
zinit light sei40kr/zsh-fast-alias-tips
|
||||
```
|
||||
|
||||
| Variable | Default value | Description |
|
||||
| ------------------------ | ------------------ | ---------------------- |
|
||||
| `FAST_ALIAS_TIPS_PREFIX` | `"💡 $(tput bold)"` | The prefix of the Tips |
|
||||
| `FAST_ALIAS_TIPS_SUFFIX` | `"$(tput sgr0)"` | The suffix of the Tips |
|
||||
|
||||
|
||||
|
||||
#### diractions *
|
||||
|
||||
https://github.com/AdrieanKhisbe/diractions
|
||||
|
||||
```bash
|
||||
antibody bundle "adrieankhisbe/diractions"
|
||||
```
|
||||
|
||||
```bash
|
||||
zinit light adrieankhisbe/diractions
|
||||
```
|
||||
|
||||
```bash
|
||||
# Editer fichier .diractions (folders)
|
||||
nano ~/.diractions
|
||||
# sauver répertoire courant avec le nom <mkdocs>
|
||||
diraction save mkdocs
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### zsh colored man pages *
|
||||
|
||||
https://github.com/ael-code/zsh-colored-man-pages
|
||||
|
||||
```bash
|
||||
antibody bundle ael-code/zsh-colored-man-pages
|
||||
```
|
||||
|
||||
```bash
|
||||
zinit light ael-code/zsh-colored-man-pages
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### shell-plugins (profile-secrets)*
|
||||
|
||||
https://github.com/gmatheu/shell-plugins
|
||||
|
||||
```bash
|
||||
zinit snippet 'https://raw.githubusercontent.com/gmatheu/shell-plugins/master/profile-secrets/init.zsh'
|
||||
```
|
||||
|
||||
```bash
|
||||
# Fichier des secrets par défaut:
|
||||
~/.profile-secrets/secrets.sh
|
||||
```
|
||||
|
||||
Fonctions:
|
||||
|
||||
```bash
|
||||
# décrypte le fichier des secrets
|
||||
profile-secrets-decrypt: Decrypts secret file.
|
||||
|
||||
# encrypte le fichier des secrets (ou le crée lors du 1er lancement)
|
||||
profile-secrets-encrypt: Encrypts secret file. First time it is called will create secrets file
|
||||
|
||||
# ajoute les variables secrets à la session courante
|
||||
profile-secrets-source: Decrypts secrets file, source it and encrypts it back.
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Bol *
|
||||
|
||||
https://github.com/ikhurramraza/bol
|
||||
|
||||
```bash
|
||||
zinit light ikhurramraza/bol
|
||||
```
|
||||
|
||||
```bash
|
||||
$ bol print
|
||||
Kuch bhi hojaye na, to kuch nahi hota
|
||||
— Urwa Hocane
|
||||
```
|
||||
|
||||
```bash
|
||||
$ cd /Users/bruno/.zinit/plugins/ikhurramraza---bol/quotes/
|
||||
drwxr-xr-x 3 bruno staff 96 jul 31 21:28 Bollywood
|
||||
drwxr-xr-x 3 bruno staff 96 jul 31 21:28 Motivation
|
||||
drwxr-xr-x 4 bruno staff 128 jul 31 21:28 Originals
|
||||
drwxr-xr-x 4 bruno staff 128 jul 31 21:28 Seinfeld
|
||||
drwxr-xr-x 3 bruno staff 96 jul 31 21:28 Supernatural
|
||||
drwxr-xr-x 3 bruno staff 96 jul 31 21:28 TVD
|
||||
-rw-r--r-- 1 bruno staff 109 aoû 1 22:10 jvc.txt
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### zsh-notify *
|
||||
|
||||
Desktop notifications for long-running commands in ZSH.
|
||||
|
||||
https://github.com/marzocchi/zsh-notify
|
||||
|
||||
```bash
|
||||
antibody bundle marzocchi/zsh-notify
|
||||
```
|
||||
|
||||
```bash
|
||||
zinit light marzocchi/zsh-notify
|
||||
```
|
||||
|
||||
```bash
|
||||
zstyle ':notify:*' error-icon "https://media3.giphy.com/media/10ECejNtM1GyRy/200_s.gif"
|
||||
zstyle ':notify:*' error-title "Command failed (in #{time_elapsed} seconds)"
|
||||
zstyle ':notify:*' success-icon "https://s-media-cache-ak0.pinimg.com/564x/b5/5a/18/b55a1805f5650495a74202279036ecd2.jpg"
|
||||
zstyle ':notify:*' success-title "Command finished (in #{time_elapsed} seconds)"
|
||||
zstyle ':notify:*' error-sound "Glass"
|
||||
zstyle ':notify:*' success-sound "default"
|
||||
```
|
||||
|
||||
[auto-notify](https://github.com/MichaelAquilina/zsh-auto-notify)
|
||||
|
||||
|
||||
|
||||
#### forgit *
|
||||
|
||||
This tool is designed to help you use git more efficiently (fzf).
|
||||
|
||||
https://github.com/wfxr/forgit
|
||||
|
||||
```bash
|
||||
antibody bundle wfxr/forgit
|
||||
```
|
||||
|
||||
- **Interactive `git add` selector** (`ga`)
|
||||
|
||||
- **Interactive `git log` viewer** (`glo`)
|
||||
|
||||
- **Interactive `.gitignore` generator** (`gi`)
|
||||
|
||||
- **Interactive `git diff` viewer** (`gd`)
|
||||
|
||||
- **Interactive `git reset HEAD <file>` selector** (`grh`)
|
||||
|
||||
- **Interactive `git checkout <file>` selector** (`gcf`)
|
||||
|
||||
- **Interactive `git checkout <branch>` selector** (`gcb`)
|
||||
|
||||
- **Interactive `git checkout <commit>` selector** (`gco`)
|
||||
|
||||
- **Interactive `git stash` viewer** (`gss`)
|
||||
|
||||
- **Interactive `git clean` selector** (`gclean`)
|
||||
|
||||
- **Interactive `git cherry-pick` selector** (`gcp`)
|
||||
|
||||
- **Interactive `git rebase -i` selector** (`grb`)
|
||||
|
||||
- **Interactive `git commit --fixup && git rebase -i --autosquash` selector** (`gfu`)
|
||||
|
||||
|
||||
|
||||
####
|
||||
|
||||
#### Fast Syntax Highlighting *
|
||||
|
||||
https://github.com/zdharma/fast-syntax-highlighting
|
||||
|
||||
```bash
|
||||
antibody bundle zdharma/fast-syntax-highlighting
|
||||
```
|
||||
|
||||
```bash
|
||||
zinit light zdharma/fast-syntax-highlighting
|
||||
```
|
||||
|
||||
```bash
|
||||
# liste des themes
|
||||
❯ fast-theme -l
|
||||
Found existing alias for "fast-theme". You should use: "fsh-alias"
|
||||
Available themes:
|
||||
clean
|
||||
default
|
||||
forest
|
||||
free
|
||||
q-jmnemonic
|
||||
safari
|
||||
spa
|
||||
sv-orple
|
||||
sv-plant
|
||||
zdharma
|
||||
|
||||
# changer de thème
|
||||
❯ fast-theme -t <theme-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### history-search-multi-word *
|
||||
|
||||
https://github.com/zdharma/history-search-multi-word
|
||||
|
||||
```bash
|
||||
zinit load zdharma/history-search-multi-word
|
||||
```
|
||||
|
||||
```
|
||||
Ctrl-R
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ hist
|
||||
Ctrl-K – context, Ctrl-J – bump. Entry #1 of 50
|
||||
> abspath .zsh_history
|
||||
history | grep man
|
||||
history | grep curl
|
||||
history
|
||||
history | tail
|
||||
history -x
|
||||
antibody purge jimeh/zsh-peco-history
|
||||
cd zsh-history-enquirer
|
||||
cd zsh-directory-history
|
||||
which zsh-history-enquirer
|
||||
npm i -g zsh-history-enquirer
|
||||
antibody purge tymm/zsh-directory-history
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### zsh-autosuggestions *
|
||||
|
||||
https://github.com/zsh-users/zsh-autosuggestions
|
||||
|
||||
```bash
|
||||
antibody bundle zsh-users/zsh-autosuggestions
|
||||
```
|
||||
|
||||
```bash
|
||||
zinit light zsh-users/zsh-autosuggestions
|
||||
```
|
||||
|
||||
```bash
|
||||
Touche ->
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### zsh-completions *
|
||||
|
||||
|
||||
https://github.com/zsh-users/zsh-completions
|
||||
|
||||
```bash
|
||||
antibody bundle zsh-users/zsh-completions
|
||||
```
|
||||
|
||||
```bash
|
||||
zinit light zsh-users/zsh-completions
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### venv-wrapper
|
||||
|
||||
zsh plugin defining functions to wrap working with python's builtin venv module
|
||||
|
||||
https://github.com/glostis/venv-wrapper
|
||||
|
||||
```
|
||||
zinit light glostis/venv-wrapper
|
||||
```
|
||||
|
||||
```bash
|
||||
# Créer un venv
|
||||
❯ venv test2
|
||||
Virtual environment `test2` does not exist.
|
||||
Do you want to create it? [y/n]y
|
||||
Created and activated venv test2
|
||||
|
||||
# Supprimer un venv
|
||||
❯ rmvenv test2
|
||||
Removed venv test2
|
||||
|
||||
# Liste des venv
|
||||
❯ venv
|
||||
Type `venv name_of_env` to activate a virtual environment.
|
||||
|
||||
Here is the list of existing virtual environments:
|
||||
--------------------------------------------------
|
||||
test
|
||||
|
||||
# Activer un venv
|
||||
❯ venv test
|
||||
|
||||
~/Documents/venv 06:59:57
|
||||
test ❯
|
||||
|
||||
# Variables
|
||||
$VENV_WRAPPER_PYTHON
|
||||
```
|
||||
|
||||
|
||||
|
||||
!!! info
|
||||
|
||||
export PATH="$HOME/Documents/venv/soco-cli/bin:$PATH"
|
||||
|
||||
|
||||
|
||||
#### web-search *
|
||||
|
||||
Lance une recherche depuis le terminal.
|
||||
|
||||
https://github.com/sineto/web-search
|
||||
|
||||
```bash
|
||||
zinit snippet 'https://raw.githubusercontent.com/sineto/web-search/master/web_search.plugin.zsh'
|
||||
```
|
||||
|
||||
```
|
||||
google <search>
|
||||
ddg <search>
|
||||
github <search>
|
||||
youtube <search>
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### z-a-man *(marche pas)
|
||||
|
||||
https://github.com/zinit-zsh/z-a-man
|
||||
|
||||
```bash
|
||||
zinit light zinit-zsh/z-a-man
|
||||
```
|
||||
|
||||
```bash
|
||||
# View README.md manpage in the terminal
|
||||
zman z-a-man
|
||||
# View the code documentation (via the full plugin name, as demonstrated)
|
||||
zman -c zinit-zsh/z-a-man
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Plugins (autres)
|
||||
|
||||
#### FM
|
||||
|
||||
https://github.com/ddnexus/fm
|
||||
|
||||
```bash
|
||||
antibody bundle ddnexus/fm
|
||||
```
|
||||
|
||||
#### zshmarks
|
||||
|
||||
https://github.com/jocelynmallon/zshmarks
|
||||
|
||||
```bash
|
||||
antibody bundle jocelynmallon/zshmarks
|
||||
```
|
||||
|
||||
#### zsh-history-substring-search
|
||||
|
||||
https://github.com/zsh-users/zsh-history-substring-search
|
||||
|
||||
```bash
|
||||
antibody bundle zsh-users/zsh-history-substring-search
|
||||
```
|
||||
|
||||
#### zsh-peco-history
|
||||
|
||||
https://github.com/jimeh/zsh-peco-history
|
||||
|
||||
```bash
|
||||
antibody bundle jimeh/zsh-peco-history
|
||||
```
|
||||
|
||||
#### zsh-history-enquirer
|
||||
|
||||
https://github.com/zthxxx/zsh-history-enquirer
|
||||
|
||||
```bash
|
||||
npm i -g zsh-history-enquirer
|
||||
echo 'source `npm root -g`/zsh-history-enquirer/scripts/zsh-history-enquirer.plugin.zsh' >> ~/.zshrc
|
||||
```
|
||||
|
||||
```
|
||||
Ctrl-R
|
||||
```
|
||||
|
||||
#### antibody-completion
|
||||
|
||||
https://github.com/sinetoami/antibody-completion
|
||||
|
||||
```
|
||||
antibody bundle sinetoami/antibody-completion
|
||||
```
|
||||
|
||||
#### zsh-async
|
||||
|
||||
https://github.com/mafredri/zsh-async
|
||||
|
||||
```bash
|
||||
antibody bundle mafredri/zsh-async
|
||||
```
|
||||
|
||||
#### mysql.plugin.zsh
|
||||
|
||||
https://github.com/voronkovich/mysql.plugin.zsh
|
||||
|
||||
```bash
|
||||
antibody bundle voronkovich/mysql.plugin.zsh
|
||||
```
|
||||
|
||||
#### zsh-autocomplete
|
||||
|
||||
https://github.com/marlonrichert/zsh-autocomplete
|
||||
|
||||
```bash
|
||||
antibody bundle marlonrichert/zsh-autocomplete
|
||||
```
|
||||
|
||||
#### zsh-notes
|
||||
|
||||
https://github.com/aperezdc/zsh-notes
|
||||
|
||||
```
|
||||
antibody bundle aperezdc/zsh-notes
|
||||
```
|
||||
|
||||
#### Interactive-cd
|
||||
|
||||
https://github.com/changyuheng/zsh-interactive-cd
|
||||
|
||||
#### Link File Plugin
|
||||
|
||||
https://github.com/JaumeRF/linkfile-zsh
|
||||
|
||||
#### zsh-lux
|
||||
|
||||
https://github.com/pndurette/zsh-lux
|
||||
|
||||
```bash
|
||||
antibody bundle pndurette/zsh-lux
|
||||
```
|
||||
|
||||
#### Shelf
|
||||
|
||||
https://github.com/ecmma/shelf
|
||||
|
||||
```bash
|
||||
antibody bundle ecmma/shelf
|
||||
```
|
||||
|
||||
```bash
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Thèmes
|
||||
|
||||
#### Powerlevel10k
|
||||
|
||||
https://github.com/romkatv/powerlevel10k/#antibody
|
||||
|
||||
```bash
|
||||
antibody bundle romkatv/powerlevel10k
|
||||
```
|
||||
|
||||
```bash
|
||||
zinit ice depth"1" # git clone depth
|
||||
zinit light romkatv/powerlevel10k
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Pure
|
||||
|
||||
https://github.com/sindresorhus/pure
|
||||
|
||||
```bash
|
||||
antibody bundle sindresorhus/pure
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Plugins Managers
|
||||
|
||||
#### Zinit *
|
||||
|
||||
https://github.com/zdharma/zinit (2021) (zpluggin)*
|
||||
|
||||
#### zplug
|
||||
|
||||
https://github.com/zplug/zplug (R2017)(2020)*
|
||||
|
||||
|
||||
|
||||
https://github.com/zpm-zsh/zpm (2021)
|
||||
|
||||
https://github.com/tarjoilija/zgen (2018)
|
||||
|
||||
https://github.com/zsh-users/antigen (2018)
|
||||
|
||||
https://github.com/sorin-ionescu/prezto (2021)
|
||||
|
||||
https://github.com/getantibody/antibody (2020)
|
||||
|
||||
####
|
||||
|
||||
|
||||
|
||||
### Liens
|
||||
|
||||
https://github.com/unixorn/awesome-zsh-plugins
|
||||
|
||||
https://learnpracticeandshare.com/awesome-zsh-plugins-massive-collection-of-resources/#alf
|
||||
|
||||
95
docs/Divers/zsh/tools.md
Normal file
@@ -0,0 +1,95 @@
|
||||
### exa
|
||||
|
||||
https://the.exa.website/
|
||||
https://github.com/ogham/exa
|
||||
|
||||
#### Installation:
|
||||
|
||||
ubuntu 20.10+ : apt install exa
|
||||
debian : unstable repo
|
||||
https://github.com/ogham/exa/releases/download/v0.10.0/exa-linux-armv7-v0.10.0.zip
|
||||
http://ftp.br.debian.org/debian/pool/main/r/rust-exa/exa_0.10.1-1_arm64.deb
|
||||
sudo dpkg -i exa_0.10.1-1_arm64.deb
|
||||
|
||||
|
||||
|
||||
### fzf
|
||||
|
||||
https://github.com/junegunn/fzf
|
||||
|
||||
#### Installation:
|
||||
|
||||
Debian 9+ : sudo apt-get install fzf
|
||||
Ubuntu 19.10+ : sudo apt-get install fzf
|
||||
|
||||
|
||||
|
||||
### dotbare
|
||||
|
||||
|
||||
|
||||
### zoxide
|
||||
|
||||
https://github.com/ajeetdsouza/zoxide
|
||||
|
||||
#### Installation:
|
||||
|
||||
ubuntu 21.04+ : apt install zoxide
|
||||
debian11+ : apt install zoxide
|
||||
curl -sS https://webinstall.dev/zoxide | bash
|
||||
|
||||
#### Utilisation:
|
||||
|
||||
```bash
|
||||
j <tab>
|
||||
```
|
||||
|
||||
|
||||
|
||||
### diractions
|
||||
|
||||
https://github.com/AdrieanKhisbe/diractions
|
||||
|
||||
|
||||
|
||||
### rg
|
||||
|
||||
|
||||
|
||||
### rga
|
||||
|
||||
|
||||
|
||||
### dircolors
|
||||
|
||||
partie de coreutils
|
||||
http://www.gnu.org/software/coreutils/
|
||||
|
||||
#### Installation:
|
||||
|
||||
ubuntu : sudo apt install coreutils
|
||||
|
||||
|
||||
|
||||
### rust
|
||||
|
||||
https://www.rust-lang.org/
|
||||
wsl : curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
|
||||
|
||||
|
||||
### nanorc
|
||||
|
||||
```bash
|
||||
curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
sudo apt install cabextract p7zip-full unzip
|
||||
|
||||
mstsc.exe
|
||||
|
||||
|
||||
zinit
|
||||
|
||||
162
docs/Divers/zsh/zinit.md
Normal file
@@ -0,0 +1,162 @@
|
||||
# zinit
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
For more information see:
|
||||
- README section on the ice-modifiers:
|
||||
- https://github.com/zdharma/zinit#ice-modifiers,
|
||||
|
||||
- intro to Zinit at the Wiki:
|
||||
- https://zdharma.org/zinit/wiki/INTRODUCTION/,
|
||||
|
||||
- zinit-zsh GitHub account, which holds all the available Zinit annexes:
|
||||
- https://github.com/zinit-zsh/,
|
||||
|
||||
- For-Syntax article on the Wiki; it is less directly related to the ices, however, it explains how to use them conveniently:
|
||||
- https://zdharma.org/zinit/wiki/For-Syntax/.
|
||||
|
||||
- zdharma-continuum
|
||||
- https://github.com/zdharma-continuum/zinit
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Installation:
|
||||
|
||||
```bash
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zinit/master/doc/install.sh)"
|
||||
```
|
||||
|
||||
a
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
Downloading zinit-zsh/z-a-rust…
|
||||
▹▸▹▹▹ ███████████ OBJ: 100, PACK: 0/153, COMPR: 100%
|
||||
Note: Compiling: z-a-rust.plugin.zsh… OK.
|
||||
|
||||
Downloading zinit-zsh/z-a-as-monitor…
|
||||
▝ ███████████ OBJ: 100, PACK: 0/333, COMPR: 100%
|
||||
Note: Compiling: z-a-readurl.plugin.zsh… OK.
|
||||
|
||||
Downloading zinit-zsh/z-a-patch-dl…
|
||||
▐ ███████████ OBJ: 100, PACK: 0/105, COMPR: 100%
|
||||
Note: Compiling: z-a-patch-dl.plugin.zsh… OK.
|
||||
|
||||
Downloading zinit-zsh/z-a-bin-gem-node…
|
||||
▍ ███████████ OBJ: 100, PACK: 0/530, COMPR: 100%
|
||||
Note: Compiling: z-a-bin-gem-node.plugin.zsh… OK.
|
||||
bruno@airbook ~ %
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
❯ zinit zstatus
|
||||
Found existing alias for "zinit". You should use: "zini"
|
||||
Zinit's main directory: /Users/bruno/.zinit
|
||||
Zinit's binary directory: /Users/bruno/.zinit/bin
|
||||
Plugin directory: /Users/bruno/.zinit/plugins
|
||||
Completions directory: /Users/bruno/.zinit/completions
|
||||
Loaded plugins: 13
|
||||
Light loaded: 4
|
||||
Downloaded plugins: 14
|
||||
Enabled completions: 148
|
||||
Disabled completions: 0
|
||||
Completions available overall: 152
|
||||
Snippets loaded:
|
||||
Compiled plugins: 13
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
❯ zinit times
|
||||
Found existing alias for "zinit". You should use: "zini"
|
||||
Plugin loading times:
|
||||
1 ms - zinit-zsh/z-a-rust
|
||||
1 ms - zinit-zsh/z-a-as-monitor
|
||||
1 ms - zinit-zsh/z-a-patch-dl
|
||||
2 ms - zinit-zsh/z-a-bin-gem-node
|
||||
12 ms - romkatv/powerlevel10k
|
||||
5 ms - zdharma/history-search-multi-word
|
||||
5 ms - zsh-users/zsh-autosuggestions
|
||||
33 ms - zdharma/fast-syntax-highlighting
|
||||
12 ms - MichaelAquilina/zsh-you-should-use
|
||||
5 ms - ael-code/zsh-colored-man-pages
|
||||
4 ms - zsh-users/zsh-completions
|
||||
9 ms - marzocchi/zsh-notify
|
||||
19 ms - wfxr/forgit
|
||||
Total: 0.109 sec
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
# Self update
|
||||
zinit self-update
|
||||
|
||||
# Plugin update
|
||||
zinit update
|
||||
zinit update --no-pager --quiet
|
||||
|
||||
# Plugin parallel update
|
||||
zinit update --parallel
|
||||
|
||||
# Increase the number of jobs in a concurrent-set to 40
|
||||
zinit update --parallel 40
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
❯ zinit status
|
||||
Found existing alias for "zinit". You should use: "zini"
|
||||
Assuming --all is passed
|
||||
Updating Zinit…
|
||||
Note: status done also for unloaded plugins
|
||||
|
||||
Status for plugin MichaelAquilina/zsh-you-should-use
|
||||
Sur la branche master
|
||||
Votre branche est à jour avec 'origin/master'.
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
❯ zinit ls
|
||||
Found existing alias for "zinit". You should use: "zini"
|
||||
No `tree' program, it is required by the subcommand `ls'
|
||||
Download from: http://mama.indstate.edu/users/ice/tree/
|
||||
It is also available probably in all distributions and Homebrew, as package `tree'
|
||||
.
|
||||
├── OMZ::plugins
|
||||
└── plugins -> OMZ::plugins
|
||||
|
||||
2 directories, 0 files, located at ZINIT[SNIPPETS_DIR], i.e. /Users/bruno/.zinit/snippets
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
❯ zinit delete chipsenkbeil/zsh-notes
|
||||
Found existing alias for "zinit". You should use: "zini"
|
||||
Delete /Users/bruno/.zinit/plugins/chipsenkbeil---zsh-notes? (it holds: zsh-notes.plugin.zsh, .gitignore, LICENSE, README.md, more…)
|
||||
[yY/n…]
|
||||
y
|
||||
Done (action executed, exit code: 0)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Les plugins sont installés ici:
|
||||
|
||||
```bash
|
||||
/Users/bruno/.zinit/plugins/
|
||||
```
|
||||
|
||||
@@ -364,5 +364,45 @@ ESC - H: Affiche le MAN d'une commande
|
||||
|
||||
|
||||
|
||||
#### bookmarks:
|
||||
|
||||
[how-to-use-bookmarks-in-bash-zsh](https://threkk.medium.com/how-to-use-bookmarks-in-bash-zsh-6b8074e40774)
|
||||
|
||||
Ajouter au .zshrc
|
||||
|
||||
```bash
|
||||
if [ -d "$HOME/.bookmarks" ]; then
|
||||
export CDPATH=".:$HOME/.bookmarks:/"
|
||||
alias goto="cd -P"
|
||||
fi
|
||||
```
|
||||
|
||||
Créer le dossier .bookmarks
|
||||
|
||||
```bash
|
||||
mkdir ~/.bookmarks
|
||||
```
|
||||
|
||||
Ajouter les bookmarks:
|
||||
|
||||
```bash
|
||||
~/.bookmarks
|
||||
$ ln -s /Users/bruno/Documents/MySQL @MySQL_backup
|
||||
|
||||
~/.bookmarks
|
||||
$ ln -s $(brew --prefix)/var/mysql @MySQL_databases
|
||||
```
|
||||
|
||||
Utilisation:
|
||||
|
||||
```bash
|
||||
$ goto @<Tab>
|
||||
@MySQL_backup@ @MySQL_databases@ @kymsu@ @kymsu_git@ @scripts_bash@
|
||||
```
|
||||
|
||||
Pour [bash](https://twitter.com/mattn_jp/status/1434192554036137995)
|
||||
|
||||
|
||||
|
||||
http://grml.org/zsh/zsh-lovers.html
|
||||
|
||||
|
||||
@@ -217,3 +217,4 @@ Ajouter ce fichier au fichier de configuration `.nanorc`
|
||||
include "~/.nanosyntax/yml.nanorc"
|
||||
```
|
||||
|
||||
https://github.com/scopatz/nanorc
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
# ack
|
||||
|
||||
Remplaçant de *grep*
|
||||
|
||||
https://beyondgrep.com
|
||||
|
||||
|
||||
|
||||
Installation:
|
||||
|
||||
```bash
|
||||
$ brew install ack
|
||||
```
|
||||
|
||||
|
||||
49
docs/Linux/alternatives.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# alternatives
|
||||
|
||||
|
||||
|
||||
- [bat](bat.md)
|
||||
- [exa](exa.md)
|
||||
- [fd](fd.md)
|
||||
- [fzf](fzf.md)
|
||||
- [ripgrep](ripgrep.md)
|
||||
- [zoxide](zoxide.md)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### bat
|
||||
|
||||
alternative à *cat*
|
||||
|
||||
https://github.com/sharkdp/bat
|
||||
|
||||
### exa
|
||||
|
||||
alternative à *ls*
|
||||
|
||||
https://the.exa.website
|
||||
|
||||
### fd
|
||||
|
||||
alternative à *find*
|
||||
|
||||
https://github.com/sharkdp/fd
|
||||
|
||||
### fzf
|
||||
|
||||
https://github.com/junegunn/fzf
|
||||
|
||||
### ripgrep (rg)
|
||||
|
||||
alternative à *grep*
|
||||
|
||||
https://github.com/BurntSushi/ripgrep
|
||||
|
||||
### zoxide (z-zi)(j-ji)
|
||||
|
||||
alternative à *z plugin*
|
||||
|
||||
https://github.com/ajeetdsouza/zoxide
|
||||
|
||||
@@ -94,10 +94,59 @@ $ ls archive.tar
|
||||
|
||||
|
||||
|
||||
#### xz (tar 1.22+)
|
||||
|
||||
Compresser un fichier au format .xz:
|
||||
|
||||
```bash
|
||||
$ xz -k9 monfichier
|
||||
```
|
||||
|
||||
Compresser une archive au format .tar.xz:
|
||||
|
||||
```bash
|
||||
$ tar cfJ fichier.tar.xz mondossier
|
||||
```
|
||||
|
||||
Décompresser un fichier au format .xz:
|
||||
|
||||
```bash
|
||||
$ xz -d monfichier
|
||||
```
|
||||
|
||||
Décompresser une archive au format .tar.xz:
|
||||
|
||||
```bash
|
||||
$ tar -xJf fichier.tar.xz
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### zip
|
||||
|
||||
Compresser avec zip:
|
||||
|
||||
```
|
||||
zip <archive.zip> <file1> <file2>
|
||||
zip <archive.zip> <file*>
|
||||
```
|
||||
|
||||
```bash
|
||||
$ zip p10k.zip p1Ok.zsh
|
||||
adding: p1Ok.zsh (deflated 63%)
|
||||
```
|
||||
|
||||
Options:
|
||||
|
||||
- -q : pas des sortie écran
|
||||
- -Z bzip2 : méthode de compression bzip2 (deflate par défaut)
|
||||
- -9 ... -0 : niveau de compression (maxi -> mini)
|
||||
- -e : avec mot-de-passe
|
||||
|
||||
|
||||
|
||||
Compresser un dossier avec zip:
|
||||
|
||||
```bash
|
||||
$ zip -r scripts.zip scripts/
|
||||
adding: scripts/ (stored 0%)
|
||||
@@ -175,6 +224,46 @@ $ unzip -P password vegas.zip
|
||||
|
||||
|
||||
|
||||
#### tzst (Z Standard)
|
||||
|
||||
```bash
|
||||
$ sudo apt install zstd
|
||||
|
||||
$ brew install zstd
|
||||
```
|
||||
|
||||
Compresser:
|
||||
|
||||
```bash
|
||||
# Tous les .sh individuellement
|
||||
$ zstd *.sh
|
||||
26 files compressed :44.75% ( 24.7 KiB => 11.1 KiB)
|
||||
|
||||
# 1 archive pour tous les .sh
|
||||
$ tar --zstd -cf scripts.tar.zst *.sh
|
||||
|
||||
# Niveaux de compression: -1 à -19
|
||||
# Niveaux ultra (19 à 22): --ultra -22
|
||||
```
|
||||
|
||||
Décompresser:
|
||||
|
||||
```bash
|
||||
$ unzstd scripts.tar.zst
|
||||
$ zstd -d scripts.tar.zst
|
||||
scripts.tar.zst : 117248 bytes
|
||||
|
||||
$ tar --zstd -xf scripts.tar.zst
|
||||
```
|
||||
|
||||
BetterZip (macOS)
|
||||
|
||||
[Peazip](https://peazip.github.io/peazip-64bit.html) (Windows)
|
||||
|
||||
[7-zip-zstd](https://github.com/mcmilk/7-Zip-zstd) (command-line)
|
||||
|
||||
|
||||
|
||||
#### dmg (macOS)
|
||||
|
||||
Créer:
|
||||
|
||||
@@ -20,6 +20,8 @@ snowleopard macOS
|
||||
|
||||
|
||||
|
||||
### Colonnes:
|
||||
|
||||
Afficher la 1ere colonne d'un fichier:
|
||||
|
||||
```bash
|
||||
@@ -184,7 +186,76 @@ tiger
|
||||
snowleopard
|
||||
```
|
||||
|
||||
Trim toute la colonne:
|
||||
|
||||
```bash
|
||||
$ awk '{$1=$1;print}'
|
||||
```
|
||||
|
||||
Supprimer la 1ere colonne:
|
||||
|
||||
```bash
|
||||
$ awk '{$1=""; print $0}'
|
||||
|
||||
# les 3 premières colonnes
|
||||
$ awk '{$1=$2=$3=""; print $0}'
|
||||
```
|
||||
|
||||
Supprimer la dernière colonne:
|
||||
|
||||
```bash
|
||||
$ awk -F"/" 'BEGIN{OFS=FS} {NF--; print}'
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Lignes:
|
||||
|
||||
Afficher la 3eme ligne:
|
||||
|
||||
```bash
|
||||
$ awk 'NR==3' test.txt
|
||||
mint
|
||||
|
||||
$ awk 'FNR == 3 {print}'
|
||||
```
|
||||
|
||||
Afficher les ligne 2 à 4:
|
||||
|
||||
```bash
|
||||
$ awk 'NR>=2 && NR<=4' test.txt
|
||||
ubuntu
|
||||
mint
|
||||
debian
|
||||
```
|
||||
|
||||
Afficher 4e colonne de la 2e ligne:
|
||||
|
||||
```bash
|
||||
$ awk 'NR==2{print $4}'
|
||||
```
|
||||
|
||||
Supprimer les lignes vides:
|
||||
|
||||
```bash
|
||||
$ awk NF
|
||||
```
|
||||
|
||||
Nombre de lignes:
|
||||
|
||||
```bash
|
||||
$ awk 'END { print NR }' test.txt
|
||||
```
|
||||
|
||||
Supprimer tout après la 1ere ligne vide:
|
||||
|
||||
```bash
|
||||
$ awk '/^$/{exit} 1'
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Divers:
|
||||
|
||||
Passer un argument à awk:
|
||||
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
# bat
|
||||
|
||||
Remplaçant de cat
|
||||
Remplaçant de *cat*
|
||||
|
||||
https://github.com/sharkdp/bat
|
||||
|
||||
|
||||
|
||||
Installation:
|
||||
##### Installation:
|
||||
|
||||
```bash
|
||||
$ brew install bat
|
||||
$ brew install fzf
|
||||
```
|
||||
|
||||
Créer le fichier de configuration:
|
||||
##### Créer le fichier de configuration:
|
||||
|
||||
```bash
|
||||
$ bat --generate-config-file
|
||||
```
|
||||
|
||||
Editer la configuration:
|
||||
##### Editer la configuration:
|
||||
|
||||
```bash
|
||||
$ nano /Users/bruno/.config/bat/config
|
||||
```
|
||||
|
||||
Prévisualiser les thèmes:
|
||||
##### Prévisualiser les thèmes:
|
||||
|
||||
```bash
|
||||
$ bat --list-themes | fzf --preview="bat --theme={} --color=always /Users/bruno/Documents/Scripts/bash/zsh_tools.sh"
|
||||
```
|
||||
|
||||
Tail et bat:
|
||||
##### Tail et bat:
|
||||
|
||||
```bash
|
||||
$ tail -f /usr/local/var/log/httpd/error_log | bat --paging=never -l log
|
||||
@@ -43,7 +43,7 @@ $ tail -f /usr/local/var/log/httpd/error_log | bat --paging=never -l log
|
||||
4 [Fri Nov 27 16:22:54.278819 2020] [core:notice] [pid 10014] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
|
||||
```
|
||||
|
||||
Find et bat:
|
||||
##### Find et bat:
|
||||
|
||||
```bash
|
||||
$ find /usr -name error_log -exec bat {} +
|
||||
@@ -56,13 +56,64 @@ $ find /usr -name error_log -exec bat {} +
|
||||
|
||||
```
|
||||
|
||||
Man pages:
|
||||
##### Man pages:
|
||||
|
||||
```bash
|
||||
$ export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
man 2 select
|
||||
```
|
||||
|
||||
##### Afficher les caractères non-imprimables:
|
||||
|
||||
```bash
|
||||
❯ bat -A /etc/hosts
|
||||
|
||||
File: /etc/hosts
|
||||
1 ##␊
|
||||
2 #·Host·Database␊
|
||||
3 #␊
|
||||
4 #·localhost·is·used·to·configure·the·loopback·interface␊
|
||||
5 #·when·the·system·is·booting.··Do·not·change·this·entry.␊
|
||||
6 ##␊
|
||||
7 127.0.0.1├──┤localhost␊
|
||||
8 255.255.255.255├──┤broadcasthost␊
|
||||
9 ::1·············localhost␊
|
||||
10 #·Added·by·Docker·Desktop␊
|
||||
11 #·To·allow·the·same·kube·context·to·work·on·the·host·and·the·container:␊
|
||||
12 127.0.0.1·kubernetes.docker.internal␊
|
||||
13 #·End·of·section␊
|
||||
```
|
||||
|
||||
##### Voir plusieurs fichiers en même temps:
|
||||
|
||||
```bash
|
||||
$ bat plugins.d/*.sh
|
||||
|
||||
File: plugins.d/00-kymsu.sh
|
||||
1 #!/usr/bin/env bash
|
||||
2 echo "🦄 KYMSU self update"
|
||||
3 pushd "$(cat ~/.kymsu/path)" > /dev/null
|
||||
4 git pull
|
||||
5 popd > /dev/null
|
||||
6 echo ""
|
||||
|
||||
File: plugins.d/antibody.sh
|
||||
1 #!/usr/bin/env bash
|
||||
2
|
||||
3 # Antibody plugin for KYMSU
|
||||
4 # https://github.com/welcoMattic/kymsu
|
||||
5 # https://github.com/getantibody/antibody
|
||||
6
|
||||
|
||||
File: plugins.d/conda.sh
|
||||
1 #!/usr/bin/env bash
|
||||
2
|
||||
3 # conda plugin for KYMSU
|
||||
4 # https://github.com/welcoMattic/kymsu
|
||||
5
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## bat-extras
|
||||
|
||||
@@ -119,7 +119,7 @@ $ usermod -G "" <username>
|
||||
|
||||
|
||||
|
||||
### Code de sortie:
|
||||
### Code de sortie (code de retour):
|
||||
|
||||
Chaque commande renvoie un *code de sortie* (quelque fois nommé *état de retour* ).
|
||||
|
||||
@@ -136,6 +136,7 @@ $ hostname
|
||||
silverbook.home
|
||||
$ echo $?
|
||||
0
|
||||
|
||||
$ hostnam
|
||||
-bash: hostnam: command not found
|
||||
$ echo $?
|
||||
@@ -149,3 +150,18 @@ bruno@SilverBook:~/.kymsu/plugins.d$ if [ $? -eq 0 ]; then echo "ok"; else echo
|
||||
ok
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ pip3 install -U "pip"
|
||||
ret=$?
|
||||
|
||||
# pas d'update: ret=0
|
||||
[ $ret -eq 0 ] && echo -e "No update available !"
|
||||
|
||||
if [ $ret -eq 0 ]; then
|
||||
echo -e "No update available !"
|
||||
fi
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -95,6 +95,25 @@ gd.jpeg_ignore_warning = 1 | session.cookie_samesite =
|
||||
|
||||
|
||||
|
||||
##### Comparer un fichier local et un fichier distant:
|
||||
|
||||
```bash
|
||||
$ ssh bruno@212.227.191.167 "cat upgrade_nextcloud.sh" | diff - /Users/bruno/Documents/Scripts/bash/upgrade_nextcloud.sh | colordiff
|
||||
35c35
|
||||
< php_version=7.4
|
||||
---
|
||||
> php_version=8.0
|
||||
|
||||
```
|
||||
|
||||
##### Comparer 2 fichiers distants sur 2 serveurs différents:
|
||||
|
||||
```bash
|
||||
$ diff <(ssh user@remote-host1 'cat /path/to/file1') <(ssh user@remote-host2 'cat /path/to/file2')
|
||||
```
|
||||
|
||||
|
||||
|
||||
Colordiff peut comparer 2 dossiers:
|
||||
|
||||
```bash
|
||||
@@ -113,6 +132,14 @@ Files photonix/docker-compose.yml and photoprism/docker-compose.yml differ
|
||||
### diffmerge (GUI):
|
||||
|
||||
```bash
|
||||
❯ diffmerge config.json config.json.bak
|
||||
$ diffmerge config.json config.json.bak
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Comparer 2 dossiers:
|
||||
|
||||
```bash
|
||||
$ diff --brief --recursive bootstrap_darkroom/ s
|
||||
```
|
||||
|
||||
|
||||
@@ -100,6 +100,16 @@ if [ -d directory ]; then
|
||||
if [ -d ~/.kde ]; then
|
||||
```
|
||||
|
||||
Si le répertoire *<u>directory</u>* existe ET n'est <u>pas vide</u>
|
||||
|
||||
```bash
|
||||
local_path=$HOME/Sites/
|
||||
|
||||
if find "$local_path/node_modules" -mindepth 1 -maxdepth 1 | read; then echo "dir not empty"; else echo "dir empty"; fi
|
||||
|
||||
if [ -d "$local_path/node_modules" ] && [ -n "$(ls -A "$local_path/node_modules")" ]; then echo "dir not empty"; else echo "dir empty"; fi
|
||||
```
|
||||
|
||||
Si le fichier *<u>regularfile</u> (ni un blockspecialfile, ni un characterspecialfile, ni un directory)* existe
|
||||
|
||||
```bash
|
||||
@@ -472,3 +482,8 @@ echo "Input is a string."
|
||||
fi
|
||||
```
|
||||
|
||||
```bash
|
||||
# entier
|
||||
if [ -z "${i//[0-9]}" ]; then
|
||||
```
|
||||
|
||||
|
||||
10
docs/Linux/cut.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# cut
|
||||
|
||||
|
||||
|
||||
- séparateur par défaut: TAB
|
||||
|
||||
- sinon option -d ' '
|
||||
|
||||
|
||||
|
||||
@@ -12,3 +12,11 @@
|
||||
|
||||
|
||||
|
||||
#### Origine d'un lien:
|
||||
|
||||
```bash
|
||||
/usr/local/bin
|
||||
❯ readlink -f kymsu2
|
||||
/Users/bruno/Documents/Scripts/kymsu2/kymsu2.sh
|
||||
```
|
||||
|
||||
|
||||
99
docs/Linux/du-df.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# du - df
|
||||
|
||||
|
||||
|
||||
### du
|
||||
|
||||
Options:
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
[sentier@localhost thumbsup]$ ls -la
|
||||
|
||||
total 32
|
||||
drwxrwxr-x 5 sentier psacln 4096 févr. 18 16:55 .
|
||||
drwxrwxr-x 22 sentier psaserv 4096 févr. 18 17:09 ..
|
||||
-rw-r--r-- 1 sentier psacln 440 févr. 7 10:55 config-npm.json
|
||||
drwxrwxr-x 6 sentier psacln 4096 févr. 26 18:24 Nas
|
||||
drwxr-xr-x 5 sentier psacln 4096 févr. 7 10:46 theme-flow
|
||||
drwxr-xr-x 5 sentier psacln 4096 févr. 7 10:46 theme-flow-bruno
|
||||
-rw-r--r-- 1 sentier psacln 24 févr. 7 11:39 theme_options.json
|
||||
-rwxr-xr-x 1 sentier psacln 1317 févr. 12 15:27 thumbsup-npm.sh
|
||||
```
|
||||
|
||||
Connaitre la taille des dossiers et fichiers d'un répertoire:
|
||||
|
||||
|
||||
```bash
|
||||
[sentier@localhost thumbsup]$ du -ach . --max-depth 1
|
||||
|
||||
4,0K ./config-npm.json
|
||||
4,0K ./theme_options.json
|
||||
4,0K ./thumbsup-npm.sh
|
||||
668M ./Nas
|
||||
2,2M ./theme-flow
|
||||
2,2M ./theme-flow-bruno
|
||||
672M .
|
||||
672M total
|
||||
```
|
||||
|
||||
Connaitre la taille des dossiers (et sous-dossiers) d'un répertoire:
|
||||
|
||||
```bash
|
||||
[sentier@localhost thumbsup]$ du -h
|
||||
|
||||
21M ./Nas/Motos/24H Mans
|
||||
11M ./Nas/Motos/GP France
|
||||
...
|
||||
672M .
|
||||
```
|
||||
|
||||
|
||||
|
||||
Afficher la taille totale d'un répertoire:
|
||||
|
||||
```bash
|
||||
[sentier@localhost thumbsup]$ du -sh Nas/
|
||||
|
||||
668M Nas/
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
[sentier@localhost thumbsup]$ du -Sh Nas/
|
||||
|
||||
21M Nas/Motos/24H Mans
|
||||
11M Nas/Motos/GP France
|
||||
9,3M Nas/Motos/Bol Classic
|
||||
...
|
||||
4,0K Nas/Faune
|
||||
4,0K Nas/_Archived Items
|
||||
4,0K Nas/
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### df (espace libre)
|
||||
|
||||
Options:
|
||||
|
||||
- T: Type
|
||||
- h: Human
|
||||
|
||||
```bash
|
||||
[sentier@localhost Nas]$ df -hT
|
||||
Filesystem Type Size Used Avail Use% Mounted on
|
||||
udev devtmpfs 1,9G 0 1,9G 0% /dev
|
||||
tmpfs tmpfs 393M 1,3M 391M 1% /run
|
||||
/dev/mapper/vg00-lv01 ext4 47G 38G 7,1G 85% /
|
||||
tmpfs tmpfs 2,0G 0 2,0G 0% /dev/shm
|
||||
tmpfs tmpfs 5,0M 24K 5,0M 1% /run/lock
|
||||
tmpfs tmpfs 2,0G 0 2,0G 0% /sys/fs/cgroup
|
||||
/dev/sda1 ext4 464M 115M 321M 27% /boot
|
||||
tmpfs tmpfs 393M 0 393M 0% /run/user/10001
|
||||
```
|
||||
|
||||
37
docs/Linux/exa.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# exa
|
||||
|
||||
Remplaçant de *ls*
|
||||
|
||||
https://the.exa.website
|
||||
|
||||
Installation:
|
||||
|
||||
```bash
|
||||
$ brew install exa
|
||||
```
|
||||
|
||||
|
||||
|
||||
exa n'est plus maintenant. Il est remplacé par eza.
|
||||
|
||||
# eza
|
||||
|
||||
https://github.com/eza-community/eza
|
||||
|
||||
|
||||
|
||||
**exa -lbhHigUmuSa@ --time-style=long-iso --git --color-scale**
|
||||
|
||||
```bash
|
||||
$ exa -lbhHigUmuSa@ --time-style=long-iso --git --color-scale
|
||||
inode Permissions Links Size Blocks User Group Date Modified Date Created Date Accessed Git Name
|
||||
3426575 drwxr-xr-x 12 - - bruno staff 2021-08-05 17:33 2021-08-05 09:35 2021-08-05 17:33 -- .git
|
||||
3426645 drwxr-xr-x 3 - - bruno staff 2021-08-05 09:35 2021-08-05 09:35 2021-08-05 17:32 -- img
|
||||
3426641 .rw-r--r-- 1 1,1Ki 8 bruno staff 2021-08-05 09:35 2021-08-05 09:35 2021-08-05 09:35 -- LICENSE
|
||||
3426642 .rw-r--r-- 1 1,4Ki 8 bruno staff 2021-08-05 09:35 2021-08-05 09:35 2021-08-05 09:35 -- Pure Dark.alfredappearance
|
||||
3426643 .rw-r--r--@ 1 1,4Ki 8 bruno staff 2021-08-05 09:35 2021-08-05 09:35 2021-08-05 09:36 -- Pure Light.alfredappearance
|
||||
└── com.apple.lastuseddate#PS (len 16)
|
||||
3426644 .rw-r--r-- 1 316 8 bruno staff 2021-08-05 09:35 2021-08-05 09:35 2021-08-05 09:36 -- README.md
|
||||
|
||||
```
|
||||
|
||||
112
docs/Linux/fd.md
@@ -2,6 +2,10 @@
|
||||
|
||||
(alternative à [find](find.md)) (macOS / Linux / Windows)
|
||||
|
||||
https://github.com/sharkdp/fd
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ brew install fd
|
||||
```
|
||||
@@ -12,7 +16,7 @@ choco install fd
|
||||
|
||||
|
||||
|
||||
Recherche un fichier dans le répertoire courant (et sous-dossiers):
|
||||
##### Recherche un fichier dans le répertoire courant (et sous-dossiers):
|
||||
|
||||
```bash
|
||||
~ master* ⇡
|
||||
@@ -25,41 +29,42 @@ pip/pip.conf
|
||||
|
||||
```
|
||||
|
||||
Recherche dans un répertoire particulier:
|
||||
##### Recherche dans un répertoire particulier:
|
||||
|
||||
```bash
|
||||
~ master* ⇡
|
||||
❯ fd -HI 'id_*' .ssh
|
||||
$ fd -HI 'id_*' .ssh
|
||||
.ssh/id_ed25519
|
||||
.ssh/id_ed25519.pub
|
||||
.ssh/id_rsa
|
||||
.ssh/id_rsa.pub
|
||||
.ssh/id_rsa.zip
|
||||
|
||||
❯ fd -HI 'id_*' $HOME/.ssh
|
||||
/Users/bruno/.ssh/id_ed25519
|
||||
/Users/bruno/.ssh/id_ed25519.pub
|
||||
/Users/bruno/.ssh/id_rsa
|
||||
/Users/bruno/.ssh/id_rsa.pub
|
||||
```
|
||||
|
||||
Recherche par regex:
|
||||
##### Recherche par regex:
|
||||
|
||||
```bash
|
||||
~ master* ⇡ 4m 27s
|
||||
❯ fd -HI '^h.*.conf$' /etc
|
||||
/etc/apache2/extra/httpd-autoindex.conf
|
||||
/etc/apache2/extra/httpd-dav.conf
|
||||
/etc/apache2/extra/httpd-default.conf
|
||||
/etc/apache2/extra/httpd-info.conf
|
||||
/etc/apache2/extra/httpd-languages.conf
|
||||
/etc/apache2/extra/httpd-manual.conf
|
||||
/etc/apache2/extra/httpd-mpm.conf
|
||||
/etc/apache2/extra/httpd-multilang-errordoc.conf
|
||||
/etc/apache2/extra/httpd-ssl.conf
|
||||
/etc/apache2/extra/httpd-userdir.conf
|
||||
/etc/apache2/extra/httpd-vhosts.conf
|
||||
/etc/apache2/httpd.conf
|
||||
$ fd -I '^.*.conf$' /opt
|
||||
/opt/homebrew/share/autoconf
|
||||
/opt/homebrew/share/user_map.conf
|
||||
/opt/homebrew/Cellar/mariadb/10.6.4/share/user_map.conf
|
||||
/opt/homebrew/Cellar/groonga/11.0.5/etc/groonga/groonga.conf
|
||||
/opt/homebrew/Cellar/groonga/11.0.5/etc/groonga/httpd/fastcgi.conf
|
||||
...
|
||||
|
||||
$ fd -H '^.*.conf$' /opt
|
||||
|
||||
$
|
||||
```
|
||||
|
||||
https://docs.rs/regex/1.0.0/regex/#syntax
|
||||
|
||||
Fichiers se terminant par *'[0-9].jpg'*:
|
||||
##### Fichiers se terminant par *'[0-9].jpg'*:
|
||||
|
||||
```bash
|
||||
$ fd -HI '.*[0-9]\.jpg$' ~
|
||||
@@ -67,17 +72,74 @@ $ fd -HI '.*[0-9]\.jpg$' ~
|
||||
$ find ~ -iname '*[0-9].jpg'
|
||||
```
|
||||
|
||||
Sans arguments:
|
||||
##### Sans arguments:
|
||||
|
||||
```bash
|
||||
# afficher tous les entrées du répertoire courant
|
||||
$ fd
|
||||
|
||||
# afficher tous les entrées d'un répertoire
|
||||
$ fd . $HOME/.ssh
|
||||
/Users/bruno/.ssh/config
|
||||
/Users/bruno/.ssh/id_ed25519
|
||||
/Users/bruno/.ssh/id_ed25519.pub
|
||||
/Users/bruno/.ssh/id_rsa
|
||||
/Users/bruno/.ssh/id_rsa.pub
|
||||
/Users/bruno/.ssh/known_hosts
|
||||
```
|
||||
|
||||
##### Chercher un fichier précis:
|
||||
|
||||
```bash
|
||||
$ fd -I -g php.ini /opt
|
||||
/opt/homebrew/etc/php/7.4/php.ini
|
||||
/opt/homebrew/etc/php/8.0/php.ini
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Option:
|
||||
|
||||
- **-H, --hidden**: cherche dans les fichiers et dossiers cachés
|
||||
- **-I, --no-ignore**: cherche dans les fichiers et dossiers ignorés par '.gitignore', '.ignore', '.fdignore'
|
||||
- **-x, --exec <cmd>**: exécute une commande pour chaque résultat
|
||||
- **-X, --exec-batch <cmd>**: exécute une commande pour tous les résultats en même temps
|
||||
- **-s, --case-sensitive**:
|
||||
- **-i, --ignore-case**: (défaut)
|
||||
- **-l, --list-details**
|
||||
- **-L, --follow**: suit les liens symboliques (pas par défaut)
|
||||
- **-d, --max-depth <depth>**: limite le nombre de répertoires traversés (pas de limite par défaut)
|
||||
- **-t, --type <filetype>...**: filtre par type de fichiers
|
||||
- 'f' or 'file': fichiers réguliers
|
||||
- 'd' or 'directory': répertoires
|
||||
- 'l' or 'symlink': liens symboliques
|
||||
- 'x' or 'executable': executables
|
||||
- 'e' or 'empty': fichiers vides ou répertoires
|
||||
- 's' or 'socket': socket
|
||||
- 'p' or 'pipe': named pipe (FIFO)
|
||||
- **-e, --extension <ext>...**: filtre par extension (plusieurs autorisées)
|
||||
- **-E, --exclude <pattern>...**: exclure des fichiers/répertoires des résultats (--exclude '*.pyc', --exclude node_modules)
|
||||
- **-c, --color <when>**: colorie chaque chaine trouvée ('auto', 'never', 'always')
|
||||
- **-S, --size <size>...**: filtre par la taille des fichiers (+3k, -500, +1g, 300)
|
||||
- **--changed-within <date|dur>**: filtre par la date de modification
|
||||
- --changed-within 2 weeks (10h, 1d, 35min)
|
||||
- --change-newer-than '2018-10-27 10:00:00'
|
||||
- **--changed-before <date|dur>**: filtre par la date de modification
|
||||
- --changed-before '2018-10-27 10:00:00'
|
||||
- --change-older-than 2weeks (10h, 1d, 35min)
|
||||
- **-o, --owner <user:group>**: filtre par utilisateur/groupe (--owner bruno, --owner :staff, --owner '!john:students')
|
||||
- **--max-results <count>**: limite le nombre de résultats à 'count' et quitte
|
||||
|
||||
|
||||
Option:
|
||||
|
||||
- --hidden: cherche dans les dossiers cachés
|
||||
- --no-ignore:
|
||||
- -x / --exec:
|
||||
```bash
|
||||
# -l, --list-details
|
||||
|
||||
$ fd -Il '^.*.conf$' /opt/homebrew/etc
|
||||
-rw-r--r-- 1 bruno admin 696 jul 24 07:46 /opt/homebrew/etc/fonts/conf.d/10-hinting-slight.conf
|
||||
-rw-r--r-- 1 bruno admin 2,2K jul 24 07:46 /opt/homebrew/etc/fonts/conf.d/10-scale-bitmap-fonts.conf
|
||||
-rw-r--r-- 1 bruno admin 1,6K jul 24 07:46 /opt/homebrew/etc/fonts/conf.d/20-unhint-small-vera.conf
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,11 +25,19 @@ Les <u>critères de recherche</u> sont les suivants :
|
||||
|
||||
#### Nom:
|
||||
|
||||
Recherche par <u>nom de fichier</u>:
|
||||
Recherche par <u>nom</u> (**-name**) (sensible à la case):
|
||||
|
||||
```bash
|
||||
# Le nom exact: toto
|
||||
|
||||
$ find /usr -name toto -print
|
||||
|
||||
# Le nom contient: Casa
|
||||
|
||||
$ find /usr -name "*Casa*"
|
||||
|
||||
# L'extension est .c
|
||||
|
||||
$ find /usr -name " *.c " -print
|
||||
|
||||
# commence par un a ou A, suivi de quelque chose, et se termine par un chiffre compris entre 3 et 6
|
||||
@@ -37,13 +45,52 @@ $ find /usr -name " *.c " -print
|
||||
$ find . -name '[aA]*[3-6]' -print
|
||||
```
|
||||
|
||||
Recherche par <u>nom</u> (**-iname**) (non sensible à la case):
|
||||
|
||||
```bash
|
||||
# Le nom exact: toto
|
||||
|
||||
$ find /usr -iname toto -print
|
||||
```
|
||||
|
||||
Cela renvoie à la fois des fichiers et des dossiers. Pour avoir le choix fichiers ou dossiers (**-type**):
|
||||
|
||||
```bash
|
||||
# Pour les fichiers uniquement
|
||||
|
||||
$ find /usr -name toto -type f
|
||||
|
||||
# Pour les dossiers uniquement
|
||||
|
||||
$ find /usr -name toto -type d
|
||||
```
|
||||
|
||||
Ne pas afficher les fichiers ou dossiers invisibles:
|
||||
|
||||
```bash
|
||||
$find -not -path '*/\.*'
|
||||
|
||||
$find . -type f | grep -v '/\.'
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Taille:
|
||||
|
||||
Recherche suivant la <u>taille</u>:
|
||||
Recherche suivant la <u>taille</u> (**-size**):
|
||||
|
||||
- c: octet
|
||||
- k: kilo
|
||||
- M: méga
|
||||
- G: giga
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
# fichiers de 30ko
|
||||
|
||||
$ find / -size 30k -print
|
||||
|
||||
# fichiers dont la taille dépasse 30ko
|
||||
|
||||
$ find / -size +30k -print
|
||||
@@ -51,6 +98,24 @@ $ find / -size +30k -print
|
||||
# fichiers dont la taille est comprise entre 30 et 100ko
|
||||
|
||||
$ find / -size +30k -size -100k
|
||||
|
||||
# fichiers de moins de 30ko
|
||||
|
||||
$ find / -size -30k -print
|
||||
|
||||
|
||||
# répertoire de plus de 30k
|
||||
|
||||
$ find / -type d -size +30k -print
|
||||
```
|
||||
|
||||
```bash
|
||||
# fichier ou répertoire vide
|
||||
|
||||
$ find / -size 0
|
||||
$ find / -empty
|
||||
|
||||
find / -type d -empty
|
||||
```
|
||||
|
||||
|
||||
@@ -60,7 +125,7 @@ $ find / -size +30k -size -100k
|
||||
Recherche en utilisant les <u>opérateurs logiques</u>:
|
||||
|
||||
```bash
|
||||
# les fichiers n'appartenant pas à l'utilisateur olivierles fichiers n'appartenant pas à l'utilisateur olivier
|
||||
# Recherche les fichiers n'appartenant pas à l'utilisateur olivier.
|
||||
|
||||
$ find . ! -user olivier -print
|
||||
|
||||
@@ -68,6 +133,10 @@ $ find . ! -user olivier -print
|
||||
|
||||
$ find . \ ( -name a.out -o -name " *.c " \ ) -print
|
||||
|
||||
# Recherche les fichiers dont l'extension est .pdf, .txt ou .doc
|
||||
|
||||
$ find . -type f ( -name "*.txt" -o -name "*.pdf" -o -name "*.doc" )
|
||||
|
||||
# Recherche des fichiers dont le nom est core et d'une taille supérieure à 1Mo (une condition ET l'autre).
|
||||
|
||||
$ find . \ (-name core -a size +2000 \ ) -print
|
||||
@@ -83,7 +152,7 @@ Rechercher <u>le plus vieux</u> fichier:
|
||||
$ find / -type f -printf '%T+ %p\n' | sort | head -n 1
|
||||
```
|
||||
|
||||
Recherche suivant la <u>date de dernière modification</u>:
|
||||
Recherche suivant la <u>date de dernière modification</u> (**-mtime**):
|
||||
|
||||
```bash
|
||||
# modifiés il y a 30 jours
|
||||
@@ -318,6 +387,9 @@ find: ‘/volume1/@appstore/Gitea/gitea/.ssh’: Permission denied
|
||||
```
|
||||
Tous les messages d'erreurs sont redirigés avec `2>/dev/null` vers la poubelle.
|
||||
```bash
|
||||
$ find / -name site-packages -type d -print 2>/dev/null
|
||||
|
||||
|
||||
$ find /volume1/@appstore/ -name "*php*.ini" 2>/dev/null
|
||||
/volume1/@appstore/PHP7.0/usr/local/etc/php70/php.ini
|
||||
/volume1/@appstore/PHP7.2/misc/php-fpm.ini
|
||||
|
||||
@@ -27,14 +27,85 @@ Parcourir les arguments passés au script:
|
||||
```bash
|
||||
for i in "$@"
|
||||
do
|
||||
echo "$i"
|
||||
echo "Hi $i"
|
||||
done
|
||||
```
|
||||
|
||||
Parcourrir une liste:
|
||||
|
||||
```bash
|
||||
for i in {1..5}
|
||||
do
|
||||
echo "Hi $i"
|
||||
done
|
||||
|
||||
Hi 1
|
||||
Hi 2
|
||||
Hi 3
|
||||
Hi 4
|
||||
Hi 5
|
||||
```
|
||||
|
||||
```bash
|
||||
# bash 4.0+
|
||||
for i in {0. .8. .2} # debut. .fin. .increment
|
||||
do
|
||||
echo "Hi $i"
|
||||
done
|
||||
|
||||
Hi 0
|
||||
Hi 2
|
||||
Hi 4
|
||||
Hi 6
|
||||
Hi 8
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
for ((i=0 ; 10 - $i ; i++))
|
||||
do echo $i
|
||||
do
|
||||
echo "Hi $i"
|
||||
done
|
||||
```
|
||||
```
|
||||
|
||||
```bash
|
||||
for (( c=1; c<=5; c++ ))
|
||||
do
|
||||
echo "Hi $c"
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Continue
|
||||
|
||||
```bash
|
||||
for i in {1..5}
|
||||
do
|
||||
[[ "$i" == '4' ]] && continue;
|
||||
echo "Hi $i"
|
||||
done
|
||||
|
||||
Hi 1
|
||||
Hi 2
|
||||
Hi 3
|
||||
Hi 5
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Break
|
||||
|
||||
```bash
|
||||
for i in {1..5}
|
||||
do
|
||||
[[ "$i" == '4' ]] && break;
|
||||
echo "Hi $i"
|
||||
done
|
||||
|
||||
Hi 1
|
||||
Hi 2
|
||||
Hi 3
|
||||
```
|
||||
|
||||
|
||||
241
docs/Linux/fzf.md
Normal file
@@ -0,0 +1,241 @@
|
||||
# fzf
|
||||
|
||||
|
||||
|
||||
https://github.com/junegunn/fzf
|
||||
|
||||
https://github.com/junegunn/fzf/wiki
|
||||
|
||||
https://sim590.github.io/fr/outils/fzf/#extension-de-la-complétion
|
||||
|
||||
https://github.com/junegunn/fzf/wiki/examples
|
||||
|
||||
https://github.com/junegunn/fzf/blob/master/ADVANCED.md
|
||||
|
||||
|
||||
|
||||
### Installation:
|
||||
|
||||
```bash
|
||||
$ brew install fzf
|
||||
|
||||
# To install useful key bindings and fuzzy completion:
|
||||
$ $(brew --prefix)/opt/fzf/install
|
||||
```
|
||||
|
||||
##### Syntaxe:
|
||||
|
||||
| Token | Match type | Description |
|
||||
| --------- | -------------------------- | ------------------------------------ |
|
||||
| `sbtrkt` | fuzzy-match | Items that match `sbtrkt` |
|
||||
| `'wild` | exact-match (quoted) | Items that include `wild` |
|
||||
| `^music` | prefix-exact-match | Items that start with `music` |
|
||||
| `.mp3$` | suffix-exact-match | Items that end with `.mp3` |
|
||||
| `!fire` | inverse-exact-match | Items that do not include `fire` |
|
||||
| `!^music` | inverse-prefix-exact-match | Items that do not start with `music` |
|
||||
| `!.mp3$` | inverse-suffix-exact-match | Items that do not end with `.mp3` |
|
||||
|
||||
Options
|
||||
|
||||
Search mode
|
||||
-e, --exact
|
||||
Enable exact-match
|
||||
|
||||
-i Case-insensitive match (default: smart-case match)
|
||||
|
||||
+i Case-sensitive match
|
||||
|
||||
|
||||
|
||||
### Utilisation 1:
|
||||
|
||||
```bash
|
||||
~/Documents/Scripts_Raspberry master* 19s 17:46:16
|
||||
$ find . | fzf
|
||||
```
|
||||
|
||||
puis on entre des mots-clé pour affiner la recherche.
|
||||
|
||||
<img src="/Users/bruno/Documents/docs/docs/Linux/fzf2.png" alt="fzf2" style="zoom:50%;" />
|
||||
|
||||
|
||||
|
||||
### Utilisation 2:
|
||||
|
||||
```bash
|
||||
~/Documents/Scripts_Raspberry master*
|
||||
$ nano $(fzf)
|
||||
```
|
||||
|
||||
On filtre: 'led
|
||||
|
||||
<img src="/Users/bruno/Documents/docs/docs/Linux/fzf.png" alt="fzf" style="zoom:50%;" />
|
||||
|
||||
|
||||
|
||||
**Return** ouvre le fichier dans nano.
|
||||
|
||||
On peut ouvrir plusieurs fichiers dans nano:
|
||||
|
||||
```bash
|
||||
~/Documents/Scripts_Raspberry master*
|
||||
$ nano $(fzf -m)
|
||||
```
|
||||
|
||||
puis **Tab** pour sélectionner plusieurs fichiers et **Return** pour les ouvrir.
|
||||
|
||||
|
||||
|
||||
### Fuzzy completion
|
||||
|
||||
Déclencheur: ** puis <Tab>
|
||||
|
||||
|
||||
|
||||
##### Utilisation 3 (complétion de cd):
|
||||
|
||||
```bash
|
||||
~/Documents/Scripts_Raspberry master* 18:00:32
|
||||
$ cd **
|
||||
```
|
||||
|
||||
Puis **Tab**
|
||||
|
||||
<img src="/Users/bruno/Documents/docs/docs/Linux/fzf3.png" alt="fzf3" style="zoom:50%;" />
|
||||
|
||||
Puis **Return**
|
||||
|
||||
```bash
|
||||
~/Documents/Scripts_Raspberry master*
|
||||
$ cd SiriControl/
|
||||
|
||||
~/Documents/Scripts_Raspberry/SiriControl master*
|
||||
$
|
||||
```
|
||||
|
||||
La complétion marche aussi avec la <u>commande ssh</u>: les serveurs sont tirés de /etc/hosts et de ssh/config.
|
||||
|
||||
|
||||
|
||||
### Utilisation 4 (kill):
|
||||
|
||||
Taper **kill** puis **Espace** puis **Tab**
|
||||
|
||||
```bash
|
||||
$ kill<espace>
|
||||
```
|
||||
|
||||
<img src="/Users/bruno/Documents/docs/docs/Linux/fzf4.png" alt="fzf4" style="zoom:50%;" />
|
||||
|
||||
**Tab** pour sélectionner les process à tuer puis **Return**:
|
||||
|
||||
```bash
|
||||
~/Documents/Scripts_Raspberry/SiriControl master*
|
||||
$ kill 266 311
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Utilisation 5 (complétion de cat):
|
||||
|
||||
```bash
|
||||
~/Documents/Scripts_Raspberry master*
|
||||
$ cat **
|
||||
```
|
||||
|
||||
Puis **Tab**
|
||||
|
||||
<img src="/Users/bruno/Documents/docs/docs/Linux/fzf5.png" alt="fzf5" style="zoom:100%;" />
|
||||
|
||||
Puis **Return**
|
||||
|
||||
```bash
|
||||
~/Documents/Scripts_Raspberry master*
|
||||
$ cat pir/pir2.py
|
||||
```
|
||||
|
||||
La complétion marche aussi avec les variables d'environnement.
|
||||
|
||||
```bash
|
||||
$ unset **<Tab>
|
||||
$ unalias **<Tab>
|
||||
$ export **<Tab>
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Utilisation 6 (complétion de nano):
|
||||
|
||||
```bash
|
||||
~/Documents/Scripts_Raspberry master*
|
||||
$ nano /opt/**
|
||||
```
|
||||
|
||||
Puis **Tab**
|
||||
|
||||
<img src="/Users/bruno/Documents/docs/docs/Linux/fzf6.png" alt="fzf6" style="zoom:100%;" />
|
||||
|
||||
Puis **Return**
|
||||
|
||||
```bash
|
||||
~/Documents/Scripts_Raspberry master*
|
||||
$ nano /opt/homebrew/etc/httpd/httpd.conf
|
||||
```
|
||||
|
||||
|
||||
|
||||
Lancer la fuzzy recherche dans le répertoire parent:
|
||||
|
||||
```bash
|
||||
~/Documents/Scripts_Raspberry master*
|
||||
$ nano ../**
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Options:
|
||||
|
||||
```bash
|
||||
fzf --height 40% --layout reverse --info inline --border \
|
||||
--preview 'bat --style=numbers --color=always --line-range :500 {}' --preview-window right \
|
||||
--color 'fg:#bbccdd,fg+:#ddeeff,bg:#334455,preview-bg:#223344,border:#778899'
|
||||
```
|
||||
|
||||
```bash
|
||||
# .zshrc
|
||||
|
||||
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"
|
||||
#export FZF_DEFAULT_COMMAND="find ."
|
||||
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow'
|
||||
# --preview "bat --style=numbers --color=always --line-range :500 {}" --preview="head -$LINES {}"
|
||||
export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border'
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
https://bluz71.github.io/2018/11/26/fuzzy-finding-in-bash-with-fzf.html
|
||||
|
||||
https://curatedgo.com/r/fzf-is-a-junegunnfzf/index.html
|
||||
|
||||
https://thevaluable.dev/practical-guide-fzf-example/
|
||||
|
||||
https://pragmaticpineapple.com/four-useful-fzf-tricks-for-your-terminal/
|
||||
|
||||
https://reposhub.com/linux/shell-applications/lincheney-fzf-tab-completion.html
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
function activate-venv() {
|
||||
local selected_env
|
||||
selected_env=$(ls ~/.venv/ | fzf)
|
||||
|
||||
if [ -n "$selected_env" ]; then
|
||||
source "$HOME/.venv/$selected_env/bin/activate"
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
BIN
docs/Linux/fzf.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
docs/Linux/fzf2.png
Normal file
|
After Width: | Height: | Size: 315 KiB |
BIN
docs/Linux/fzf3.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
docs/Linux/fzf4.png
Normal file
|
After Width: | Height: | Size: 472 KiB |
BIN
docs/Linux/fzf5.png
Normal file
|
After Width: | Height: | Size: 93 KiB |
BIN
docs/Linux/fzf6.png
Normal file
|
After Width: | Height: | Size: 69 KiB |
63
docs/Linux/grep-options-fr.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# grep --options
|
||||
|
||||
|
||||
|
||||
| **grep (BSD)** | **grep (GNU)** |
|
||||
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| **-A** num, -**-after-context**=num<br />Affiche les lignes numériques du contexte de fin après chaque correspondance. Voir aussi les options **-B** et**-C**. | **-A** NUM, **--after-context**=NUM<br/>Affiche les lignes NUM du contexte de fin après avoir fait correspondre les lignes. Place une ligne contenant un séparateur de groupe (--) entre des groupes contigus de correspondances. Avec l'option **-o** ou **--only-matching**, cela n'a aucun effet et un avertissement est donné. |
|
||||
| **-a**, **--text**<br />Traitez tous les fichiers comme du texte ASCII. | **-a**, **--text**<br/>Traiter un fichier binaire comme s'il s'agissait de texte ; c'est équivalent à l'option **--binary-files**=text. |
|
||||
| **-B** num, **--before-context**=num<br />Affiche le nombre de lignes de contexte principal avant chaque correspondance. Voir aussi les options **-A** et **-C**. | **-B** NUM, **--before-context**=NUM<br/>Affiche les lignes NUM du contexte principal avant de faire correspondre les lignes. Place une ligne contenant un séparateur de groupe (--) entre des groupes contigus de correspondances. Avec l'option **-o** ou **--only-matching**, cela n'a aucun effet et un avertissement est donné. |
|
||||
| **-b**, **--byte-offset**<br />Le décalage en octets d'un motif correspondant est affiché devant la ligne correspondante respective. | **-b**, **--byte-offset**<br/>Affche le décalage d'octets basé sur 0 dans le fichier d'entrée avant chaque ligne de sortie. Si **-o** (**--only-matching**) est spécifié, imprimez le décalage de la pièce correspondante elle-même. |
|
||||
| **-C**[num, **--context**=num]<br />Imprimez des lignes numériques de contexte de début et de fin entourant chaque correspondance. La valeur par défaut est 2 et équivaut à **-A** 2 **-B** 2. | Affiche les lignes NUM du contexte de sortie. Place une ligne contenant un séparateur de groupe (--) entre des groupes contigus de correspondances.<br/>Avec l'option **-o** ou **--only-matching**, cela n'a aucun effet et un avertissement est donné. |
|
||||
| **-c**, **--count**<br />Seul un nombre de lignes sélectionnées est écrit sur la sortie standard. | **-c**, **--count**<br/>Supprimez la sortie normale ; imprimez plutôt un nombre de lignes correspondantes pour chaque fichier d'entrée. Avec l'option **-v**, **--invert-match** (voir ci-dessous), comptez les lignes non correspondantes. |
|
||||
| **--colour**=[when, **--color**=[when]]<br />Marquez le texte correspondant avec l'expression stockée dans la variable d'environnement GREP_COLOR. Les valeurs possibles de when peuvent être *never*, *always*, ou *auto*. | **--color**[=WHEN], **--colour**[=WHEN]<br/>Entourez les chaînes (non vides) correspondantes, les lignes de contexte, les noms de fichiers, les numéros de ligne, les décalages d'octets et les séparateurs correspondants (pour les champs et les groupes de lignes de contexte) de séquences d'échappement pour les a-cher en couleur sur le terminal. Les couleurs sont définies par la variable d'environnement GREP_COLORS. La variable d'environnement obsolète GREP_COLOR est toujours prise en charge, mais son paramètre n'a pas la priorité. WHEN est *never*, *always*, ou *auto*. |
|
||||
| **-D** action, **--devices**=action<br />Spécifiez l'action demandée pour les périphériques, les FIFO et les sockets. L'action par défaut est *'read',* ce qui signifie qu'ils sont lus comme s'il s'agissait de fichiers normaux. Si l'action est définie sur *'skip'*, les périphériques seront ignorés silencieusement. | **-D** ACTION, **--devices**=ACTION<br/>Si un fichier d'entrée est un périphérique, une FIFO ou un socket, utilisez ACTION pour le traiter. Par défaut, ACTION est *read*, ce qui signifie que les périphériques sont lus comme s'il s'agissait de fichiers ordinaires. Si ACTION est *skip*, les périphériques sont ignorés en silence. |
|
||||
| **-d** action, **--directories**=action<br />Spécifiez l'action demandée pour les répertoires. Il est *"read"* par défaut, ce qui signifie que les répertoires sont lus de la même manière que les fichiers normaux. Les autres valeurs possibles sont *'skip'* pour ignorer silencieusement les répertoires, et *'récurse'* pour les lire récursivement, ce qui a le même effet que l'option **-R** et **-r**. | **-d** ACTION, **--directories**=ACTION<br/>Si un fichier d'entrée est un répertoire, utilisez ACTION pour le traiter. Par défaut, ACTION est *read*, c'est-à-dire lire les répertoires comme s'il s'agissait de fichiers ordinaires. Si ACTION est *skip*, ignorez silencieusement les répertoires. Si ACTION est *récurse*, lisez tous les fichiers sous chaque répertoire, récursivement, en suivant des liens symboliques uniquement s'ils se trouvent sur la ligne de commande. C'est l'équivalent de l'option **-r**. |
|
||||
| **-E**, **--extended-regexp**<br />Interpréter le motif comme une expression régulière étendue | **-E**, **--extended-regexp**<br/>Interpréter les MODÈLES en tant qu'expressions régulières étendues (ERE, voir ci- dessous). |
|
||||
| **-e** pattern, **--regexp**=pattern<br />Spécifiez un motif utilisé lors de la recherche de l'entrée : une ligne d'entrée est sélectionnée si elle correspond à l'un des motifs spécifiés. Cette option est plus utile lorsque plusieurs options **-e** sont utilisées pour spécifier plusieurs motifs, ou lorsqu'un motif commence par un tiret (-'). | **-e** PATTERNS, **--regexp**=PATTERNS<br/>Utilisez des PATTERNS comme motifs. Si cette option est utilisée plusieurs fois ou est combinée avec l'option **-f** (**--file**), recherchez tous les modèles donnés. Cette option peut être utilisée pour protéger un motif commençant par "-". |
|
||||
| **--exclude**<br />Si spécifié, il exclut les fichiers correspondant au modèle de nom de fichier donné de la recherche. Notez que les modèles **--exclude** ont priorité sur les modèles **--include**, et si aucun motif **--include n'est** spécifié, tous les fichiers qui ne sont pas exclus sont recherchés. Les motifs correspondent au chemin d'accès complet spécifié, pas seulement au composant nom de fichier. | **--exclude**=GLOB<br/>Ignorez tout fichier en ligne de commande avec un suffixe de nom qui correspond au motif GLOB, en utilisant la correspondance de caractères génériques ; un suffixe de nom est soit le nom entier, soit une partie arrière qui commence par un caractère non-slash immédiatement après une barre oblique (/) dans le nom. Lors de la recherche récursive, sautez tout sous-fichier dont le nom de base correspond à GLOB ; le nom de base est la partie après la dernière barre oblique. Un motif peut utiliser *, ? et [...] comme caractères génériques, et \ pour citer littéralement un caractère générique ou antislash. |
|
||||
| | **--exclude-from**=FILE<br/>Skip files whose base name matches any of the file-name globs read from FILE (using wildcard matching as described under --exclude).<br />Ignorer les fichiers dont le nom de base correspond à l'un des globes de nom de fichier lus à partir de FILE (en utilisant la correspondance de caractères génériques comme décrit sous --exclude). |
|
||||
| **--exclude-dir**<br />Si -R est spécifié, il exclut les répertoires correspondants au modèle de nom de fichier donné de la recherche. Notez que les modèles **--exclude- dir** ont priorité sur les modèles **--include-dir**, et si aucun modèle **--include-dir n'est** spécifié, tous les répertoires qui ne sont pas exclus sont recherchés. | **--exclude-dir**=GLOB<br/>Ignorez tout répertoire en ligne de commande avec un suffixe de nom qui correspond au motif GLOB. Lors de la recherche récursive, sautez tout sous-répertoire dont le nom de base correspond à GLOB. Ignorez toute barre oblique redondante dans GLOB. |
|
||||
| **-F**, **--fixed-strings**<br />Interpréter le motif comme un ensemble de chaînes fixes | **I-F**, **--fixed-strings**<br/>Interprétez les PATTERNS comme des chaînes fixes, pas comme des expressions régulières. |
|
||||
| **-f** file, **--file**=file<br />Lisez un ou plusieurs modèles séparés de saut de ligne du fichier. Les lignes de motif vides correspondent à chaque ligne d'entrée. Les sauts de ligne ne sont pas considérés comme faisant partie d'un modèle. Si le fichier est vide, rien n'est trouvé. | **-f** FILE, **--file**=FILE<br/>Obtenez des modèles à partir de FILE, un par ligne. Si cette option est utilisée plusieurs fois ou est combinée avec l'option **-e** (**--regexp**), recherchez tous les modèles donnés. Le fichier vide ne contient aucun motif et ne correspond donc à rien. |
|
||||
| **-G**, **--basic-regexp**<br />Interpréter le motif comme une expression régulière de base. | **-G**, **--basic-regexp**<br/>Interpréter les MODÈLES comme des expressions régulières de base (BRE, voir ci- dessous). C'est la valeur par défaut. |
|
||||
| **-H**<br />Affchez toujours les en-têtes de nom de fichier avec des lignes de sortie. | **-H**, **--with-filename**<br/>Affchez le nom du fichier pour chaque correspondance. C'est la valeur par défaut lorsqu'il y a plus d'un fichier à rechercher. |
|
||||
| **-h**, **--no-filename**<br/>N'affichez jamais d'en-têtes de nom de fichier (c'est-à-dire des noms de fichier) avec des lignes de sortie. | **-h**, **--no-filename**<br/>Supprimez le préfixe des noms de fichiers sur la sortie. C'est la valeur par défaut lorsqu'il n'y a qu'un seul fichier (ou une seule entrée standard) à rechercher. |
|
||||
| **--help**<br />Imprimez un bref message d'aide. | **--help**<br />Affchez un message d'utilisation et quittez. |
|
||||
| **-I**<br />Ignorez les fichiers binaires. Cette option est équivalente à l'option **--binary-file=without-match**. | **-I**<br />Traiter un fichier binaire comme s'il ne contenait pas de données correspondantes ; c'est équivalent à l'option **--binary-files=without-match**. |
|
||||
| **--include**<br />Si spécifié, seuls les fichiers correspondant au modèle de nom de fichier donné sont recherchés. Notez que les modèles **--exclude** ont priorité sur **-- include** patterns. Les motifs correspondent au chemin d'accès complet spécifié, pas seulement au composant nom de fichier. | **--include**=GLOB<br/>Recherchez uniquement les fichiers dont le nom de base correspond à GLOB (en utilisant la correspondance de caractères génériques comme décrit sous **-- exclude**).<br/> Si des options contradictoires **--include** et **--exclude** sont données, la dernière correspondante gagne.<br/> Si aucune option **--include** ou **--exclude ne** correspond, un fichier est inclus à moins que la première de ces options ne soit **--include**. |
|
||||
| **--include-dir**<br/>Si -R est spécifié, seuls les répertoires correspondant au modèle de nom de fichier donné sont recherchés. Notez que les modèles **--exclude- dir** ont priorité sur les modèles **--include-dir**. | |
|
||||
| **-J**, **--bz2decompress**<br/>Décompressez le fichier compressé bzip2(1) avant de rechercher le texte. | |
|
||||
| **-L**, **--files-without-match**<br/>Seuls les noms des fichiers ne contenant pas de lignes sélectionnées sont écrits sur la sortie standard. Les chemins d'accès sont répertoriés une fois par fichier recherché. Si l'entrée standard est recherchée, la chaîne "(entrée standard)'' est écrite. | **-L**, **--files-without-match**<br/>Supprimez la sortie normale ; imprimez plutôt le nom de chaque fichier d'entrée à partir duquel aucune sortie n'aurait normalement été imprimée. Le balayage s'arrêtera lors de la première correspondance. |
|
||||
| **-l**, **--files-with-matches**<br/>Seuls les noms des fichiers contenant des lignes sélectionnées sont écrits en sortie standard. grep ne recherchera un fichier que jusqu'à ce qu'une correspondance ait été trouvée, ce qui rend les recherches potentiellement moins coûteuses. Les chemins d'accès sont répertoriés une fois par fichier recherché. Si l'entrée standard est recherchée, la chaîne "(entrée standard)'' est écrite. | **-l**, **--files-with-matches**<br/>Supprimez la sortie normale ; imprimez plutôt le nom de chaque fichier d'entrée à partir duquel la sortie aurait normalement été imprimée. Le balayage s'arrêtera lors de la première correspondance. |
|
||||
| **--mmap**<br />Utilisez mmap(2) au lieu de read(2) pour lire l'entrée, ce qui peut entraîner de meilleures performances dans certaines circonstances, mais peut entraîner un comportement indéfini. | |
|
||||
| **-m** num, **--max-count**=num<br/>Arrêtez de lire le fichier après *num* correspondances. | **-m** NUM, **--max-count**=NUM<br/>Arrêtez de lire un fichier après NUM lignes correspondantes . Si l'entrée est une entrée standard d'un fichier régulier et que NUM lignes de correspondance sont sorties, grep s'assure que l'entrée standard est positionnée juste après la dernière ligne correspondante avant de quitter, indépendamment de la présence de lignes de contexte. Cela permet à un processus d'appel de reprendre une recherche. <br />Lorsque grep s'arrête après NUM lignes de correspondance, il affiche toutes les lignes de contexte.<br/> Lorsque l'option **-c** ou **--count** est également utilisée, grep n'affiche pas un compte supérieur à NUM.<br/> Lorsque l'option **-v** ou **--invert-match** est également utilisée, grep s'arrête après avoir affiché NUM lignes non correspondantes. |
|
||||
| **-n**, **--line-number**<br/>Chaque ligne de sortie est précédée de son numéro de ligne relatif dans le fichier, à partir de la ligne 1. Le compteur de numéros de ligne est réinitialisé pour chaque fichier traité. Cette option est ignorée si **-c**, **-L**, **-l** ou **-q** est spécifié. | **-n**, **--line-number**<br/>Préfixez chaque ligne de sortie avec le numéro de ligne basé sur 1 dans son fichier d'entrée. |
|
||||
| **--null**<br />Affiche un octet zéro après le nom du fichier. | **-Z**, **--null**<br/>Affiche un octet zéro (le caractère ASCII NUL) au lieu du caractère qui suit normalement un nom de fichier. Par exemple, grep -lZ affiche un octet zéro après chaque nom de fichier au lieu du saut de ligne habituel. Cette option rend la sortie sans ambiguïté, même en présence de noms de fichiers contenant des caractères inhabituels comme les sauts de ligne. Cette option peut être utilisée avec des commandes comme find -print0, perl -0, sort -z et xargs -0 pour traiter les noms de fichiers arbitraires, même ceux qui contiennent des caractères de saut de ligne. |
|
||||
| **-O**<br />Si **-R** est spécifié, suivez les liens symboliques uniquement s'ils ont été explicitement répertoriés sur la ligne de commande. La valeur par défaut est de ne pas suivre les liens symboliques. | |
|
||||
| **-o**, **--only-matching**<br />Imprime uniquement la partie correspondante des lignes. | **-o**, **--only-matching**<br />Imprimez uniquement les parties correspondantes (non vides) d'une ligne correspondante, chacune de ces parties sur une ligne de sortie distincte. |
|
||||
| **-p**<br />Si **-R** est spécifié, aucun lien symbolique n'est suivi. C'est la valeur par défaut. | |
|
||||
| **-q**, **--quiet**, **--silent**<br/>Mode silencieux : supprimez la sortie normale. grep ne recherchera un fichier que jusqu'à ce qu'une correspondance ait été trouvée, ce qui rend les recherches potentiellement moins coûteuses. | **-q**, **--quiet**, **--silent**<br/>Silence ; n'écrivez rien sur la sortie standard. Quittez immédiatement avec un statut zéro si une correspondance est trouvée, même si une erreur a été détectée. Voir également l'option **-s** ou **--no-messages**. |
|
||||
| **-R**, **-r**, **--recursive**<br/>Recherchez récursivement les sous-répertoires répertoriés. | **-r**, **--recursive**<br/>Read all files under each directory, recursively, following symbolic links only if they are on the command line. Note that if no file operand is given, grep searches the working directory. This is equivalent to the **-d** recurse option.<br />Lisez tous les fichiers sous chaque répertoire, récursivement, en suivant des liens symboliques uniquement s'ils sont sur la ligne de commande. Notez que si aucun opérande de fichier n'est donné, grep recherche dans le répertoire de travail. C'est l'équivalent de l'option récurse **-d** . |
|
||||
| | **-R**, **--dereference-recursive**<br/>Lisez tous les fichiers sous chaque répertoire, récursivement. Suivez tous les liens symboliques, contrairement à **-r**. |
|
||||
| **-S**<br />Si **-R** est spécifié, tous les liens symboliques sont suivis. La valeur par défaut est de ne pas suivre les liens symboliques. | |
|
||||
| **-s**, **--no-messages**<br/>Mode silencieux. Les fichiers inexistants et illisibles sont ignorés (c'est-à-dire que leurs messages d'erreur sont supprimés). | **-s**, **--no-messages**<br/>Supprimez les messages d'erreur concernant les fichiers inexistants ou illisibles. |
|
||||
| **-U**, **--binary**<br/>Recherchez des fichiers binaires, mais n'essayez pas de les imprimer. | **-U**, **--binary**<br/>Traitez le(s) fichier(s) comme binaire(s). Par défaut, sous MS-DOS et MS-Windows, grep devine si un fichier est texte ou binaire comme décrit pour l'option **--binary-files**. Si grep décide que le fichier est un fichier texte, il supprime les caractères CR du contenu du fichier d'origine (pour que les expressions régulières avec ^ et $ fonctionnent correctement).<br/> Spécifier **-U** annule cette conjecture, ce qui fait que tous les fichiers sont lus et transmis mot pour mot au mécanisme de correspondance ; si le fichier est un fichier texte avec des paires CR/LF à la fin de chaque ligne, cela entraînera l'échec de certaines expressions régulières. Cette option n'a aucun effet sur les plates- formes autres que MS-DOS et MS-Windows. |
|
||||
| **-V**, **--version**<br/>Afficher les informations de version et quitter. | **-V**, **--version**<br/> Affiche le numéro de version de grep et quitte. |
|
||||
| **-v**, **--invert-match**<br/>Les lignes sélectionnées sont celles qui ne correspondent à aucun des motifs spécifiés. | **-v**, **--invert-match**<br/>Inverser le sens de correspondance, pour sélectionner des lignes non correspondantes. |
|
||||
| **-w**, **--word-regexp**<br/>The expression is searched for as a word (as if surrounded by `[[:<:]]` and `[[:>:]]`; voir re_format(7)). | **-w**, **--word-regexp**<br/>Sélectionnez uniquement les lignes contenant des correspondances qui forment des mots entiers. Le test est que la sous-chaîne correspondante doit être soit au début de la ligne, soit précédée d'un caractère constitutif non-mot. De même, il doit être soit à la fin de la ligne, soit suivi d'un caractère constitutif non-mot. Les caractères constitutifs du mot sont les lettres, les chiffres et le soulignement. Cette option n'a aucun effet si **-x** est également spécifié. |
|
||||
| **-x**, **--line-regexp**<br/>Seules les lignes d'entrée sélectionnées par rapport à une chaîne fixe entière ou à une expression régulière sont considérées comme des lignes correspondantes. | **-x**, **--line-regexp**<br/>Sélectionnez uniquement les correspondances qui correspondent exactement à l'ensemble de la ligne. Pour un motif d'expression régulière, c'est comme mettre entre parenthèses le motif puis l'entourer de ^ et $.<br /> |
|
||||
| **-y**<br />Équivalent à **-i**. Obsolète. | **-y**<br />Synonyme obsolète de **-i.** |
|
||||
| **-Z**, **-z**, **--decompress**<br/>Forcer grep à se comporter comme zgrep. | |
|
||||
| | **-z**, **--null-data**<br/>Traitez les données d'entrée et de sortie comme des séquences de lignes, chacune terminée par un octet zéro (le caractère ASCII NUL) au lieu d'un saut de ligne. Comme l'option **-Z** ou -**-null**, cette option peut être utilisée avec des commandes comme sort **-z** pour traiter des noms de fichiers arbitraires. |
|
||||
| **--binary-files**=value<br/>Contrôle la recherche et l'impression de fichiers binaires. Les options sont *binary*, la valeur par défaut : rechercher des fichiers binaires mais ne par les imprimer ; *without-match* : ne recherchez pas de fichiers binaires ; et *text* : traitez tous les fichiers comme du texte. | **--binary-files**=TYPE<br/>If a file's data or metadata indicate that the file contains binary data, assume that the file is of type TYPE. Non-text bytes indicate binary data; these are either output bytes that are improperly encoded for the current locale, or null input bytes when the **-z** option is not given.<br/><br/>By default, TYPE is *binary*, and grep suppresses output after null input binary data is discovered, and suppresses output lines that contain improperly encoded data. When some output is suppressed, grep follows any output with a one-line message saying that a binary file matches.<br/><br/>If TYPE is *without-match*, when grep discovers null input binary data it assumes that the rest of the file does not match; this is equivalent to the -I option.<br/><br/>If TYPE is *text*, grep processes a binary file as if it were text; this is equivalent to the **-a** option.<br/><br/>When type is *binary*, grep may treat non-text bytes as line terminators even without the **-z** option. This means choosing binary versus text can affect whether a pattern matches a file. For example, when type is *binary* the pattern q$ might match q immediately followed by a null byte, even though this is not matched when type is *text*. Conversely, when type is *binary* the pattern . (period) might not match a null byte.<br/><br/><u>Warning:</u> The **-a** option might output binary garbage, which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands. On the other hand, when reading files whose text encodings are unknown, it can be helpful to use **-a** or to set **LC_ALL='C'** in the environment, in order to find more matches even if the matches are unsafe for direct display. |
|
||||
| **--binary-files**=value<br/>Contrôle la recherche et l'impression de fichiers binaires. Les options sont *binary*, la valeur par défaut : rechercher des fichiers binaires mais ne par les imprimer ; *without-match* : ne recherchez pas de fichiers binaires ; et *text* : traitez tous les fichiers comme du texte. | Si les données ou métadonnées d'un fichier indiquent que le fichier contient des données binaires, considère que le fichier est de type TYPE. Les octets non textuels indiquent des données binaires ; il s'agit soit d'octets de sortie mal encodés pour la locale actuelle, soit d'octets d'entrée NULL lorsque l'option **-z** n'est pas donnée.<br /><br />Par défaut, TYPE est *binar*y, et grep supprime la sortie après la découverte de données binaires d'entrée nulles, et supprime les lignes de sortie qui contiennent des données mal encodées. Lorsqu'une sortie est supprimée, grep suit n'importe quelle sortie avec un message d'une ligne indiquant qu'un fichier binaire correspond.<br />Si TYPE est *without-match*, lorsque grep découvre des données binaires d'entrée nulles, il suppose que le reste du fichier ne correspond pas ; c'est équivalent à l'option **-I**.<br />Si TYPE est *text*, grep traite un fichier binaire comme s'il s'agissait de texte ; c'est l'équivalent de l'option **-a**.<br />Lorsque type est *binary*, grep peut traiter les octets non textuels comme des terminaisons de ligne, même sans l'option **-z**. Cela signifie que le choix du binaire par rapport au texte peut influer sur la correspondance d'un modèle avec un fichier. Par exemple, lorsque type est *binary*, le motif q$ peut correspondre à q immédiatement suivi d'un octet nul, même si cela n'est pas égalé lorsque type is *text*. Inversement, lorsque type est *binary*, le motif . (point) peut ne pas correspondre à un octet nul.<br /><u>Avertissement :</u> L'option **-a** peut a-cher des ordures binaires, qui peuvent avoir des effets secondaires désagréables si la sortie est un terminal et si le pilote de terminal en interprète une partie comme des commandes. D'autre part, lors de la lecture de fichiers dont les encodages de texte sont inconnus, il peut être utile d'utiliser **-a** ou de définir **LC_ALL='C'** dans l'environnement, afin de trouver plus de correspondances même si les correspondances ne sont pas sûres pour l'affichage direct. |
|
||||
| **--context**[=num]<br/>Imprimez les lignes numériques du contexte de début et de fin. La valeur par défaut est 2. | |
|
||||
| **--line-buffered**<br/>Force la sortie à mettre en mémoire tampon par ligne. Par défaut, la sortie est mise en mémoire tampon en ligne lorsque la sortie standard est un terminal et le bloc est mis en mémoire tampon dans le cas contraire. | **--line-buffered**<br/>Utilisez la mise en mémoire tampon de ligne sur la sortie. Cela peut entraîner une pénalité de performance. |
|
||||
| | **-i**, **--ignore-case**<br/>Ignorez les distinctions de casse dans les modèles et les données d'entrée, de sorte que les caractères qui ne diffèrent que dans la casse correspondent les uns aux autres. |
|
||||
| | **--no-ignore-case**<br/>N'ignorez pas les distinctions de cas dans les modèles et les données d'entrée. C'est la valeur par défaut. Cette option est utile pour passer aux scripts shell qui utilisent déjà **-i**, pour annuler ses effets car les deux options se remplacent. |
|
||||
| | **--label=LABEL**<br />Afficher l'entrée provenant réellement de l'entrée standard comme l'entrée provenant du fichier LABEL. Cela peut être utile pour les commandes qui transforment le contenu d'un fichier avant la recherche, par exemple, gzip -cd foo.gz \|grep --label=foo -H 'some pattern'. Voir aussi le **-H** |
|
||||
| | **--perl-regexp**<br/>Interpréter les MODÈLES en tant qu'expressions régulières compatibles Perl (PCRE). Cette option est expérimentale lorsqu'elle est combinée avec l'option **-z** (**-- null-data**), et grep **-P** peut avertir des fonctionnalités non implémentées. |
|
||||
| | **-T**, **--initial-tab**<br/>Assurez-vous que le premier caractère du contenu réel de la ligne se trouve sur un arrêt d'onglet, de sorte que l'alignement des onglets semble normal.<br/> C'est utile avec les options qui préfixent leur sortie au contenu réel : **-H**,**-n** et **-b**. Afin d'améliorer la probabilité que les lignes d'un seul fichier commencent toutes à la même colonne, cela entraîne également l'impression du numéro de ligne et du décalage d'octet (le cas échéant) dans une largeur de champ de taille minimale. |
|
||||
| | **-u**, **--unix-byte-offsets**<br/>Report Unix-style byte offsets. This switch causes grep to report byte offsets as if the file were a Unix-style text file, i.e., with CR characters stripped off. This will produce results identical to running grep on a Unix machine. This option has no effect unless -b option is also used; it has no effect on platforms other than MS-DOS and MS-Windows.<br />Signaler les décalages d'octets de style Unix. Ce commutateur fait que grep signale les décalages d'octets comme si le fichier était un fichier texte de style Unix, c'est-à-dire avec des caractères CR supprimés. Cela produira des résultats identiques à ceux de l'exécution de grep sur une machine Unix. Cette option n'a aucun effet à moins que l'option **-b** ne soit également utilisée ; elle n'a aucun effet sur les plates-formes autres que MS-DOS et MS-Windows. |
|
||||
|
||||
62
docs/Linux/grep-options.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# grep --options
|
||||
|
||||
|
||||
|
||||
| **grep (BSD)** | **grep (GNU)** |
|
||||
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| **-A** num, -**-after-context**=num<br />Print num lines of trailing context after each match. See also the **-B** and **-C** options. | **-A** NUM, **--after-context**=NUM<br/>Print NUM lines of trailing context after matching lines. Places a line containing a group separator (--) between contiguous groups of matches. With the **-o** or **--only-matching** option, this has no effect and a warning is given. |
|
||||
| **-a**, **--text**<br />Treat all files as ASCII text. | **-a**, **--text**<br/>Process a binary file as if it were text; this is equivalent to the **--binary-files**=text option. |
|
||||
| **-B** num, **--before-context**=num<br />Print num lines of leading context before each match. See also the **-A** and **-C** options. | **-B** NUM, **--before-context**=NUM<br/>Print NUM lines of leading context before matching lines. Places a line containing a group separator (--) between contiguous groups of matches. With the **-o** or **--only-matching** option, this has no effect and a warning is given. |
|
||||
| **-b**, **--byte-offset**<br />The offset in bytes of a matched pattern is displayed in front of the respective matched line. | **-b**, **--byte-offset**<br/>Print the 0-based byte offset within the input file before each line of output. If **-o** (**--only-matching**) is specified, print the offset of the matching part itself. |
|
||||
| **-C**[num, **--context**=num]<br />Print num lines of leading and trailing context surrounding each match. The default is 2 and is equivalent to **-A** 2 **-B** 2. | **-C** NUM, -NUM, **--context**=NUM<br/>Print NUM lines of output context. Places a line containing a group separator (--) between contiguous groups of matches.<br/>With the **-o** or **--only-matching** option, this has no effect and a warning is given. |
|
||||
| **-c**, **--count**<br />Only a count of selected lines is written to standard output. | **-c**, **--count**<br/>Suppress normal output; instead print a count of matching lines for each input file. With the **-v**, **--invert-match** option (see below), count non-matching lines. |
|
||||
| **--colour**=[when, **--color**=[when]]<br />Mark up the matching text with the expression stored in GREP_COLOR environment variable. The possible values of when can be *'never'*, *'always'* or *'auto'*. | **--color**[=WHEN], **--colour**[=WHEN]<br/>Surround the matched (non-empty) strings, matching lines, context lines, file names, line numbers, byte offsets, and separators (for fields and groups of context lines) with escape sequences to display them in color on the terminal. The colors are defined by the environment variable GREP_COLORS. The deprecated environment variable GREP_COLOR is still supported, but its setting does not have priority. WHEN is *never*, *always*, or *auto*. |
|
||||
| **-D** action, **--devices**=action<br />Specify the demanded action for devices, FIFOs and sockets. The default action is *'read',* which means, that they are read as if they were normal files. If the action is set to *'skip'*, devices will be silently skipped. | **-D** ACTION, **--devices**=ACTION<br/>If an input file is a device, FIFO or socket, use ACTION to process it. By default, ACTION is *read*, which means that devices are read just as if they were ordinary files. If ACTION is *skip*, devices are silently skipped. |
|
||||
| **-d** action, **--directories**=action<br />Specify the demanded action for directories. It is *'read'* by default, which means that the directories are read in the same manner as normal files. Other possible values are *'skip'* to silently ignore the directories, and *'recurse'* to read them recursively, which has the same effect as the **-R** and **-r** option. | **-d** ACTION, **--directories**=ACTION<br/>If an input file is a directory, use ACTION to process it. By default, ACTION is *read*, i.e., read directories just as if they were ordinary files. If ACTION is *skip*, silently skip directories. If ACTION is *recurse*, read all files under each directory, recursively, following symbolic links only if they are on the command line. This is equivalent to the **-r** option. |
|
||||
| **-E**, **--extended-regexp**<br />Interpret pattern as an extended regular expression | **-E**, **--extended-regexp**<br/>Interpret PATTERNS as extended regular expressions (EREs, see below). |
|
||||
| **-e** pattern, **--regexp**=pattern<br />Specify a pattern used during the search of the input: an input line is selected if it matches any of the specified patterns. This option is most useful when multiple **-e** options are used to specify multiple patterns, or when a pattern begins with a dash (`-'). | **-e** PATTERNS, **--regexp**=PATTERNS<br/>Use PATTERNS as the patterns. If this option is used multiple times or is combined with the **-f** (**--file**) option, search for all patterns given. This option can be used to protect a pattern beginning with "-". |
|
||||
| **--exclude**<br />If specified, it excludes files matching the given filename pattern from the search. Note that **--exclude** patterns take priority over **--include** patterns, and if no **--include** pattern is specified, all files are searched that are not excluded. Patterns are matched to the full path specified, not only to the filename component. | **--exclude**=GLOB<br/>Skip any command-line file with a name suffix that matches the pattern GLOB, using wildcard matching; a name suffix is either the whole name, or a trailing part that starts with a non-slash character immediately after a slash (/) in the name. When searching recursively, skip any subfile whose base name matches GLOB; the base name is the part after the last slash. A pattern can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character literally. |
|
||||
| | **--exclude-from**=FILE<br/>Skip files whose base name matches any of the file-name globs read from FILE (using wildcard matching as described under --exclude). |
|
||||
| **--exclude-dir**<br />If -R is specified, it excludes directories matching the given filename pattern from the search. Note that **--exclude-dir** patterns take priority over **--include-dir** patterns, and if no **--include-dir** pattern is specified, all directories are searched that are not excluded. | **--exclude-dir**=GLOB<br/>Skip any command-line directory with a name suffix that matches the pattern GLOB. When searching recursively, skip any subdirectory whose base name matches GLOB. Ignore any redundant trailing slashes in GLOB. |
|
||||
| **-F**, **--fixed-strings**<br />Interpret pattern as a set of fixed strings | **-F**, **--fixed-strings**<br/>Interpret PATTERNS as fixed strings, not regular expressions. |
|
||||
| **-f** file, **--file**=file<br />Read one or more newline separated patterns from file. Empty pattern lines match every input line. Newlines are not considered part of a pattern. If file is empty, nothing is matched. | **-f** FILE, **--file**=FILE<br/>Obtain patterns from FILE, one per line. If this option is used multiple times or is combined with the **-e** (**--regexp**) option, search for all patterns given. The empty file contains zero patterns, and therefore matches nothing. |
|
||||
| **-G**, **--basic-regexp**<br /> Interpret pattern as a basic regular expression. | **-G**, **--basic-regexp**<br/>Interpret PATTERNS as basic regular expressions (BREs, see below). This is the default. |
|
||||
| **-H**<br />Always print filename headers with output lines. | **-H**, **--with-filename**<br/>Print the file name for each match. This is the default when there is more than one file to search. |
|
||||
| **-h**, **--no-filename**<br/>Never print filename headers (i.e. filenames) with output lines. | **-h**, **--no-filename**<br/>Suppress the prefixing of file names on output. This is the default when there is only one file (or only standard input) to search. |
|
||||
| **--help**<br />Print a brief help message. | **--help**<br />Output a usage message and exit. |
|
||||
| **-I**<br />Ignore binary files. This option is equivalent to **--binary-file=without-match option**. | **-I**<br />Process a binary file as if it did not contain matching data; this is equivalent to the **--binary-files=without-match option**. |
|
||||
| **--include**<br />If specified, only files matching the given filename pattern are searched. Note that **--exclude** patterns take priority over **--include** patterns. Patterns are matched to the full path specified, not only to the filename component. | **--include**=GLOB<br/> Search only files whose base name matches GLOB (using wildcard matching as described under **--exclude**). <br />If contradictory **--include** and **--exclude** options are given, the last matching one wins. <br />If no **--include** or **--exclude** options match, a file is included unless the first such option is **--include**. |
|
||||
| **--include-dir**<br/>If -R is specified, only directories matching the given filename pattern are searched. Note that **--exclude-dir** patterns take priority over **--include-dir** patterns. | |
|
||||
| **-J**, **--bz2decompress**<br/>Decompress the bzip2(1) compressed file before looking for the text. | |
|
||||
| **-L**, **--files-without-match**<br/>Only the names of files not containing selected lines are written to standard output. Pathnames are listed once per file searched. If the standard input is searched, the string "(standard input)'' is written. | -L, --files-without-match<br/>Suppress normal output; instead print the name of each input file from which no output would normally have been printed. The scanning will stop on the first match. |
|
||||
| **-l**, **--files-with-matches**<br/>Only the names of files containing selected lines are written to standard output. grep will only search a file until a match has been found, making searches potentially less expensive. Pathnames are listed once per file searched. If the standard input is searched, the string "(standard input)'' is written. | -l, --files-with-matches<br/>Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match. |
|
||||
| **--mmap**<br />Use mmap(2) instead of read(2) to read input, which can result in better performance under some circumstances but can cause undefined behaviour. | |
|
||||
| **-m** num, **--max-count**=num<br/>Stop reading the file after num matches. | **-m** NUM, **--max-count**=NUM<br/>Stop reading a file after NUM matching lines. If the input is standard input from a regular file, and NUM matching lines are output, grep ensures that the standard input is positioned to just after the last matching line before exiting, regardless of the presence of trailing context lines. This enables a calling process to resume a search. <br />When grep stops after NUM matching lines, it outputs any trailing context lines. <br />When the **-c** or **--count** option is also used, grep does not output a count greater than NUM. <br />When the **-v** or **--invert-match** option is also used, grep stops after outputting NUM non-matching lines. |
|
||||
| **-n**, **--line-number**<br/>Each output line is preceded by its relative line number in the file, starting at line 1. The line number counter is reset for each file processed. This option is ignored if **-c**, **-L**, **-l**, or **-q** is specified. | **-n**, **--line-number**<br/>Prefix each line of output with the 1-based line number within its input file. |
|
||||
| **--null**<br />Prints a zero-byte after the file name. | **-Z**, **--null**<br/>Output a zero byte (the ASCII NUL character) instead of the character that normally follows a file name. For example, grep -lZ outputs a zero byte after each file name instead of the usual newline. This option makes the output unambiguous, even in the presence of file names containing unusual characters like newlines. This option can be used with commands like find -print0, perl -0, sort -z, and xargs -0 to process arbitrary file names, even those that contain newline characters. |
|
||||
| **-O**<br />If -R is specified, follow symbolic links only if they were explicitly listed on the command line. The default is not to follow symbolic links. | |
|
||||
| **-o**, **--only-matching**<br />Prints only the matching part of the lines. | **-o**, **--only-matching**<br />Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line. |
|
||||
| **-p**<br />If **-R** is specified, no symbolic links are followed. This is the default. | |
|
||||
| **-q**, **--quiet**, **--silent**<br/>Quiet mode: suppress normal output. grep will only search a file until a match has been found, making searches potentially less expensive. | **-q**, **--quiet**, **--silent**<br/>Quiet; do not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected. Also see the **-s** or **--no-messages** option. |
|
||||
| **-R**, **-r**, **--recursive**<br/>Recursively search subdirectories listed. | **-r**, **--recursive**<br/>Read all files under each directory, recursively, following symbolic links only if they are on the command line. Note that if no file operand is given, grep searches the working directory. This is equivalent to the **-d** recurse option. |
|
||||
| | **-R**, **--dereference-recursive**<br/>Read all files under each directory, recursively. Follow all symbolic links, unlike **-r**. |
|
||||
| **-S**<br />If **-R** is specified, all symbolic links are followed. The default is not to follow symbolic links. | |
|
||||
| **-s**, **--no-messages**<br/>Silent mode. Nonexistent and unreadable files are ignored (i.e. their error messages are suppressed). | **-s**, **--no-messages**<br/>Suppress error messages about nonexistent or unreadable files. |
|
||||
| **-U**, **--binary**<br/>Search binary files, but do not attempt to print them. | **-U**, **--binary**<br/>Treat the file(s) as binary. By default, under MS-DOS and MS-Windows, grep guesses whether a file is text or binary as described for the **--binary-files** option. If grep decides the file is a text file, it strips the CR characters from the original file contents (to make regular expressions with ^ and $ work correctly). <br />Specifying **-U** overrules this guesswork, causing all files to be read and passed to the matching mechanism verbatim; if the file is a text file with CR/LF pairs at the end of each line, this will cause some regular expressions to fail. This option has no effect on platforms other than MS-DOS and MS-Windows. |
|
||||
| **-V**, **--version**<br/>Display version information and exit. | **-V**, **--version**<br/> Output the version number of grep and exit. |
|
||||
| **-v**, **--invert-match**<br/>Selected lines are those not matching any of the specified patterns. | **-v**, **--invert-match**<br/>Invert the sense of matching, to select non-matching lines. |
|
||||
| **-w**, **--word-regexp**<br/>The expression is searched for as a word (as if surrounded by `[[:<:]]` and `[[:>:]]`; see re_format(7)). | **-w**, **--word-regexp**<br/>Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore.This option has no effect if -x is also specified. |
|
||||
| **-x**, **--line-regexp**<br/>Only input lines selected against an entire fixed string or regular expression are considered to be matching lines. | **-x**, **--line-regexp**<br/>Select only those matches that exactly match the whole line. For a regular expression pattern, this is like parenthesizing the pattern and then surrounding it with ^ and $. |
|
||||
| **-y**<br />Equivalent to **-i**. Obsoleted. | **-y**<br />Obsolete synonym for **-i.** |
|
||||
| **-Z**, **-z**, **--decompress**<br/>Force grep to behave as zgrep. | |
|
||||
| | **-z**, **--null-data**<br/>Treat input and output data as sequences of lines, each terminated by a zero byte (the ASCII NUL character) instead of a newline. Like the **-Z** or --null option, this option can be used with commands like sort **-z** to process arbitrary file names. |
|
||||
| **--binary-files**=value<br/>Controls searching and printing of binary files. Options are *binary*, the default: search binary files but do not print them; *without-match*: do not search binary files; and *text*: treat all files as text. | **--binary-files**=TYPE<br/>If a file's data or metadata indicate that the file contains binary data, assume that the file is of type TYPE. Non-text bytes indicate binary data; these are either output bytes that are improperly encoded for the current locale, or null input bytes when the **-z** option is not given.<br/><br/>By default, TYPE is *binary*, and grep suppresses output after null input binary data is discovered, and suppresses output lines that contain improperly encoded data. When some output is suppressed, grep follows any output with a one-line message saying that a binary file matches.<br/><br/>If TYPE is *without-match*, when grep discovers null input binary data it assumes that the rest of the file does not match; this is equivalent to the -I option.<br/><br/>If TYPE is *text*, grep processes a binary file as if it were text; this is equivalent to the **-a** option.<br/><br/>When type is *binary*, grep may treat non-text bytes as line terminators even without the **-z** option. This means choosing binary versus text can affect whether a pattern matches a file. For example, when type is *binary* the pattern q$ might match q immediately followed by a null byte, even though this is not matched when type is *text*. Conversely, when type is *binary* the pattern . (period) might not match a null byte.<br/><br/><u>Warning:</u> The **-a** option might output binary garbage, which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands. On the other hand, when reading files whose text encodings are unknown, it can be helpful to use **-a** or to set **LC_ALL='C'** in the environment, in order to find more matches even if the matches are unsafe for direct display. |
|
||||
| **--context**[=num]<br/>Print num lines of leading and trailing context. The default is 2. | |
|
||||
| **--line-buffered**<br/>Force output to be line buffered. By default, output is line buffered when standard output is a terminal and block buffered otherwise. | **--line-buffered**<br/>Use line buffering on output. This can cause a performance penalty. |
|
||||
| | **-i**, **--ignore-case**<br/>Ignore case distinctions in patterns and input data, so that characters that differ only in case match each other. |
|
||||
| | **--no-ignore-case**<br/>Do not ignore case distinctions in patterns and input data. This is the default. This option is useful for passing to shell scripts that already use **-i**, to cancel its effects because the two options override each other. |
|
||||
| | **--label=LABEL**<br />Display input actually coming from standard input as input coming from file LABEL. This can be useful for commands that transform a file's contents before searching, e.g., gzip -cd foo.gz \|grep --label=foo -H 'some pattern'. See also the **-H** |
|
||||
| | **--perl-regexp**<br/>Interpret PATTERNS as Perl-compatible regular expressions (PCREs). This option is experimental when combined with the **-z** (**--null-data**) option, and grep **-P** may warn of unimplemented features. |
|
||||
| | **-T**, **--initial-tab**<br/>Make sure that the first character of actual line content lies on a tab stop, so that the alignment of tabs looks normal.<br/>This is useful with options that prefix their output to the actual content: **-H**,**-n**, and **-b**. In order to improve the probability that lines from a single file will all start at the same column, this also causes the line number and byte offset (if present) to be printed in a minimum size field width. |
|
||||
| | **-u**, **--unix-byte-offsets**<br/>Report Unix-style byte offsets. This switch causes grep to report byte offsets as if the file were a Unix-style text file, i.e., with CR characters stripped off. This will produce results identical to running grep on a Unix machine. This option has no effect unless -b option is also used; it has no effect on platforms other than MS-DOS and MS-Windows. |
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
# interpègrep
|
||||
# grep
|
||||
|
||||
|
||||
|
||||
La commande **grep** permet de rechercher une chaîne de caractères dans un fichier.
|
||||
|
||||
Options:
|
||||
macOS intègre la version BSD de grep
|
||||
|
||||
```bash
|
||||
$ grep -V
|
||||
grep (BSD grep) 2.5.1-FreeBSD
|
||||
```
|
||||
mais peut aussi utiliser la version GNU grâce à Homebrew (rebaptiser ggrep)
|
||||
```bash
|
||||
$ ggrep -V
|
||||
ggrep (GNU grep) 3.6
|
||||
Packaged by Homebrew
|
||||
```
|
||||
|
||||
|
||||
|
||||
Options ([toutes les options](grep-options-fr.md))([US](grep-options.md)):
|
||||
|
||||
```bash
|
||||
-E, --extended-regexp interprète la PATTERN comme Expression Régulière Etendue
|
||||
@@ -106,12 +121,22 @@ Lignes commençant par les caractères compris entre a et d:
|
||||
grep ^[a-d] fichier.txt
|
||||
```
|
||||
|
||||
Lignes ne commençant pas # ou ;
|
||||
|
||||
```bash
|
||||
grep "^[^#;]" smb.conf
|
||||
```
|
||||
|
||||
|
||||
|
||||
Rechercher plusieurs chaines:
|
||||
|
||||
```bash
|
||||
grep -E 'tata|toto' fichier.txt
|
||||
grep -E 'alias|function' ~/.zshrc
|
||||
```
|
||||
|
||||
```bash
|
||||
grep -e alias -e function ~/.zshrc
|
||||
```
|
||||
|
||||
ou passer un fichier de motifs à grep:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Linux
|
||||
|
||||
[Authentification automatique par SSH sans mot de passe](../macos/ssh/ssh-passwordless.md)
|
||||
[Authentification automatique par SSH sans mot de passe](../macOS/ssh/ssh-passwordless.md)
|
||||
|
||||
[Archiver / compresser](archiver.md)
|
||||
|
||||
|
||||
83
docs/Linux/kill.md
Normal file
@@ -0,0 +1,83 @@
|
||||
# kill
|
||||
|
||||
|
||||
|
||||
La commande **kill** permet d’**envoyer un signal à un processus**.
|
||||
|
||||
Elle est couramment utilisée pour fermer (**tuer**) un programme en cours d’exécution.
|
||||
|
||||
|
||||
|
||||
Pour utiliser la commande **kill**, il est nécessaire de connaître le **PID** du processus à fermer.
|
||||
|
||||
On utilise pour cela la commande **pidof**:
|
||||
|
||||
```bash
|
||||
bruno@DS916:~ $ pidof gitea
|
||||
7189
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
bruno@DS916:~ $ ps auxw | grep gitea
|
||||
bruno 18268 0.0 0.0 5856 964 pts/0 S+ 12:57 0:00 grep gitea
|
||||
```
|
||||
|
||||
On peut ensuite fermer (tuer) proprement le processus:
|
||||
|
||||
```bash
|
||||
bruno@DS916:~ $ kill 7189
|
||||
```
|
||||
|
||||
|
||||
|
||||
Si on n’arrivez pas à fermer un programme qui a par exemple planter, il est interressant d’utiliser **kill** avec une option particulière permettant de **forcer la fermeture du processus**
|
||||
|
||||
La **commande kill** permet d’envoyer des signaux à des processus, le signal utilisé pour forcer la fermeture d’un programme est **SIGKILL.** Sachez également que les signaux sont numérotés, le signal SIGKILL a le numéro 9.
|
||||
|
||||
Pour forcer la fermeture d’un processus, utilisez la commande **kill** avec l’**option -s**, cette option permet de spécifier le signal à envoyer.
|
||||
|
||||
```bash
|
||||
bruno@DS916:~ $ kill -s 9 7189
|
||||
```
|
||||
|
||||
```bash
|
||||
bruno@DS916:~ $ kill -s SIGKILL 7189
|
||||
```
|
||||
|
||||
One-line:
|
||||
|
||||
```bash
|
||||
bruno@DS916:~ kill $(pidof firefox)
|
||||
```
|
||||
|
||||
|
||||
|
||||
On peut aussi utiliser la commande **pkill**:
|
||||
|
||||
```bash
|
||||
$ pkill gitea
|
||||
```
|
||||
|
||||
et en forçant la fermeture:
|
||||
|
||||
```bash
|
||||
$ pkill -KILL gitea
|
||||
```
|
||||
|
||||
|
||||
|
||||
##### Lister les signaux disponibles
|
||||
|
||||
```bash
|
||||
$ kill -l
|
||||
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
|
||||
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
|
||||
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
|
||||
16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
|
||||
21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
|
||||
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR
|
||||
31) SIGSYS
|
||||
```
|
||||
|
||||
91
docs/Linux/links.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# Links
|
||||
|
||||
|
||||
|
||||
### soft link (symbolic link):
|
||||
|
||||
- ln -s
|
||||
- contient le chemin du fichier original
|
||||
- link des répertoires
|
||||
|
||||
```bash
|
||||
~ mkdir link
|
||||
|
||||
~ touch link/hello.txt
|
||||
|
||||
~ ln -s link/hello.txt
|
||||
|
||||
~ ls
|
||||
hello.txt link
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Créer un lien symbolic
|
||||
|
||||
```bash
|
||||
~ ln -s link/hello.txt hello_you.txt
|
||||
|
||||
~❯ ls
|
||||
hello.txt link hello_you.txt
|
||||
```
|
||||
|
||||
|
||||
|
||||
### hard link:
|
||||
|
||||
- ln
|
||||
- contient le contenu du fichier original (le hardlink et le fichier original partagent le même inode)
|
||||
- ne link pas des répertoires
|
||||
|
||||
|
||||
|
||||
#### Inode number
|
||||
|
||||
```bash
|
||||
~ touch file_1 file_2
|
||||
|
||||
~ ls -i
|
||||
43767553 file_1 43767554 file_2
|
||||
```
|
||||
|
||||
```bash
|
||||
~ ls -l
|
||||
-rw-r--r-- 1 bruno staff 0 mai 6 18:29 file_1
|
||||
-rw-r--r-- 1 bruno staff 0 mai 6 18:29 file_2
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Créer un hard-link
|
||||
|
||||
```bash
|
||||
~ ln file_1 hard_ln
|
||||
```
|
||||
|
||||
```bash
|
||||
~ ls -li
|
||||
43767553 -rw-r--r-- 2 bruno staff 0 mai 6 18:29 file_1
|
||||
43767554 -rw-r--r-- 1 bruno staff 0 mai 6 18:29 file_2
|
||||
43767553 -rw-r--r-- 2 bruno staff 0 mai 6 18:29 hard_ln
|
||||
43768356 lrwxr-xr-x 1 bruno staff 14 mai 6 18:46 hello.txt -> link/hello.txt
|
||||
43768828 lrwxr-xr-x 1 bruno staff 14 mai 6 18:50 hello_you.txt -> link/hello.txt
|
||||
43768326 drwxr-xr-x 3 bruno staff 96 mai 6 18:46 link
|
||||
```
|
||||
|
||||
file_1 et hard_ln ont le même inode.
|
||||
|
||||
Si on supprime `file_1`, `hard_ln` conserve le même contenu.
|
||||
|
||||
|
||||
|
||||
#### Origine d'un lien
|
||||
|
||||
```bash
|
||||
/opt/homebrew/share/zsh/site-functions stable
|
||||
|
||||
❯ readlink -f _yq
|
||||
/opt/homebrew/Cellar/yq/4.40.5/share/zsh/site-functions/_yq
|
||||
|
||||
```
|
||||
|
||||
234
docs/Linux/locale.md
Normal file
@@ -0,0 +1,234 @@
|
||||
# locale
|
||||
|
||||
|
||||
|
||||
Connaitre la locale:
|
||||
|
||||
```bash
|
||||
$ locale
|
||||
LANG="fr_FR.UTF-8"
|
||||
LC_COLLATE="fr_FR.UTF-8"
|
||||
LC_CTYPE="fr_FR.UTF-8"
|
||||
LC_MESSAGES="fr_FR.UTF-8"
|
||||
LC_MONETARY="fr_FR.UTF-8"
|
||||
LC_NUMERIC="fr_FR.UTF-8"
|
||||
LC_TIME="fr_FR.UTF-8"
|
||||
LC_ALL=
|
||||
```
|
||||
|
||||
Connaitre toutes les locales:
|
||||
|
||||
```bash
|
||||
$ locale -a
|
||||
en_NZ
|
||||
nl_NL.UTF-8
|
||||
pt_BR.UTF-8
|
||||
fr_CH.ISO8859-15
|
||||
eu_ES.ISO8859-15
|
||||
en_US.US-ASCII
|
||||
af_ZA
|
||||
bg_BG
|
||||
cs_CZ.UTF-8
|
||||
fi_FI
|
||||
zh_CN.UTF-8
|
||||
eu_ES
|
||||
sk_SK.ISO8859-2
|
||||
nl_BE
|
||||
fr_BE
|
||||
sk_SK
|
||||
en_US.UTF-8
|
||||
en_NZ.ISO8859-1
|
||||
de_CH
|
||||
sk_SK.UTF-8
|
||||
de_DE.UTF-8
|
||||
am_ET.UTF-8
|
||||
zh_HK
|
||||
be_BY.UTF-8
|
||||
uk_UA
|
||||
pt_PT.ISO8859-1
|
||||
en_AU.US-ASCII
|
||||
kk_KZ.PT154
|
||||
en_US
|
||||
nl_BE.ISO8859-15
|
||||
de_AT.ISO8859-1
|
||||
hr_HR.ISO8859-2
|
||||
fr_FR.ISO8859-1
|
||||
af_ZA.UTF-8
|
||||
am_ET
|
||||
fi_FI.ISO8859-1
|
||||
ro_RO.UTF-8
|
||||
af_ZA.ISO8859-15
|
||||
en_NZ.UTF-8
|
||||
fi_FI.UTF-8
|
||||
hr_HR.UTF-8
|
||||
da_DK.UTF-8
|
||||
ca_ES.ISO8859-1
|
||||
en_AU.ISO8859-15
|
||||
ro_RO.ISO8859-2
|
||||
de_AT.UTF-8
|
||||
pt_PT.ISO8859-15
|
||||
sv_SE
|
||||
fr_CA.ISO8859-1
|
||||
fr_BE.ISO8859-1
|
||||
en_US.ISO8859-15
|
||||
it_CH.ISO8859-1
|
||||
en_NZ.ISO8859-15
|
||||
en_AU.UTF-8
|
||||
de_AT.ISO8859-15
|
||||
af_ZA.ISO8859-1
|
||||
hu_HU.UTF-8
|
||||
et_EE.UTF-8
|
||||
he_IL.UTF-8
|
||||
uk_UA.KOI8-U
|
||||
be_BY
|
||||
kk_KZ
|
||||
hu_HU.ISO8859-2
|
||||
it_CH
|
||||
pt_BR
|
||||
ko_KR
|
||||
it_IT
|
||||
fr_BE.UTF-8
|
||||
ru_RU.ISO8859-5
|
||||
zh_TW
|
||||
zh_CN.GB2312
|
||||
no_NO.ISO8859-15
|
||||
de_DE.ISO8859-15
|
||||
en_CA
|
||||
fr_CH.UTF-8
|
||||
sl_SI.UTF-8
|
||||
uk_UA.ISO8859-5
|
||||
pt_PT
|
||||
hr_HR
|
||||
cs_CZ
|
||||
fr_CH
|
||||
he_IL
|
||||
zh_CN.GBK
|
||||
zh_CN.GB18030
|
||||
fr_CA
|
||||
pl_PL.UTF-8
|
||||
ja_JP.SJIS
|
||||
sr_YU.ISO8859-5
|
||||
be_BY.CP1251
|
||||
sr_YU.ISO8859-2
|
||||
sv_SE.UTF-8
|
||||
sr_YU.UTF-8
|
||||
de_CH.UTF-8
|
||||
sl_SI
|
||||
pt_PT.UTF-8
|
||||
ro_RO
|
||||
en_NZ.US-ASCII
|
||||
ja_JP
|
||||
zh_CN
|
||||
fr_CH.ISO8859-1
|
||||
ko_KR.eucKR
|
||||
be_BY.ISO8859-5
|
||||
nl_NL.ISO8859-15
|
||||
en_GB.ISO8859-1
|
||||
en_CA.US-ASCII
|
||||
is_IS.ISO8859-1
|
||||
ru_RU.CP866
|
||||
nl_NL
|
||||
fr_CA.ISO8859-15
|
||||
sv_SE.ISO8859-15
|
||||
hy_AM
|
||||
en_CA.ISO8859-15
|
||||
en_US.ISO8859-1
|
||||
zh_TW.Big5
|
||||
ca_ES.UTF-8
|
||||
ru_RU.CP1251
|
||||
en_GB.UTF-8
|
||||
en_GB.US-ASCII
|
||||
ru_RU.UTF-8
|
||||
eu_ES.UTF-8
|
||||
es_ES.ISO8859-1
|
||||
hu_HU
|
||||
el_GR.ISO8859-7
|
||||
en_AU
|
||||
it_CH.UTF-8
|
||||
en_GB
|
||||
sl_SI.ISO8859-2
|
||||
ru_RU.KOI8-R
|
||||
nl_BE.UTF-8
|
||||
et_EE
|
||||
fr_FR.ISO8859-15
|
||||
cs_CZ.ISO8859-2
|
||||
lt_LT.UTF-8
|
||||
pl_PL.ISO8859-2
|
||||
fr_BE.ISO8859-15
|
||||
is_IS.UTF-8
|
||||
tr_TR.ISO8859-9
|
||||
da_DK.ISO8859-1
|
||||
lt_LT.ISO8859-4
|
||||
lt_LT.ISO8859-13
|
||||
zh_TW.UTF-8
|
||||
bg_BG.CP1251
|
||||
el_GR.UTF-8
|
||||
be_BY.CP1131
|
||||
da_DK.ISO8859-15
|
||||
is_IS.ISO8859-15
|
||||
no_NO.ISO8859-1
|
||||
nl_NL.ISO8859-1
|
||||
nl_BE.ISO8859-1
|
||||
sv_SE.ISO8859-1
|
||||
pt_BR.ISO8859-1
|
||||
zh_CN.eucCN
|
||||
it_IT.UTF-8
|
||||
en_CA.UTF-8
|
||||
uk_UA.UTF-8
|
||||
de_CH.ISO8859-15
|
||||
de_DE.ISO8859-1
|
||||
ca_ES
|
||||
sr_YU
|
||||
hy_AM.ARMSCII-8
|
||||
ru_RU
|
||||
zh_HK.UTF-8
|
||||
eu_ES.ISO8859-1
|
||||
is_IS
|
||||
bg_BG.UTF-8
|
||||
ja_JP.UTF-8
|
||||
it_CH.ISO8859-15
|
||||
fr_FR.UTF-8
|
||||
ko_KR.UTF-8
|
||||
et_EE.ISO8859-15
|
||||
kk_KZ.UTF-8
|
||||
ca_ES.ISO8859-15
|
||||
en_IE.UTF-8
|
||||
es_ES
|
||||
de_CH.ISO8859-1
|
||||
en_CA.ISO8859-1
|
||||
es_ES.ISO8859-15
|
||||
en_AU.ISO8859-1
|
||||
el_GR
|
||||
da_DK
|
||||
no_NO
|
||||
it_IT.ISO8859-1
|
||||
en_IE
|
||||
zh_HK.Big5HKSCS
|
||||
hi_IN.ISCII-DEV
|
||||
ja_JP.eucJP
|
||||
it_IT.ISO8859-15
|
||||
pl_PL
|
||||
ko_KR.CP949
|
||||
fr_CA.UTF-8
|
||||
fi_FI.ISO8859-15
|
||||
en_GB.ISO8859-15
|
||||
fr_FR
|
||||
hy_AM.UTF-8
|
||||
no_NO.UTF-8
|
||||
es_ES.UTF-8
|
||||
de_AT
|
||||
tr_TR.UTF-8
|
||||
de_DE
|
||||
lt_LT
|
||||
tr_TR
|
||||
C
|
||||
POSIX
|
||||
```
|
||||
|
||||
Liste de tous les mots-clés et catégories:
|
||||
|
||||
```bash
|
||||
$ locale -ck LC_ALL
|
||||
|
||||
```
|
||||
|
||||
BIN
docs/Linux/rg.png
Normal file
|
After Width: | Height: | Size: 134 KiB |
126
docs/Linux/ripgrep.md
Normal file
@@ -0,0 +1,126 @@
|
||||
# ripgrep (rg)
|
||||
|
||||
Remplaçant de *grep*
|
||||
|
||||
https://github.com/BurntSushi/ripgrep
|
||||
|
||||
|
||||
|
||||
##### Installation:
|
||||
|
||||
```bash
|
||||
$ brew install ripgrep
|
||||
```
|
||||
|
||||
##### Utilisation:
|
||||
|
||||
```bash
|
||||
$ rg PATH ~/.zshrc
|
||||
```
|
||||
|
||||
<img src="/Users/bruno/Documents/docs/docs/Linux/rg.png" alt="rg" style="zoom:50%;" />
|
||||
|
||||
```bash
|
||||
# regex ('core' plus 1 ou plusiers lettres)
|
||||
$ rg 'core\w+' ~/.zshrc
|
||||
22:PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH
|
||||
25:coreutils=false
|
||||
|
||||
# regex ('core' plus 0 ou plusiers lettres)
|
||||
$ rg 'core\w*' ~/.zshrc
|
||||
22:PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH
|
||||
25:coreutils=false
|
||||
|
||||
# string
|
||||
$ rg -F 'eval "$(' ~/.zshrc
|
||||
83:eval "$(zoxide init --cmd j zsh)"
|
||||
107:eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"
|
||||
```
|
||||
|
||||
[https://docs.rs/regex/*/regex/#syntax](https://docs.rs/regex/*/regex/#syntax)
|
||||
|
||||
rg dans tout un répertoire:
|
||||
|
||||
```bash
|
||||
$ rg '#!'
|
||||
handbrake-batchconvert.sh
|
||||
1:#!/bin/sh
|
||||
|
||||
composer.sh
|
||||
1:#!/bin/bash
|
||||
|
||||
tmutil.sh
|
||||
1:#!/bin/bash
|
||||
```
|
||||
|
||||
```bash
|
||||
$ rg '#!' Scripts
|
||||
Scripts/kymsu2/kymsu2.sh
|
||||
1:#!/usr/bin/env bash
|
||||
|
||||
Scripts/sonos/test.sh
|
||||
1:#!/usr/bin/env bash
|
||||
```
|
||||
|
||||
En l'absence de chemin, rg cherche dans le répertoire courant.
|
||||
|
||||
##### Filtre manuel:
|
||||
|
||||
```bash
|
||||
# Rechercher uniquement dans les fichiers .sh
|
||||
rg echo -g '*.sh'
|
||||
|
||||
# Rechercher partout sauf dans les fichiers .sh
|
||||
rg echo -g '!*.sh'
|
||||
```
|
||||
|
||||
##### File types
|
||||
|
||||
```bash
|
||||
$ rg --type-list
|
||||
...
|
||||
config: *.cfg, *.conf, *.config, *.ini
|
||||
md: *.markdown, *.md, *.mdown, *.mkdn
|
||||
php: *.php, *.php3, *.php4, *.php5, *.phtml
|
||||
sh: *.bash, *.bashrc, *.csh, *.cshrc, *.ksh, *.kshrc, *.sh, *.tcsh, *.zsh, .bash_login, .bash_logout, .bash_profile, .bashrc, .cshrc, .kshrc, .login, .logout, .profile, .tcshrc, .zlogin, .zlogout, .zprofile, .zshenv, .zshrc, bash_login, bash_logout, bash_profile, bashrc, profile, zlogin, zlogout, zprofile, zshenv, zshrc
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
# Recherche dans les fichiers shell .bashrc, .zshrc...
|
||||
|
||||
$ rg 'eval' --type sh ~/
|
||||
# ou
|
||||
$ rg 'eval' -tsh ~/
|
||||
/Users/bruno/.bash_profile
|
||||
72:eval "$(thefuck --alias)"
|
||||
/Users/bruno/.zprofile
|
||||
1:eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
...
|
||||
|
||||
# Recherche partout sauf dans les fichiers shell .bashrc, .zshrc...
|
||||
|
||||
$ rg 'eval' --type-not sh ~/
|
||||
# ou
|
||||
$ rg 'eval' -Tsh ~/
|
||||
```
|
||||
|
||||
##### Remplacement:
|
||||
|
||||
```bash
|
||||
# recherche / remplacement mot pour mot
|
||||
$ rg fast README.md --replace FAST
|
||||
$ rg fast README.md -r FAST
|
||||
|
||||
# remplacer toute une ligne
|
||||
$ rg '^.*fast.*$' README.md -r FAST
|
||||
```
|
||||
|
||||
##### Fichier de configuration:
|
||||
|
||||
```bash
|
||||
$ cat $HOME/.ripgreprc
|
||||
```
|
||||
|
||||
@@ -35,7 +35,7 @@ Copie d'un répertoire, avec éventuellement ses sous-répertoires, vers un rép
|
||||
~ scp -r /home/mickael/data/ root@192.168.10.131:/var/www/
|
||||
```
|
||||
|
||||
Si pas port 22
|
||||
Si pas port 22:
|
||||
|
||||
```bash
|
||||
~ scp -r -P 7256 /home/mickael/data/ root@192.168.10.131:/var/www/
|
||||
@@ -46,6 +46,13 @@ bruno@clicclac.synology.me's password:
|
||||
IPTV.bundle-master.zip 100% 673KB 84.0KB/s 00:08
|
||||
```
|
||||
|
||||
SCP to synology NAS:
|
||||
|
||||
```bash
|
||||
# option -O
|
||||
scp -v -O -P 7256 -r $HOME//Documents/Scripts/bash/template.txt bruno@clicclac.synology.me:/volume1/web/photos/img/
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Serveur -> Client
|
||||
|
||||
@@ -264,6 +264,13 @@ $ sed -n '1p' test.txt
|
||||
red hat
|
||||
```
|
||||
|
||||
Afficher uniquement la <u>3eme ligne</u>:
|
||||
|
||||
```bash
|
||||
$ sed -n '3p' test.txt
|
||||
mint
|
||||
```
|
||||
|
||||
Afficher la <u>dernière ligne</u>:
|
||||
|
||||
```bash
|
||||
@@ -312,6 +319,23 @@ mint
|
||||
raspbian
|
||||
```
|
||||
|
||||
Afficher les <u>lignes 3 à 5</u>:
|
||||
|
||||
```bash
|
||||
$ sed -n '3,5p' test.txt
|
||||
mint
|
||||
debian
|
||||
raspbian
|
||||
```
|
||||
|
||||
Afficher les <u>n emes lignes</u>:
|
||||
|
||||
```bash
|
||||
# affiche les lignes 3..6..9..
|
||||
# GNU sed
|
||||
$ sed -n '0~3p' test.txt
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Supression de caractères:
|
||||
@@ -389,7 +413,7 @@ debian
|
||||
raspbian
|
||||
```
|
||||
|
||||
Supprimer le dernier caractère de chaque ligne, mais seulement celui spécifié (ici le 'u'):
|
||||
Supprimer le dernier caractère de chaque ligne, mais seulement celui spécifié (ici le 'n'):
|
||||
|
||||
```bash
|
||||
$ sed 's/n$//' test.txt
|
||||
@@ -652,6 +676,100 @@ rAspbiAn
|
||||
|
||||
|
||||
|
||||
#### Ajout de caractères:
|
||||
|
||||
Ajouter un (ou plusieurs) caractère (#) en début de ligne:
|
||||
|
||||
```bash
|
||||
$ sed 's/^/#/' test.txt
|
||||
#red hat
|
||||
#ubuntu
|
||||
#mint
|
||||
#debian
|
||||
#raspbian
|
||||
|
||||
$ sed 's/^/#Prefixe: &/' test.txt
|
||||
#Prefixe: red hat
|
||||
#Prefixe: ubuntu
|
||||
#Prefixe: mint
|
||||
#Prefixe: debian
|
||||
#Prefixe: raspbian
|
||||
|
||||
# Pour modifier le fichiet
|
||||
$ sed -i 's/^/#/' file.txt
|
||||
```
|
||||
|
||||
Ajouter un (ou plusieurs) caractère (#) en fin de ligne:
|
||||
|
||||
```bash
|
||||
$ sed 's/$/#/' test.txt
|
||||
red hat#
|
||||
ubuntu#
|
||||
mint#
|
||||
debian#
|
||||
raspbian#
|
||||
|
||||
$ sed 's/$/ _suffixe/' test.txt
|
||||
red hat _suffixe
|
||||
ubuntu _suffixe
|
||||
mint _suffixe
|
||||
debian _suffixe
|
||||
raspbian _suffixe
|
||||
|
||||
# Pour modifier le fichiet
|
||||
$ sed -i 's/$/#/' file.txt
|
||||
```
|
||||
|
||||
Ajouter un (ou plusieurs) caractère (#) en début d'une ligne précise:
|
||||
|
||||
```bash
|
||||
$ sed 2's/^/#Prefixe: &/' test.txt
|
||||
red hat
|
||||
#Prefixe: ubuntu
|
||||
mint
|
||||
debian
|
||||
raspbian
|
||||
```
|
||||
|
||||
Si on ne connait pas le numéro de ligne:
|
||||
|
||||
```bash
|
||||
$ sed 's/ubuntu/Prefixe: &/' test.txt
|
||||
red hat
|
||||
Prefixe: ubuntu
|
||||
mint
|
||||
debian
|
||||
raspbian
|
||||
|
||||
# ou trouver le numero:
|
||||
$ grep -n "ubuntu" test.txt | cut -d: -f -1
|
||||
2
|
||||
```
|
||||
|
||||
Ajouter un (ou plusieurs) caractère (#) en fin d'une ligne précise:
|
||||
|
||||
```bash
|
||||
$ sed 3's/$/ _suffixe &/' test.txt
|
||||
red hat
|
||||
ubuntu
|
||||
mint _suffixe
|
||||
debian
|
||||
raspbian
|
||||
```
|
||||
|
||||
Ajouter un (ou plusieurs) caractère en début ET en fin d'une ligne précise:
|
||||
|
||||
```bash
|
||||
$ sed 2's/.*/#Prefixe: & _suffixe/' test.txt
|
||||
red hat
|
||||
#Prefixe: ubuntu _suffixe
|
||||
mint
|
||||
debian
|
||||
raspbian
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Ajouter une ligne (à voir pour macOS):
|
||||
|
||||
Ajouter une ligne d'entête:
|
||||
|
||||
@@ -64,12 +64,21 @@ MemTotal: 1963472 kB
|
||||
#### Exécuter un script distant sur un serveur distant:
|
||||
|
||||
```bash
|
||||
bruno@SilverBook:~$ ssh -p34987 bruno@xxxxxxx.synology.me ./test.sh
|
||||
$ ssh -p34987 bruno@xxxxxxx.synology.me ./test.sh
|
||||
bruno@clicclac.synology.me's password:
|
||||
09:55:03 up 2 days, 21:49, 0 users, load average: 1.14, 1.25, 1.23
|
||||
DS916
|
||||
```
|
||||
|
||||
Si le script nécessite un sudo:
|
||||
|
||||
```bash
|
||||
$ ssh -t bruno@maboiteverte.fr ./purge_server.sh
|
||||
|
||||
# sinon erreur:
|
||||
# sudo: no tty present and no askpass program specified
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Exécuter un script local sur un serveur distant:
|
||||
|
||||
@@ -10,17 +10,20 @@
|
||||
$ tail /var/log/messages
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Afficher les 15 dernières lignes du fichier.
|
||||
#### Afficher les 5 dernières lignes du fichier.
|
||||
|
||||
```bash
|
||||
$ tail -n15 /var/log/messages
|
||||
$ tail -15 /var/log/messages
|
||||
$ tail -n 15 /var/log/messages
|
||||
$ tail -n5 /var/log/messages
|
||||
$ tail -5 /var/log/messages
|
||||
$ tail -n 5 /var/log/messages
|
||||
```
|
||||
|
||||
#### Afficher toutes les lignes à partir de N numéro de ligne d’un fichier
|
||||
|
||||
```bash
|
||||
# Tout à partir de la 3e ligne:
|
||||
$ tail -n +3 /var/log/messages
|
||||
```
|
||||
|
||||
#### L'option -f affiche le fichier au fil de l'eau
|
||||
|
||||
@@ -28,6 +31,38 @@ $ tail -n 15 /var/log/messages
|
||||
$ tail -f /var/log/messages
|
||||
```
|
||||
|
||||
Même si le fichier est recrée:
|
||||
|
||||
```bash
|
||||
$ tail -F /var/log/messages
|
||||
```
|
||||
|
||||
#### Supprimer la 1ere ligne
|
||||
|
||||
```bash
|
||||
$ tail -n+2
|
||||
|
||||
$ awk NR\>1
|
||||
```
|
||||
|
||||
#### Afficher les 4 derniers caractères du fichier
|
||||
|
||||
```bash
|
||||
$ tail -c4 /var/log/messages
|
||||
```
|
||||
|
||||
#### Afficher à partir du 5e caractères
|
||||
|
||||
```bash
|
||||
$ tail -c +5 /var/log/messages
|
||||
```
|
||||
|
||||
#### Afficher plusieurs fichiers
|
||||
|
||||
```bash
|
||||
$ tail -n 5 file1.txt file2.txt
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Head
|
||||
@@ -40,6 +75,26 @@ $ head -n5 /var/log/messages
|
||||
$ head -n 5 /var/log/messages
|
||||
```
|
||||
|
||||
#### Afficher les 50 premiers octets du fichier.
|
||||
|
||||
```bash
|
||||
$ head -c 50 var/log/messages
|
||||
```
|
||||
|
||||
#### Afficher plusieurs fichiers
|
||||
|
||||
```bash
|
||||
$ head -n 5 file1.txt file2.txt
|
||||
```
|
||||
|
||||
#### Supprime la dernière ligne
|
||||
|
||||
```bash
|
||||
$ head -n -1
|
||||
|
||||
$ awk 'NR>1{print p}{p=$0}'
|
||||
```
|
||||
|
||||
|
||||
|
||||
### MultiTail
|
||||
|
||||
52
docs/Linux/zoxide.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# zoxide (z-zi)(j-ji)
|
||||
|
||||
https://github.com/ajeetdsouza/zoxide
|
||||
|
||||
|
||||
|
||||
##### Installation:
|
||||
|
||||
```bash
|
||||
$ brew install zoxide
|
||||
```
|
||||
|
||||
##### Ajout au shell:
|
||||
|
||||
```bash
|
||||
# zsh
|
||||
eval "$(zoxide init zsh)"
|
||||
|
||||
# bash
|
||||
eval "$(zoxide init bash)"
|
||||
```
|
||||
|
||||
##### Installer fzf:
|
||||
|
||||
```bash
|
||||
$ brew install fzf
|
||||
# To install useful key bindings and fuzzy completion:
|
||||
$(brew --prefix)/opt/fzf/install
|
||||
```
|
||||
|
||||
##### Configuration:
|
||||
|
||||
```bash
|
||||
# changer les alias prédéfinis (j au lieu de z):
|
||||
eval "$(zoxide init --cmd j zsh)"
|
||||
|
||||
```
|
||||
|
||||
##### Utilisation:
|
||||
|
||||
```bash
|
||||
z foo # cd into highest ranked directory matching foo
|
||||
z foo bar # cd into highest ranked directory matching foo and bar
|
||||
|
||||
z ~/foo # z also works like a regular cd command
|
||||
z foo/ # cd into relative path
|
||||
z .. # cd one level up
|
||||
z - # cd into previous directory
|
||||
|
||||
zi foo # cd with interactive selection (using fzf)
|
||||
```
|
||||
|
||||
@@ -2,13 +2,9 @@
|
||||
|
||||
For full documentation visit [mkdocs.org](http://mkdocs.org).
|
||||
|
||||
Take me to [pookie](#some-heading)
|
||||
|
||||
Take me to [pookie](macos/python/pip.md#Environnement virtuel:)
|
||||
|
||||
|
||||
|
||||
## Installation:
|
||||
### Installation:
|
||||
|
||||
```bash
|
||||
$ pip install mkdocs
|
||||
@@ -16,7 +12,7 @@ $ pip install mkdocs
|
||||
|
||||
|
||||
|
||||
## Commandes:
|
||||
### Commandes:
|
||||
|
||||
* `mkdocs new [dir-name]` - Create a new project.
|
||||
* `mkdocs serve` - Start the live-reloading docs server.
|
||||
@@ -26,7 +22,7 @@ $ pip install mkdocs
|
||||
|
||||
|
||||
|
||||
## Project layout:
|
||||
### Project layout:
|
||||
|
||||
```bash
|
||||
mkdocs.yml # The configuration file.
|
||||
@@ -37,7 +33,7 @@ docs/
|
||||
|
||||
|
||||
|
||||
## Créer un nouveau projet de docs:
|
||||
### Créer un nouveau projet de docs:
|
||||
|
||||
```bash
|
||||
bruno@SilverBook:~$ mkdocs new project
|
||||
@@ -61,7 +57,7 @@ drwxr-xr-x 3 bruno staff 96 16 déc 20:48 docs
|
||||
|
||||
|
||||
|
||||
## Servir le projet:
|
||||
### Servir le projet:
|
||||
|
||||
```bash
|
||||
bruno@SilverBook:~/project$ mkdocs serve
|
||||
@@ -79,7 +75,7 @@ INFO - Cleaning site directory
|
||||
|
||||
|
||||
|
||||
## Copier les docs sur le serveur:
|
||||
### Copier les docs sur le serveur:
|
||||
|
||||
```bash
|
||||
$ cd /Users/bruno/project
|
||||
@@ -101,9 +97,9 @@ scp -P42666 -r ./central_docs bruno@192.168.xxx.xxx:/volume1/web
|
||||
|
||||
|
||||
|
||||
## Admonitions:
|
||||
### Admonitions:
|
||||
|
||||
### Note:
|
||||
#### Note:
|
||||
|
||||
**Note simple:**
|
||||
|
||||
@@ -164,7 +160,7 @@ scp -P42666 -r ./central_docs bruno@192.168.xxx.xxx:/volume1/web
|
||||
???+ note
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
|
||||
|
||||
### Type:
|
||||
#### Type:
|
||||
|
||||
`abstract`, `summary`, `tldr`
|
||||
|
||||
@@ -285,7 +281,7 @@ https://squidfunk.github.io/mkdocs-material/reference/abbreviations/
|
||||
|
||||
|
||||
|
||||
## Font Awesome icons:
|
||||
### Font Awesome icons:
|
||||
|
||||
:fa-link: [http://bwmarrin.github.io/MkDocsPlus/](http://bwmarrin.github.io/MkDocsPlus/)
|
||||
|
||||
@@ -324,9 +320,9 @@ https://squidfunk.github.io/mkdocs-material/reference/abbreviations/
|
||||
|
||||
|
||||
|
||||
## Themes:
|
||||
### Themes:
|
||||
|
||||
### Installer un thème:
|
||||
#### Installer un thème:
|
||||
|
||||
```bash
|
||||
$ pip install mkdocs-cinder
|
||||
@@ -334,7 +330,7 @@ $ pip install mkdocs-cinder
|
||||
|
||||
|
||||
|
||||
### Mettre à jour un thème:
|
||||
#### Mettre à jour un thème:
|
||||
|
||||
```bash
|
||||
$ pip install --upgrade mkdocs-material
|
||||
@@ -352,11 +348,135 @@ https://github.com/otsuarez/mkdocs_auth
|
||||
|
||||
|
||||
|
||||
/Users/bruno/Documents/venv/mkdocs/bin/pip3 install
|
||||
### Plugins:
|
||||
|
||||
- mkdocs-material-extensions
|
||||
- mkdocs-git-revision-date-localized-plugin
|
||||
- mkdocs-minify-plugin
|
||||
- fontawesome_markdown
|
||||
- mkdocs-pdf-export-plugin
|
||||
- markdown
|
||||
- pymdown-extensions
|
||||
|
||||
```bash
|
||||
$ pip install --upgrade mkdocs-material-extensions mkdocs-git-revision-date-localized-plugin mkdocs-minify-plugin fontawesome_markdown mkdocs-pdf-export-plugin markdown pymdown-extensions
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Structures:
|
||||
|
||||
```bash linenums="1" hl_lines="1 19 30 44 45 47 51 67 69"
|
||||
├── central_docs (*)
|
||||
│ ├── Distributions
|
||||
│ │ ├── Mint
|
||||
├── docs
|
||||
│ ├── Distributions
|
||||
│ │ ├── Mint
|
||||
│ │ ├── Mint.md
|
||||
│ │ ├── applications.md
|
||||
│ │ ├── backup.md
|
||||
│ │ ├── grub.md
|
||||
│ │ ├── index.md
|
||||
│ │ ├── samba.md
|
||||
│ │ ├── systemctl.md
|
||||
│ │ ├── vsftpd.md
|
||||
│ │ └── webserver.md
|
||||
│ ├── NBResources
|
||||
│ │ └── Misc
|
||||
│ │ └── RecentItems.txt
|
||||
│ ├── assets (*)
|
||||
│ │ └── icons
|
||||
│ │ ├── icon-128x128.png
|
||||
│ │ ├── icon-144x144.png
|
||||
│ │ ├── icon-152x152.png
|
||||
│ │ ├── icon-192x192.png
|
||||
│ │ ├── icon-384x384.png
|
||||
│ │ ├── icon-512x512.png
|
||||
│ │ ├── icon-72x72.png
|
||||
│ │ └── icon-96x96.png
|
||||
│ ├── index.md
|
||||
│ ├── javascripts (*)
|
||||
│ │ └── extra.js
|
||||
│ ├── macos
|
||||
│ │ ├── Divers
|
||||
│ │ │ ├── Divers.md
|
||||
│ │ │ ├── Hackintosh.md
|
||||
│ │ │ └── weasyprint.md
|
||||
│ │ └── webserver
|
||||
│ │ ├── apache_M1.md
|
||||
│ │ ├── index.md
|
||||
│ │ ├── install_mysql.md
|
||||
│ │ ├── mysql.md
|
||||
│ │ ├── php.md
|
||||
│ │ └── php80.md
|
||||
│ ├── manifest.json (*)
|
||||
│ ├── overrides (*)
|
||||
│ │ └── partials
|
||||
│ ├── stylesheets (*)
|
||||
│ │ ├── extra.css
|
||||
│ │ ├── fontawesome-all.css
|
||||
│ │ └── second_extra.css
|
||||
│ └── webfonts (*)
|
||||
│ ├── fa-brands-400.eot
|
||||
│ ├── fa-brands-400.svg
|
||||
│ ├── fa-brands-400.ttf
|
||||
│ ├── fa-brands-400.woff
|
||||
│ ├── fa-brands-400.woff2
|
||||
│ ├── fa-regular-400.eot
|
||||
│ ├── fa-regular-400.svg
|
||||
│ ├── fa-regular-400.ttf
|
||||
│ ├── fa-regular-400.woff
|
||||
│ ├── fa-regular-400.woff2
|
||||
│ ├── fa-solid-900.eot
|
||||
│ ├── fa-solid-900.svg
|
||||
│ ├── fa-solid-900.ttf
|
||||
│ ├── fa-solid-900.woff
|
||||
│ └── fa-solid-900.woff2
|
||||
├── includes (*)
|
||||
│ └── abbreviations.md
|
||||
├── mkdocs.yml (*)
|
||||
└── src
|
||||
└── mkdocs-pdf-export-plugin
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
- **assets/**
|
||||
* icons
|
||||
+ icon-128x128.png
|
||||
+ icon-96x96.png
|
||||
|
||||
- **javascripts/**
|
||||
* extra.js
|
||||
|
||||
- Manifest.json
|
||||
|
||||
- **stylesheets/**
|
||||
* extra.css
|
||||
* fontawesome-all.css
|
||||
* second_extra.css
|
||||
|
||||
- **webfonts/**
|
||||
* fa-brands-400.eot
|
||||
* fa-regular-400.eot
|
||||
* fa-solid-900.eot
|
||||
|
||||
- **Includes/**
|
||||
* abbreviations.md
|
||||
|
||||
- mkdocs.yml
|
||||
|
||||
- **overrides/**
|
||||
* partials/
|
||||
|
||||
- **central_docs/** : le site crée par `mkdocs build`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Some heading
|
||||
|
||||
### [suite...:material-arrow-right-top:](mkdocs-material.md)
|
||||
|
||||
192
docs/MkDocs/mkdocs-material-2.md
Normal file
@@ -0,0 +1,192 @@
|
||||
# Material for MkDocs
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/
|
||||
|
||||
|
||||
|
||||
### Icons + Emojis
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/icons-emojis/
|
||||
|
||||
```yaml
|
||||
markdown_extensions:
|
||||
- pymdownx.emoji:
|
||||
emoji_index: !!python/name:materialx.emoji.twemoji
|
||||
emoji_generator: !!python/name:materialx.emoji.to_svg
|
||||
```
|
||||
|
||||
|
||||
|
||||
:material-material-design: [Material Design](https://materialdesignicons.com/)
|
||||
|
||||
:fontawesome-brands-font-awesome: [Font Awesome](https://fontawesome.com/search?m=free)
|
||||
|
||||
:octicons-mark-github-16: [Octicons](https://octicons.github.com/)
|
||||
|
||||
|
||||
|
||||
#### Emojis
|
||||
|
||||
```
|
||||
:smile:
|
||||
|
||||
:angry:
|
||||
|
||||
:deer:
|
||||
```
|
||||
|
||||
:smile:
|
||||
|
||||
:angry:
|
||||
|
||||
:deer:
|
||||
|
||||
|
||||
|
||||
#### Icons
|
||||
|
||||
```
|
||||
:material-phone-classic:
|
||||
|
||||
:fontawesome-solid-phone-flip:
|
||||
|
||||
:octicons-megaphone-24:
|
||||
```
|
||||
|
||||
:material-phone-classic:
|
||||
|
||||
:fontawesome-solid-phone-flip:
|
||||
|
||||
:octicons-megaphone-24:
|
||||
|
||||
|
||||
|
||||
|
||||
### Lists
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/lists/
|
||||
|
||||
```
|
||||
markdown_extensions:
|
||||
- def_list
|
||||
- pymdownx.tasklist:
|
||||
custom_checkbox: true
|
||||
```
|
||||
|
||||
#### Unordered lists
|
||||
|
||||
```title="List, unordered"
|
||||
- Nulla et rhoncus turpis. Mauris ultricies elementum leo. Duis efficitur
|
||||
accumsan nibh eu mattis. Vivamus tempus velit eros, porttitor placerat nibh
|
||||
lacinia sed. Aenean in finibus diam.
|
||||
|
||||
* Duis mollis est eget nibh volutpat, fermentum aliquet dui mollis.
|
||||
* Nam vulputate tincidunt fringilla.
|
||||
* Nullam dignissim ultrices urna non auctor.
|
||||
|
||||
+ Vivamus venenatis
|
||||
+ Morbi eget dapibus felis.
|
||||
```
|
||||
|
||||
- Nulla et rhoncus turpis. Mauris ultricies elementum leo. Duis efficitur
|
||||
accumsan nibh eu mattis. Vivamus tempus velit eros, porttitor placerat nibh
|
||||
lacinia sed. Aenean in finibus diam.
|
||||
|
||||
* Duis mollis est eget nibh volutpat, fermentum aliquet dui mollis.
|
||||
* Nam vulputate tincidunt fringilla.
|
||||
* Nullam dignissim ultrices urna non auctor.
|
||||
|
||||
+ Vivamus venenatis
|
||||
+ Morbi eget dapibus felis.
|
||||
|
||||
|
||||
|
||||
|
||||
#### Ordered lists
|
||||
|
||||
```title="List, ordered"
|
||||
1. Vivamus id mi enim. Integer id turpis sapien. Ut condimentum lobortis
|
||||
sagittis. Aliquam purus tellus, faucibus eget urna at, iaculis venenatis
|
||||
nulla. Vivamus a pharetra leo.
|
||||
|
||||
1. Vivamus venenatis porttitor tortor sit amet rutrum. Pellentesque aliquet
|
||||
quam enim, eu volutpat urna rutrum a. Nam vehicula nunc mauris, a
|
||||
ultricies libero efficitur sed.
|
||||
|
||||
2. Morbi eget dapibus felis. Vivamus venenatis porttitor tortor sit amet
|
||||
rutrum. Pellentesque aliquet quam enim, eu volutpat urna rutrum a.
|
||||
|
||||
1. Mauris dictum mi lacus
|
||||
2. Ut sit amet placerat ante
|
||||
3. Suspendisse ac eros arcu
|
||||
|
||||
```
|
||||
|
||||
1. Vivamus id mi enim. Integer id turpis sapien. Ut condimentum lobortis
|
||||
sagittis. Aliquam purus tellus, faucibus eget urna at, iaculis venenatis
|
||||
nulla. Vivamus a pharetra leo.
|
||||
1. Vivamus venenatis porttitor tortor sit amet rutrum. Pellentesque aliquet
|
||||
quam enim, eu volutpat urna rutrum a. Nam vehicula nunc mauris, a
|
||||
ultricies libero efficitur sed.
|
||||
2. Morbi eget dapibus felis. Vivamus venenatis porttitor tortor sit amet
|
||||
rutrum. Pellentesque aliquet quam enim, eu volutpat urna rutrum a.
|
||||
|
||||
1. Mauris dictum mi lacus
|
||||
2. Ut sit amet placerat ante
|
||||
3. Suspendisse ac eros arcu
|
||||
|
||||
|
||||
|
||||
#### Task lists
|
||||
|
||||
```title="Task list"
|
||||
- [x] Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
||||
- [ ] Vestibulum convallis sit amet nisi a tincidunt
|
||||
* [x] In hac habitasse platea dictumst
|
||||
* [x] In scelerisque nibh non dolor mollis congue sed et metus
|
||||
* [ ] Praesent sed risus massa
|
||||
- [ ] Aenean pretium efficitur erat, donec pharetra, ligula non scelerisque
|
||||
|
||||
```
|
||||
|
||||
- [x] Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
||||
- [ ] Vestibulum convallis sit amet nisi a tincidunt
|
||||
* [x] In hac habitasse platea dictumst
|
||||
* [x] In scelerisque nibh non dolor mollis congue sed et metus
|
||||
* [ ] Praesent sed risus massa
|
||||
- [ ] Aenean pretium efficitur erat, donec pharetra, ligula non scelerisque
|
||||
|
||||
|
||||
|
||||
#### Definition lists
|
||||
|
||||
```title="Definition list"
|
||||
`Lorem ipsum dolor sit amet`
|
||||
|
||||
: Sed sagittis eleifend rutrum. Donec vitae suscipit est. Nullam tempus
|
||||
tellus non sem sollicitudin, quis rutrum leo facilisis.
|
||||
|
||||
`Cras arcu libero`
|
||||
|
||||
: Aliquam metus eros, pretium sed nulla venenatis, faucibus auctor ex. Proin
|
||||
ut eros sed sapien ullamcorper consequat. Nunc ligula ante.
|
||||
|
||||
Duis mollis est eget nibh volutpat, fermentum aliquet dui mollis.
|
||||
Nam vulputate tincidunt fringilla.
|
||||
Nullam dignissim ultrices urna non auctor.
|
||||
|
||||
```
|
||||
|
||||
`Lorem ipsum dolor sit amet`
|
||||
|
||||
: Sed sagittis eleifend rutrum. Donec vitae suscipit est. Nullam tempus
|
||||
tellus non sem sollicitudin, quis rutrum leo facilisis.
|
||||
|
||||
`Cras arcu libero`
|
||||
|
||||
: Aliquam metus eros, pretium sed nulla venenatis, faucibus auctor ex. Proin
|
||||
ut eros sed sapien ullamcorper consequat. Nunc ligula ante.
|
||||
|
||||
Duis mollis est eget nibh volutpat, fermentum aliquet dui mollis.
|
||||
Nam vulputate tincidunt fringilla.
|
||||
Nullam dignissim ultrices urna non auctor.
|
||||
71
docs/MkDocs/mkdocs-material-3.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# Material for MkDocs
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/
|
||||
|
||||
|
||||
|
||||
### Images
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/images/
|
||||
|
||||
```yaml
|
||||
markdown_extensions:
|
||||
- attr_list
|
||||
- md_in_html
|
||||
```
|
||||
|
||||
|
||||
|
||||
```title="Image, aligned to left"
|
||||
{ align=left }
|
||||
```
|
||||
|
||||
{ align=left }
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
------
|
||||
|
||||
|
||||
|
||||
```title="Image, aligned to right"
|
||||
{ align=right }
|
||||
```
|
||||
|
||||
{ align=right }
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
|
||||
|
||||
<p {: style="clear: both;"}>
|
||||
|
||||
```title="Image with caption"
|
||||
<figure markdown>
|
||||
{ width="300" }
|
||||
<figcaption>Image caption</figcaption>
|
||||
</figure>
|
||||
```
|
||||
|
||||
<figure markdown>
|
||||
{ width="300" }
|
||||
<figcaption>Image caption</figcaption>
|
||||
</figure>
|
||||
|
||||
{ width="300" }
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
```title="Image, lazy-loaded"
|
||||
{ loading=lazy }
|
||||
```
|
||||
|
||||
{ loading=lazy }
|
||||
590
docs/MkDocs/mkdocs-material.md
Normal file
@@ -0,0 +1,590 @@
|
||||
|
||||
|
||||
# Material for MkDocs
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/
|
||||
|
||||
|
||||
|
||||
### Installer Material
|
||||
|
||||
```bash
|
||||
pip install --upgrade mkdocs-material
|
||||
```
|
||||
|
||||
|
||||
### Installing Python-Markdown
|
||||
|
||||
```bash
|
||||
pip install markdown
|
||||
pip install git+https://github.com/Python-Markdown/markdown.git
|
||||
```
|
||||
|
||||
```bash
|
||||
pip install pymdown-extensions
|
||||
```
|
||||
|
||||
|
||||
|
||||
### pipx
|
||||
|
||||
```bash
|
||||
pipx inject mkdocs mkdocs-material mkdocs-material-extensions mkdocs-minify-plugin mkdocs-git-revision-date-localized-plugin mkdocs-pdf-export-plugin fontawesome_markdown markdown pymdown-extensions
|
||||
```
|
||||
|
||||
|
||||
|
||||
------
|
||||
|
||||
|
||||
|
||||
### Abbreviations
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/abbreviations/
|
||||
|
||||
```yaml
|
||||
markdown_extensions:
|
||||
- abbr
|
||||
- pymdownx.snippets
|
||||
```
|
||||
|
||||
The HTML specification is maintained by the W3C.
|
||||
|
||||
*[HTML]: Hyper Text Markup Language
|
||||
*[W3C]: World Wide Web Consortium
|
||||
|
||||
|
||||
|
||||
### Glossary
|
||||
|
||||
```yaml
|
||||
markdown_extensions:
|
||||
- abbr
|
||||
- pymdownx.snippets
|
||||
```
|
||||
|
||||
The HTML specification is maintained by the W3C.
|
||||
--8<-- "includes/abbreviations.md"
|
||||
|
||||
|
||||
|
||||
### Admonition
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/admonitions/
|
||||
|
||||
```yaml
|
||||
markdown_extensions:
|
||||
- admonition
|
||||
- pymdownx.details
|
||||
- pymdownx.superfences
|
||||
```
|
||||
|
||||
#### Note:
|
||||
|
||||
```
|
||||
!!! note
|
||||
```
|
||||
|
||||
!!! note
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
#### Collapsible blocks
|
||||
|
||||
```
|
||||
??? note
|
||||
```
|
||||
|
||||
??? note
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
```
|
||||
???+ note
|
||||
```
|
||||
|
||||
???+ note
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
#### Inline blocks
|
||||
|
||||
##### Aligné à droite:
|
||||
|
||||
```
|
||||
!!! info inline end
|
||||
```
|
||||
|
||||
!!! info inline end
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur
|
||||
adipiscing elit. Nulla et euismod nulla.
|
||||
Curabitur feugiat, tortor non consequat
|
||||
finibus, justo purus auctor massa, nec
|
||||
semper lorem quam in massa.
|
||||
|
||||
**Important**: admonitions that use the `inline` modifiers *must* be declared prior to the content block you want to place them beside. If there's insufficient space to render the admonition next to the block, the admonition will stretch to the full width of the viewport, e.g. on mobile viewports.
|
||||
|
||||
------
|
||||
|
||||
|
||||
|
||||
##### Aligné à gauche:
|
||||
|
||||
```
|
||||
!!! info inline
|
||||
```
|
||||
|
||||
!!! info inline
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur
|
||||
adipiscing elit. Nulla et euismod nulla.
|
||||
Curabitur feugiat, tortor non consequat
|
||||
finibus, justo purus auctor massa, nec
|
||||
semper lorem quam in massa.
|
||||
|
||||
**Important**: admonitions that use the `inline` modifiers *must* be declared prior to the content block you want to place them beside. If there's insufficient space to render the admonition next to the block, the admonition will stretch to the full width of the viewport, e.g. on mobile viewports.
|
||||
|
||||
------
|
||||
|
||||
|
||||
|
||||
#### Titre personnalisé:
|
||||
|
||||
```
|
||||
!!! note "Phasellus posuere in sem ut cursus"
|
||||
```
|
||||
|
||||
!!! note "Phasellus posuere in sem ut cursus"
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
#### Sans titre:
|
||||
|
||||
```
|
||||
!!! note ""
|
||||
```
|
||||
|
||||
!!! note ""
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
#### Supported types
|
||||
|
||||
#### `info` `todo`
|
||||
|
||||
!!! info "Info"
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
`abstract` `summary` `tldr`
|
||||
|
||||
!!! abstract "Info"
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
`tip` `hint` `important`
|
||||
|
||||
!!! tip "Info"
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
`success` `check` `done`
|
||||
|
||||
!!! success "Info"
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
`question` `help` `faq`
|
||||
|
||||
!!! question "Info"
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
`warning` `caution` `attention`
|
||||
|
||||
!!! warning "Info"
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
`failure` `fail` `missing`
|
||||
|
||||
!!! failure "Info"
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
`danger` `error`
|
||||
|
||||
!!! danger "Info"
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
`bug`
|
||||
|
||||
!!! bug "Info"
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
`example`
|
||||
|
||||
!!! example "Info"
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
`quote` `cite`
|
||||
|
||||
!!! quote "Info"
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
|
||||
|
||||
### Annotations
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/annotations/
|
||||
|
||||
|
||||
|
||||
### Buttons
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/buttons/
|
||||
|
||||
|
||||
|
||||
### Code blocks
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/code-blocks/
|
||||
|
||||
```yaml
|
||||
markdown_extensions:
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.snippets
|
||||
- pymdownx.superfences
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Add a title
|
||||
|
||||
```
|
||||
<shortcode> title="<custom title>"
|
||||
```
|
||||
|
||||
``` py title="bubble_sort.py"
|
||||
def bubble_sort(items):
|
||||
for i in range(len(items)):
|
||||
for j in range(len(items) - 1 - i):
|
||||
if items[j] > items[j + 1]:
|
||||
items[j], items[j + 1] = items[j + 1], items[j]
|
||||
```
|
||||
|
||||
#### Add line number
|
||||
|
||||
```
|
||||
<shortcode> linenums="<start>"
|
||||
```
|
||||
|
||||
``` py linenums="1"
|
||||
def bubble_sort(items):
|
||||
for i in range(len(items)):
|
||||
for j in range(len(items) - 1 - i):
|
||||
if items[j] > items[j + 1]:
|
||||
items[j], items[j + 1] = items[j + 1], items[j]
|
||||
```
|
||||
|
||||
#### Highlighting specific lines
|
||||
|
||||
```
|
||||
<shortcode> hl_lines="2 4"
|
||||
```
|
||||
|
||||
``` py hl_lines="2 4"
|
||||
def bubble_sort(items):
|
||||
for i in range(len(items)):
|
||||
for j in range(len(items) - 1 - i):
|
||||
if items[j] > items[j + 1]:
|
||||
items[j], items[j + 1] = items[j + 1], items[j]
|
||||
```
|
||||
|
||||
#### Highlighting inline code blocks
|
||||
|
||||
```
|
||||
#!<sortcode>
|
||||
```
|
||||
|
||||
The `#!python range()` function is used to generate a sequence of numbers.
|
||||
|
||||
|
||||
|
||||
### Content tabs
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/content-tabs/
|
||||
|
||||
|
||||
|
||||
### Data tables
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/data-tables/
|
||||
|
||||
```yam
|
||||
markdown_extensions:
|
||||
- tables
|
||||
```
|
||||
|
||||
#### Aligner une colonne à gauche
|
||||
|
||||
```markdown
|
||||
| Method | Description |
|
||||
| :---------- | :----------------------------------- |
|
||||
| `GET` | :material-check: Fetch resource |
|
||||
| `PUT` | :material-check-all: Update resource |
|
||||
| `DELETE` | :material-close: Delete resource |
|
||||
```
|
||||
|
||||
| Method | Description |
|
||||
| :------- | :----------------------------------- |
|
||||
| `GET` | :material-check: Fetch resource |
|
||||
| `PUT` | :material-check-all: Update resource |
|
||||
| `DELETE` | :material-close: Delete resource |
|
||||
|
||||
#### Aligner une colonne au centre
|
||||
|
||||
```markdown
|
||||
| Method | Description |
|
||||
| :---------: | :----------------------------------: |
|
||||
| `GET` | :material-check: Fetch resource |
|
||||
| `PUT` | :material-check-all: Update resource |
|
||||
| `DELETE` | :material-close: Delete resource |
|
||||
```
|
||||
|
||||
| Method | Description |
|
||||
| :------: | :----------------------------------: |
|
||||
| `GET` | :material-check: Fetch resource |
|
||||
| `PUT` | :material-check-all: Update resource |
|
||||
| `DELETE` | :material-close: Delete resource |
|
||||
|
||||
#### Aligner une colonne à droite
|
||||
|
||||
```markdown
|
||||
| Method | Description |
|
||||
| ----------: | -----------------------------------: |
|
||||
| `GET` | :material-check: Fetch resource |
|
||||
| `PUT` | :material-check-all: Update resource |
|
||||
| `DELETE` | :material-close: Delete resource |
|
||||
```
|
||||
|
||||
| Method | Description |
|
||||
| -------: | -----------------------------------: |
|
||||
| `GET` | :material-check: Fetch resource |
|
||||
| `PUT` | :material-check-all: Update resource |
|
||||
| `DELETE` | :material-close: Delete resource |
|
||||
|
||||
#### Trier une colonne
|
||||
|
||||
```yaml
|
||||
extra_javascript:
|
||||
- https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js
|
||||
- javascripts/tablesort.js
|
||||
```
|
||||
|
||||
|
||||
|
||||
| Method | Description |
|
||||
| -------- | ------------------------------------ |
|
||||
| `GET` | :material-check: Fetch resource |
|
||||
| `PUT` | :material-check-all: Update resource |
|
||||
| `DELETE` | :material-close: Delete resource |
|
||||
|
||||
### Diagrams
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/diagrams/
|
||||
|
||||
|
||||
|
||||
### Footnotes
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/footnotes/
|
||||
|
||||
```yaml
|
||||
markdown_extensions:
|
||||
- footnotes
|
||||
```
|
||||
|
||||
#### Adding footnote references
|
||||
|
||||
```
|
||||
Lorem ipsum[^1] dolor sit amet, consectetur adipiscing elit.[^2]
|
||||
```
|
||||
|
||||
Lorem ipsum[^1] dolor sit amet, consectetur adipiscing elit.[^2]
|
||||
|
||||
#### Adding footnote content
|
||||
|
||||
```
|
||||
[^1]: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
```
|
||||
|
||||
[^1]: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
|
||||
[Footnote 1](#fn:1)
|
||||
|
||||
```
|
||||
[^2]:
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
```
|
||||
|
||||
[^2]:
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
|
||||
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
|
||||
massa, nec semper lorem quam in massa.
|
||||
|
||||
[Footnote 2](#fn:2)
|
||||
|
||||
|
||||
|
||||
### Formatting
|
||||
|
||||
https://squidfunk.github.io/mkdocs-material/reference/formatting/
|
||||
|
||||
```yaml
|
||||
markdown_extensions:
|
||||
- pymdownx.critic
|
||||
- pymdownx.caret
|
||||
- pymdownx.keys
|
||||
- pymdownx.mark
|
||||
- pymdownx.tilde
|
||||
```
|
||||
|
||||
#### Highlighting changes
|
||||
|
||||
```
|
||||
Text can be {--deleted--} and replacement text {++added++}. This can also be
|
||||
combined into {~~one~>a single~~} operation. {==Highlighting==} is also
|
||||
possible {>>and comments can be added inline<<}.
|
||||
|
||||
{==
|
||||
|
||||
Formatting can also be applied to blocks by putting the opening and closing
|
||||
tags on separate lines and adding new lines between the tags and the content.
|
||||
|
||||
==}
|
||||
```
|
||||
|
||||
Text can be {--deleted--} and replacement text {++added++}. This can also be
|
||||
combined into {~~one~>a single~~} operation. {==Highlighting==} is also
|
||||
possible {>>and comments can be added inline<<}.
|
||||
|
||||
{==
|
||||
|
||||
Formatting can also be applied to blocks by putting the opening and closing
|
||||
tags on separate lines and adding new lines between the tags and the content.
|
||||
|
||||
==}
|
||||
|
||||
#### Highlighting text
|
||||
|
||||
```
|
||||
- ==This was marked==
|
||||
- ^^This was inserted^^
|
||||
- ~~This was deleted~~
|
||||
```
|
||||
|
||||
- ==This was marked==
|
||||
- ^^This was inserted^^
|
||||
- ~~This was deleted~~
|
||||
|
||||
#### Sub- and superscripts
|
||||
|
||||
```
|
||||
- H~2~0
|
||||
- A^T^A
|
||||
```
|
||||
|
||||
- H~2~0
|
||||
- A^T^A
|
||||
|
||||
#### Keys
|
||||
|
||||
```
|
||||
++ctrl+alt+del++
|
||||
|
||||
++cmd+alt+"Ü"++
|
||||
|
||||
++cmd++
|
||||
```
|
||||
|
||||
++ctrl+alt+"My Special Key"++
|
||||
|
||||
++cmd+alt+"Ü"++
|
||||
|
||||
++cmd++
|
||||
|
||||
|
||||
|
||||
[suite...:material-arrow-right-top:](mkdocs-material-2.md)
|
||||
|
||||
###
|
||||
@@ -36,13 +36,13 @@ mysql> UPDATE USER.master SET PASSWORD = AES_ENCRYPT('a_password','a_passkey') W
|
||||
- Backup du nouveau dossier data:
|
||||
|
||||
```bash
|
||||
sudo mv /usr/local/mysql-5.6.14-osx10.7-x86_64/data /usr/local/mysql-5.6.14-osx10.7-x86_64/dataold
|
||||
$ sudo mv /usr/local/mysql-5.6.14-osx10.7-x86_64/data /usr/local/mysql-5.6.14-osx10.7-x86_64/dataold
|
||||
```
|
||||
|
||||
- Copie des anciennes bases à leur nouveau emplacement:
|
||||
|
||||
```bash
|
||||
sudo cp -rf /usr/local/mysql-5.5.13-osx10.6-x86_64/data /usr/local/mysql-5.6.10-osx10.7-x86_64/
|
||||
$ sudo cp -rf /usr/local/mysql-5.5.13-osx10.6-x86_64/data /usr/local/mysql-5.6.10-osx10.7-x86_64/
|
||||
```
|
||||
|
||||
- Redémarrer MySQL
|
||||
@@ -1,8 +0,0 @@
|
||||
# Fix the 2002 MySQL Socket error (OSX)
|
||||
|
||||
```bash
|
||||
$ sudo mkdir /var/mysql
|
||||
|
||||
$ sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
|
||||
```
|
||||
|
||||
158
docs/MySQL/bases.md
Normal file
@@ -0,0 +1,158 @@
|
||||
# Bases
|
||||
|
||||
|
||||
|
||||
### Voir toutes les bases:
|
||||
|
||||
`mysql> SHOW DATABASES;`
|
||||
|
||||
```mysql
|
||||
MariaDB [(none)]> SHOW DATABASES;
|
||||
+--------------------+
|
||||
| Database |
|
||||
+--------------------+
|
||||
| information_schema |
|
||||
| mysql |
|
||||
| performance_schema |
|
||||
| sys |
|
||||
| wordpress |
|
||||
+--------------------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Utiliser une base existante:
|
||||
|
||||
`mysql> USE database;`
|
||||
|
||||
```mysql
|
||||
MariaDB [(none)]> USE wordpress;
|
||||
Reading table information for completion of table and column names
|
||||
You can turn off this feature to get a quicker startup with -A
|
||||
|
||||
Database changed
|
||||
MariaDB [wordpress]>
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Créer une base de donnée:
|
||||
|
||||
`mysql> CREATE DATABASE database;`
|
||||
|
||||
```mysql
|
||||
MariaDB [(none)]> CREATE DATABASE bdd;
|
||||
Query OK, 1 row affected (0.001 sec)
|
||||
```
|
||||
|
||||
et donner les privilèges à un utilisateur (existant) sur cette base:
|
||||
|
||||
```mysql
|
||||
MariaDB [(none)]> GRANT ALL ON bdd.* TO 'theuser'@'localhost';
|
||||
Query OK, 0 rows affected (0.021 sec)
|
||||
|
||||
MariaDB [(none)]> FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
ou à un utilisateur qui n'existe pas encore:
|
||||
|
||||
```mysql
|
||||
MariaDB [(none)]> GRANT ALL ON bdd.* TO 'matrix'@'localhost' IDENTIFIED BY 'password';
|
||||
Query OK, 0 rows affected (0.030 sec)
|
||||
|
||||
MariaDB [(none)]> FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
L'utilisateur 'matrix' sera crée.
|
||||
|
||||
|
||||
|
||||
`mysql> CREATE DATABASE IF NOT EXISTS database;`
|
||||
|
||||
Avec `IF NOT EXISTS`, la base est créée uniquement si il n'y a pas de conflit de nom. Sans, MySQL envoie une erreur.
|
||||
|
||||
```mysql
|
||||
MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS bdd;
|
||||
Query OK, 1 row affected (0.003 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
`CHARACTER SET` `COLLATE`
|
||||
|
||||
```mariadb
|
||||
MariaDB [(none)]> CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
Query OK, 1 row affected (0.005 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Supprimer une base:
|
||||
|
||||
`mysql> DROP DATABASE database;`
|
||||
|
||||
```mysql
|
||||
MariaDB [(none)]> DROP DATABASE bdd;
|
||||
Query OK, 0 rows affected (0.074 sec)
|
||||
```
|
||||
|
||||
Ajouter `IF EXISTS` évite le message d'erreur si la base n'existe pas:
|
||||
|
||||
```mariadb
|
||||
MariaDB [(none)]> DROP DATABASE IF EXISTS zenphoto;
|
||||
Query OK, 0 rows affected, 1 warning (0.000 sec)
|
||||
```
|
||||
|
||||
```mariadb
|
||||
MariaDB [(none)]> DROP DATABASE zenphoto;
|
||||
ERROR 1008 (HY000): Can't drop database 'zenphoto'; database doesn't exist
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Bases dans macOS:
|
||||
|
||||
Les bases se trouvent dans: `$(brew --prefix)/var/mysql`
|
||||
|
||||
**mac intel:**
|
||||
|
||||
```bash
|
||||
bruno@SilverBook: /usr/local/var/mysql $ l
|
||||
total 245920
|
||||
-rw-rw---- 1 bruno admin 6519 15 oct 17:48 SilverBook.local.err
|
||||
-rw-rw---- 1 bruno admin 5 15 oct 17:48 SilverBook.local.pid
|
||||
-rw-rw---- 1 bruno admin 24576 15 oct 17:46 aria_log.00000001
|
||||
-rw-rw---- 1 bruno admin 52 15 oct 17:46 aria_log_control
|
||||
-rw-r----- 1 bruno admin 976 15 oct 17:46 ib_buffer_pool
|
||||
-rw-rw---- 1 bruno admin 50331648 15 oct 17:48 ib_logfile0
|
||||
-rw-rw---- 1 bruno admin 50331648 6 aoû 20:18 ib_logfile1
|
||||
-rw-rw---- 1 bruno admin 12582912 15 oct 17:46 ibdata1
|
||||
-rw-rw---- 1 bruno admin 12582912 15 oct 17:48 ibtmp1
|
||||
-rw-rw---- 1 bruno admin 0 6 aoû 20:18 multi-master.info
|
||||
drwx------ 90 bruno admin 2880 6 aoû 20:18 mysql
|
||||
drwx------ 3 bruno admin 96 6 aoû 20:18 performance_schema
|
||||
-rw-rw---- 1 bruno admin 3047 11 aoû 22:49 silverbook-1.home.err
|
||||
-rw-rw---- 1 bruno admin 30926 15 oct 17:46 silverbook.home.err
|
||||
```
|
||||
|
||||
**mac M1:**
|
||||
|
||||
```bash
|
||||
❯ cd /opt/homebrew/var/mysql
|
||||
total 123324
|
||||
-rw-rw---- 1 bruno admin 7308 sep 2 16:19 AirBook.err
|
||||
-rw-rw---- 1 bruno admin 5 aoû 11 23:09 airbook.pid
|
||||
-rw-rw---- 1 bruno admin 417792 sep 3 18:18 aria_log.00000001
|
||||
-rw-rw---- 1 bruno admin 52 aoû 11 22:49 aria_log_control
|
||||
-rw-rw---- 1 bruno admin 16384 sep 3 18:18 ddl_recovery.log
|
||||
-rw-r----- 1 bruno admin 946 aoû 11 22:49 ib_buffer_pool
|
||||
-rw-rw---- 1 bruno admin 100663296 sep 3 18:18 ib_logfile0
|
||||
-rw-rw---- 1 bruno admin 12582912 aoû 11 22:49 ibdata1
|
||||
-rw-rw---- 1 bruno admin 12582912 aoû 11 23:09 ibtmp1
|
||||
-rw-rw---- 1 bruno admin 0 jul 29 09:44 multi-master.info
|
||||
drwx------ 90 bruno admin 2880 sep 3 18:18 mysql
|
||||
drwx------ 3 bruno admin 96 jul 29 09:43 performance_schema
|
||||
drwx------ 109 bruno admin 3488 sep 3 18:18 sys
|
||||
drwx------ 27 bruno admin 864 sep 3 18:18 wordpress
|
||||
```
|
||||
|
||||
78
docs/MySQL/connexion.md
Normal file
@@ -0,0 +1,78 @@
|
||||
# Connexion à la base:
|
||||
|
||||
|
||||
|
||||
### Se connecter à MySQL:
|
||||
|
||||
```bash
|
||||
$ mysql -u root -p
|
||||
Enter password:
|
||||
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
||||
Your MariaDB connection id is 18
|
||||
Server version: 10.3.11-MariaDB Homebrew
|
||||
|
||||
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
||||
|
||||
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
||||
|
||||
MariaDB [(none)]>
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Se connecter directement à une base:
|
||||
|
||||
```bash
|
||||
$ mysql -u root -p wordpress
|
||||
Enter password:
|
||||
Reading table information for completion of table and column names
|
||||
You can turn off this feature to get a quicker startup with -A
|
||||
|
||||
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
||||
Your MariaDB connection id is 139
|
||||
Server version: 10.6.4-MariaDB Homebrew
|
||||
|
||||
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
||||
|
||||
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
||||
|
||||
MariaDB [wordpress]>
|
||||
```
|
||||
|
||||
|
||||
|
||||
`$ mysql -u root -pwordpress`: se connecter directement à MySQL avec le mot de passe 'wordpress'.
|
||||
|
||||
`$ mysql -u root -p wordpress`: se connecter à la base wordpress. Le mot de passe est demandé.
|
||||
|
||||
`$ mysql -u root -ppassword wordpress`: se connecter directement à la base wordpress avec le mot de passe 'password'.
|
||||
|
||||
|
||||
|
||||
### Configuration:
|
||||
|
||||
#### my.cnf
|
||||
|
||||
```bash
|
||||
bruno@SilverBook: /usr/local/etc $ ls -la
|
||||
total 160
|
||||
-rw-r--r-- 1 bruno admin 212 4 sep 16:53 my.cnf
|
||||
drwxr-xr-x 3 bruno admin 96 16 aoû 10:43 my.cnf.d
|
||||
-rw-r--r-- 1 bruno admin 113 4 sep 16:53 my.cnf.default
|
||||
```
|
||||
|
||||
```bash
|
||||
bruno@SilverBook: /usr/local/etc/my.cnf.d $ l
|
||||
total 0
|
||||
-rw-r--r-- 1 bruno admin 0 16 aoû 10:43 wont_prune.txt
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Quitter MySQL:
|
||||
|
||||
```bash
|
||||
MariaDB [wordpress4]> exit
|
||||
Bye
|
||||
```
|
||||
|
||||
14
docs/MySQL/host.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Host
|
||||
|
||||
|
||||
|
||||
Host est la machine à partir de laquelle l'utilisateur se connecte se connecte à la base.
|
||||
|
||||
|
||||
|
||||
| host | |
|
||||
| ---------------- | ------------------------------------------------------------ |
|
||||
| '%' | - depuis n'importe quel host (remote & local) (wildcard)<br />- n'inclue pas 'localhost' qui suppose un connexion par socket unix au lieu du standard TCP/IP |
|
||||
| 'localhost' | - uniquement des connections locales |
|
||||
| '198.51.100.177' | - depuis le host dont l'IP est '198.51.100.177' |
|
||||
|
||||
@@ -2,84 +2,36 @@
|
||||
|
||||
|
||||
|
||||
### Install MariaDB avec Homebrew:
|
||||
1. [Installation (Homebrew)](install.md)
|
||||
2. [Connexion](connexion.md)
|
||||
3. [Type de bases](type_bases.md)
|
||||
4. [Host](host.md)
|
||||
5. [Bases (requêtes)](bases.md)
|
||||
6. [Utilisateurs (requêtes)](users.md)
|
||||
7. [Privilèges (requêtes)](privileges.md)
|
||||
8. [Tables (requêtes)](tables.md)
|
||||
9. [select](select.md)
|
||||
10. [Réparer](repair.md)
|
||||
11. [Backup](Backup.md)
|
||||
12. [mysqlcheck](mysqlcheck.md)
|
||||
13. [Passwords](password.md)
|
||||
14. [Trucs](trucs.md)
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
bruno@SilverBook: ~ $ sudo find / -name mysql
|
||||
Password:
|
||||
/usr/local/bin/mysql
|
||||
/usr/local/include/mysql
|
||||
/usr/local/etc/init.d/mysql
|
||||
/usr/local/etc/logrotate.d/mysql
|
||||
/usr/local/var/mysql
|
||||
/usr/local/var/mysql/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/bin/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/server/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/.bottle/etc/init.d/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/.bottle/etc/logrotate.d/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/share/mysql
|
||||
/usr/local/share/mysql
|
||||
Voir le n° de version:
|
||||
|
||||
```mariadb
|
||||
MariaDB [(none)]> SELECT VERSION(), CURRENT_DATE;
|
||||
+----------------+--------------+
|
||||
| VERSION() | CURRENT_DATE |
|
||||
+----------------+--------------+
|
||||
| 10.6.4-MariaDB | 2021-09-04 |
|
||||
+----------------+--------------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### my.cnf
|
||||
|
||||
```bash
|
||||
bruno@SilverBook: /usr/local/etc $ ls -la
|
||||
total 160
|
||||
-rw-r--r-- 1 bruno admin 212 4 sep 16:53 my.cnf
|
||||
drwxr-xr-x 3 bruno admin 96 16 aoû 10:43 my.cnf.d
|
||||
-rw-r--r-- 1 bruno admin 113 4 sep 16:53 my.cnf.default
|
||||
```
|
||||
|
||||
```bash
|
||||
bruno@SilverBook: /usr/local/etc/my.cnf.d $ l
|
||||
total 0
|
||||
-rw-r--r-- 1 bruno admin 0 16 aoû 10:43 wont_prune.txt
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Bases
|
||||
|
||||
```bash
|
||||
bruno@SilverBook: /usr/local/var/mysql $ l
|
||||
total 245920
|
||||
-rw-rw---- 1 bruno admin 6519 15 oct 17:48 SilverBook.local.err
|
||||
-rw-rw---- 1 bruno admin 5 15 oct 17:48 SilverBook.local.pid
|
||||
-rw-rw---- 1 bruno admin 24576 15 oct 17:46 aria_log.00000001
|
||||
-rw-rw---- 1 bruno admin 52 15 oct 17:46 aria_log_control
|
||||
-rw-r----- 1 bruno admin 976 15 oct 17:46 ib_buffer_pool
|
||||
-rw-rw---- 1 bruno admin 50331648 15 oct 17:48 ib_logfile0
|
||||
-rw-rw---- 1 bruno admin 50331648 6 aoû 20:18 ib_logfile1
|
||||
-rw-rw---- 1 bruno admin 12582912 15 oct 17:46 ibdata1
|
||||
-rw-rw---- 1 bruno admin 12582912 15 oct 17:48 ibtmp1
|
||||
-rw-rw---- 1 bruno admin 0 6 aoû 20:18 multi-master.info
|
||||
drwx------ 90 bruno admin 2880 6 aoû 20:18 mysql
|
||||
drwx------ 3 bruno admin 96 6 aoû 20:18 performance_schema
|
||||
-rw-rw---- 1 bruno admin 3047 11 aoû 22:49 silverbook-1.home.err
|
||||
-rw-rw---- 1 bruno admin 30926 15 oct 17:46 silverbook.home.err
|
||||
```
|
||||
|
||||
|
||||
|
||||
[Reset Expired root Password for MySQL 5.7 on Mac OS X](Expired-root-Password.md)
|
||||
|
||||
[mysqlcheck](mysqlcheck.md)
|
||||
|
||||
[backup](Backup.md)
|
||||
|
||||
[Socket error](Socket-error.md)
|
||||
|
||||
[Commandes diverses](diverses.md)
|
||||
|
||||
|
||||
|
||||
### Liens:
|
||||
|
||||
[:fa-link: https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/](https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/)
|
||||
@@ -88,3 +40,5 @@ drwx------ 3 bruno admin 96 6 aoû 20:18 performance_schema
|
||||
|
||||
[:fa-link: http://apple.stackexchange.com/questions/255671/error-mysql-server-pid-file-could-not-be-found](http://apple.stackexchange.com/questions/255671/error-mysql-server-pid-file-could-not-be-found)
|
||||
|
||||
|
||||
|
||||
|
||||
55
docs/MySQL/install.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# Install MariaDB avec Homebrew:
|
||||
|
||||
#### Installation:
|
||||
|
||||
```bash
|
||||
$ brew install mariadb
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Démarrer le serveur:
|
||||
|
||||
```bash
|
||||
$ brew services start mariadb
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Changer le mot-de-passe MySQL:
|
||||
|
||||
```bash
|
||||
$ sudo /usr/local/bin/mysql_secure_installation
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Arrêter le serveur:
|
||||
|
||||
```bash
|
||||
$ brew services stop mariadb
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Fichiers installés:
|
||||
|
||||
```bash
|
||||
bruno@SilverBook: ~ $ sudo find / -name mysql
|
||||
Password:
|
||||
/usr/local/bin/mysql
|
||||
/usr/local/include/mysql
|
||||
/usr/local/etc/init.d/mysql
|
||||
/usr/local/etc/logrotate.d/mysql
|
||||
/usr/local/var/mysql
|
||||
/usr/local/var/mysql/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/bin/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/server/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/.bottle/etc/init.d/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/.bottle/etc/logrotate.d/mysql
|
||||
/usr/local/Cellar/mariadb/10.4.6_1/share/mysql
|
||||
/usr/local/share/mysql
|
||||
```
|
||||
|
||||
150
docs/MySQL/privileges.md
Normal file
@@ -0,0 +1,150 @@
|
||||
# Privileges:
|
||||
|
||||
|
||||
|
||||
Le contrôle d'accès de MySQL se fait en deux étapes :
|
||||
|
||||
- Etape 1 : Le serveur vérifie que vous êtes autorisé à vous connecter.
|
||||
- Etape 2 : En supposant que vous pouvez vous connecter, le serveur vérifie chaque requête que vous soumettez, pour vérifier si vous avez les droits suffisants pour l'exécuter. Par exemple, si vous sélectionnez des droits dans une table, ou effacez une table, le serveur s'assure que vous avez les droits de SELECT pour cette table, ou les droits de DROP, respectivement.
|
||||
|
||||
|
||||
|
||||
#### Les commandes les plus courantes:
|
||||
|
||||
- **ALL PRIVILEGES** – Donne à l'utilisateur de MySQL un total accès à une base de données désignée (ou un accès global à l'ensemble du système si aucune base de données n'est sélectionnée)
|
||||
- **CREATE** – Permet aux utilisateurs de créer des bases de données/tableaux
|
||||
- **ALTER** –
|
||||
|
||||
- **SELECT** – Permet aux utilisateurs de récupérer des données
|
||||
|
||||
- **INSERT** – Permet aux utilisateurs d’ajouter de nouvelles entrées dans les tableaux
|
||||
|
||||
- **UPDATE** – Permet aux utilisateurs de modifier les entrées existantes dans les tableaux
|
||||
|
||||
- **DELETE** – Permet aux utilisateurs de supprimer les entrées de la tableau
|
||||
|
||||
- **DROP** – Permet aux utilisateurs de supprimer des bases de données/tableaux entiers
|
||||
- **GRANT OPTION** – Permet d'accorder ou de supprimer les privilèges des autres utilisateurs
|
||||
|
||||
|
||||
|
||||
#### Liste des commandes:
|
||||
|
||||
```
|
||||
GRANT
|
||||
SELECT, INSERT, DROP, UPDATE, DELETE, CREATE, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, BINLOG MONITOR, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY, SET USER, FEDERATED ADMIN, CONNECTION ADMIN, READ_ONLY ADMIN, REPLICATION SLAVE ADMIN, REPLICATION MASTER ADMIN, BINLOG ADMIN, BINLOG REPLAY, SLAVE MONITOR
|
||||
ON *.* TO
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Voir les droits de l'utilisateur courant:
|
||||
|
||||
```mysql
|
||||
MariaDB [(none)]> SHOW GRANTS;
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| Grants for root@localhost |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED VIA mysql_native_password USING '*1111111111111111111111111111111111' OR unix_socket WITH GRANT OPTION |
|
||||
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Voir les droits d'un utilisateur 'mysqlbackupuser' sur un host:
|
||||
|
||||
```mysql
|
||||
MariaDB [(none)]> SHOW GRANTS FOR 'mysqlbackupuser'@'localhost';
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| Grants for mysqlbackupuser@localhost |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| GRANT SELECT, LOCK TABLES ON *.* TO `mysqlbackupuser`@`localhost` IDENTIFIED BY PASSWORD '*22222222222222222222222222222222222222222' |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
1 row in set (0.000 sec)
|
||||
```
|
||||
|
||||
Si le host n'est pas précisé, il s'agit de **'%'**
|
||||
|
||||
```mysql
|
||||
MariaDB [(none)]> SHOW GRANTS FOR 'mysqlbackupuser';
|
||||
ERROR 1141 (42000): There is no such grant defined for user 'mysqlbackupuser' on host '%'
|
||||
```
|
||||
|
||||
Les droits peuvent être différents d'une base à l'autre:
|
||||
|
||||
```mysql
|
||||
MariaDB [(none)]> SHOW GRANTS FOR 'the_user'@'localhost';
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| Grants for the_user@localhost |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, BINLOG MONITOR, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY, SET USER, FEDERATED ADMIN, CONNECTION ADMIN, READ_ONLY ADMIN, REPLICATION SLAVE ADMIN, REPLICATION MASTER ADMIN, BINLOG ADMIN, BINLOG REPLAY, SLAVE MONITOR ON *.* TO `the_user`@`localhost` IDENTIFIED BY PASSWORD '*201716EF6717C367868F777B9C6E17796F19F379' |
|
||||
|
|
||||
| GRANT ALL PRIVILEGES ON `bdd`.* TO `the_user`@`localhost` |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Donner tous les droits à l'utilisateur:
|
||||
|
||||
-sur une base:
|
||||
|
||||
```mariadb
|
||||
MariaDB [(none)]> GRANT ALL PRIVILEGES ON mydatabase.* TO the_user@localhost;
|
||||
Query OK, 0 rows affected (0.029 sec)
|
||||
```
|
||||
|
||||
-sur le tout le serveur:
|
||||
|
||||
```mariadb
|
||||
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO the_user@localhost;
|
||||
Query OK, 0 rows affected (0.025 sec)
|
||||
```
|
||||
|
||||
Pour que les changements prennent effets:
|
||||
|
||||
```mysql
|
||||
MariaDB [(none)]> FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Révocation de privilèges:
|
||||
|
||||
`mysql> REVOKE ALL PRIVILEGES;`
|
||||
|
||||
```mariadb
|
||||
MariaDB [(none)]> REVOKE ALL PRIVILEGES ON *.* FROM the_user@localhost;
|
||||
Query OK, 0 rows affected (0.023 sec)
|
||||
```
|
||||
|
||||
`mysql> REVOKE <PRIVILEGES>;`
|
||||
|
||||
```mariadb
|
||||
MariaDB [(none)]> SHOW GRANTS FOR 'the_user'@'localhost';
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| Grants for the_user@localhost |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| GRANT ALL PRIVILEGES ON *.* TO `the_user`@`localhost` IDENTIFIED BY PASSWORD '*201716EF6717C367868F777B9C6E17796F19F379' |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
|
||||
```
|
||||
|
||||
On supprime les privilèges DROP et SHUTDOWN:
|
||||
|
||||
```mariadb
|
||||
MariaDB [(none)]> REVOKE DROP, SHUTDOWN ON *.* FROM the_user@localhost;
|
||||
Query OK, 0 rows affected (0.022 sec)
|
||||
```
|
||||
|
||||
```mariadb
|
||||
MariaDB [(none)]> SHOW GRANTS FOR 'the_user'@'localhost';
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| Grants for the_user@localhost |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, RELOAD, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, BINLOG MONITOR, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY, SET USER, FEDERATED ADMIN, CONNECTION ADMIN, READ_ONLY ADMIN, REPLICATION SLAVE ADMIN, REPLICATION MASTER ADMIN, BINLOG ADMIN, BINLOG REPLAY, SLAVE MONITOR ON *.* TO `the_user`@`localhost` IDENTIFIED BY PASSWORD '*201716EF6717C367868F777B9C6E17796F19F379' |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
|
||||
```
|
||||
|
||||
179
docs/MySQL/repair.md
Normal file
@@ -0,0 +1,179 @@
|
||||
# Réparer des tables :
|
||||
|
||||
[MySQL Server logs](https://dev.mysql.com/doc/refman/5.7/en/server-logs.html)
|
||||
|
||||
La 1ere chose à faire en cas de problèmes est de consulter les fichiers logs. Ceux-çi sont généralement avec les tables:
|
||||
|
||||
```bash
|
||||
#osx (Homebrew):
|
||||
|
||||
$ cd /usr/local/var/mysql
|
||||
total 388560
|
||||
drwxr-xr-x 32 bruno admin 1024 28 nov 16:53 .
|
||||
drwxrwxr-x 13 bruno admin 416 16 fév 2018 ..
|
||||
-rw-rw---- 1 bruno admin 16384 28 nov 08:08 aria_log.00000001
|
||||
-rw-rw---- 1 bruno admin 52 28 nov 08:08 aria_log_control
|
||||
drwx------ 48 bruno admin 1536 1 déc 17:05 funnymac
|
||||
drwx------ 53 bruno admin 1696 1 déc 17:05 ghost_prod
|
||||
-rw-r----- 1 bruno admin 15114 28 nov 08:08 ib_buffer_pool
|
||||
-rw-rw---- 1 bruno admin 50331648 3 déc 07:19 ib_logfile0
|
||||
-rw-rw---- 1 bruno admin 50331648 24 oct 12:51 ib_logfile1
|
||||
-rw-rw---- 1 bruno admin 79691776 3 déc 07:19 ibdata1
|
||||
-rw-rw---- 1 bruno admin 12582912 28 nov 16:53 ibtmp1
|
||||
drwx------ 9 bruno admin 288 1 déc 17:05 mgpt
|
||||
-rw-rw---- 1 bruno admin 0 24 jul 2017 multi-master.info
|
||||
drwx------ 89 bruno admin 2848 1 déc 17:05 mysql
|
||||
drwx------ 3 bruno admin 96 24 jul 2017 performance_schema
|
||||
drwx------ 41 bruno admin 1312 1 déc 17:05 phpmyadmi
|
||||
-rw-rw---- 1 bruno admin 1271878 3 déc 07:19 silverbook.home.err
|
||||
-rw-rw---- 1 bruno admin 5 28 nov 16:53 silverbook.home.pid
|
||||
```
|
||||
|
||||
|
||||
|
||||
<u>Pour réparer, 2 solutions:</u>
|
||||
|
||||
**1) REPAIR TABLE:**
|
||||
|
||||
- ne nécessite pas l’arrêt de MySQL
|
||||
- uniquement base MyISAM
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
MariaDB [zenphoto]> REPAIR TABLE _tags;
|
||||
+----------------+--------+----------+---------------------------------------------------------+
|
||||
| Table | Op | Msg_type | Msg_text |
|
||||
+----------------+--------+----------+---------------------------------------------------------+
|
||||
| zenphoto._tags | repair | note | The storage engine for the table doesn't support repair |
|
||||
+----------------+--------+----------+---------------------------------------------------------+
|
||||
|
||||
1 row in set (0.006 sec)
|
||||
```
|
||||
|
||||
Si l’erreur persiste, **vider le cache** (Flush all cache)
|
||||
|
||||
|
||||
|
||||
**2) mysqlcheck -r:**
|
||||
|
||||
- nécessite un arrêt du service MySQL
|
||||
|
||||
- uniquement base MyISAM
|
||||
|
||||
|
||||
|
||||
[MyISAM](https://dev.mysql.com/doc/refman/5.5/en/myisam-storage-engine.html):
|
||||
|
||||
```bash
|
||||
$ mysqlcheck -u root -ppassword -r zenphoto .comments
|
||||
|
||||
zenphoto..comments OK
|
||||
```
|
||||
|
||||
|
||||
|
||||
[InnoDB](https://dev.mysql.com/doc/refman/5.5/en/innodb-storage-engine.html):
|
||||
|
||||
```bash
|
||||
$ mysqlcheck -u root -ppassword -r zenphoto _tags
|
||||
|
||||
zenphoto._tags
|
||||
|
||||
note : The storage engine for the table doesn't support repair
|
||||
```
|
||||
|
||||
Pour les tables InnoDB, il faut [forcer la récupération](https://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html):
|
||||
|
||||
1) Arrêter **mysqld**:
|
||||
|
||||
2) Sauvegarder **mysql**:
|
||||
|
||||
```bash
|
||||
#Linux
|
||||
/var/lib/mysql/
|
||||
|
||||
#osx (Homebrew)
|
||||
/usr/local/var/mysql/
|
||||
```
|
||||
|
||||
3) Ajouter au fichier de configuration MySQL my.cnf:
|
||||
|
||||
```ini
|
||||
#osx (Homebrew): /usr/local/etc/my.cnf
|
||||
|
||||
[mysqld]
|
||||
innodb_force_recovery = 4
|
||||
```
|
||||
|
||||
4) Redémarrer **mysqld**:
|
||||
|
||||
5a) Faire un dump des tables de la base avec **SELECT ... INTO OUTFILE**:
|
||||
|
||||
```mysql
|
||||
MariaDB [zenphoto]> SELECT * FROM _tags INTO OUTFILE '/tmp/corrupted.txt';
|
||||
Query OK, 170 rows affected (0.011 sec)
|
||||
|
||||
# Pour exporter au format csv:
|
||||
MariaDB [zenphoto]> SELECT * FROM _tags INTO OUTFILE '/tmp/corrupted.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
|
||||
Query OK, 170 rows affected (0.006 sec)
|
||||
|
||||
```
|
||||
|
||||
5b) Faire. un dump de toutes les tables:
|
||||
|
||||
```bash
|
||||
$ mysqldump -A -u root -ppassword > '/tmp/dump.sql';
|
||||
```
|
||||
|
||||
6) Parfois cela peut suffire. Sinon,
|
||||
|
||||
7) Supprimer les tables / bases corrompues (DROP ...)
|
||||
|
||||
8) Arrêter **mysqld**:
|
||||
|
||||
9) Supprimer les ib*:
|
||||
|
||||
```bash
|
||||
#Linux
|
||||
/var/lib/mysql/ib*
|
||||
|
||||
#osx (Homebrew)
|
||||
/usr/local/var/mysql/ib*
|
||||
```
|
||||
|
||||
10) Quitter le mode force recovery:
|
||||
|
||||
```
|
||||
[mysqld]
|
||||
#innodb_force_recovery = 0
|
||||
```
|
||||
|
||||
11) Redémarrer **mysqld**:
|
||||
|
||||
12) Restaurer les bases:
|
||||
|
||||
```bash
|
||||
$ mysql -u root -ppassword < dump.sql
|
||||
```
|
||||
|
||||
|
||||
|
||||
https://www.nixpal.com/mysql-innodb-corruption-repair-guide/
|
||||
|
||||
|
||||
|
||||
### Vérifier et réparer:
|
||||
|
||||
Vérifier toutes les bases et réparer les tables corrompues:
|
||||
|
||||
```bash
|
||||
$ mysqlcheck -u root -p -A --auto-repair
|
||||
|
||||
Enter password:
|
||||
|
||||
funnymac.download OK
|
||||
funnymac.downloads OK
|
||||
…/…
|
||||
```
|
||||
|
||||
320
docs/MySQL/select.md
Normal file
@@ -0,0 +1,320 @@
|
||||
# select
|
||||
|
||||
|
||||
|
||||
La commande SELECT est utilisée pour récupérer des informations à partir d'une table.
|
||||
|
||||
La forme usuelle est : `SELECT colonne FROM table WHERE condition;`
|
||||
|
||||
|
||||
|
||||
#### Sélectionner toutes les colonnes d'une table:
|
||||
|
||||
`SELECT * FROM table;`
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT * FROM animal;
|
||||
+----------+--------+---------+------+------------+------------+
|
||||
| nom | maitre | espece | sexe | naissance | mort |
|
||||
+----------+--------+---------+------+------------+------------+
|
||||
| Puffball | Diane | hamster | f | 1999-03-30 | NULL |
|
||||
| Slim | Benny | serpent | f | 1996-03-30 | NULL |
|
||||
| Chirpy | Gwen | oiseau | m | 1996-03-10 | NULL |
|
||||
| Fluffy | Harold | chat | m | 1984-11-10 | NULL |
|
||||
| Bowser | Diane | chien | m | 1998-08-31 | 1995-07-29 |
|
||||
+----------+--------+---------+------+------------+------------+
|
||||
5 rows in set (0.001 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Sélectionner certaines colonnes d'une table:
|
||||
|
||||
`SELECT col1, col4 FROM table;`
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT nom,sexe FROM animal;
|
||||
+----------+------+
|
||||
| nom | sexe |
|
||||
+----------+------+
|
||||
| Puffball | f |
|
||||
| Slim | f |
|
||||
| Chirpy | m |
|
||||
| Fluffy | m |
|
||||
| Bowser | m |
|
||||
+----------+------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Sélectionner certaines lignes:
|
||||
|
||||
`SELECT col1, col4 FROM table WHERE col5="x";`
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT nom,sexe FROM animal WHERE sexe="m";
|
||||
+--------+------+
|
||||
| nom | sexe |
|
||||
+--------+------+
|
||||
| Chirpy | m |
|
||||
| Fluffy | m |
|
||||
| Bowser | m |
|
||||
+--------+------+
|
||||
```
|
||||
|
||||
Conditions WHERE:
|
||||
|
||||
- **=** : `WHERE sexe ="m"`
|
||||
- **>=** ; **>** : `WHERE naissance >= "1998-1-1"`
|
||||
- **<=** ; **<** : `WHERE naissance < "2000-1-1"`
|
||||
- **AND** : `WHERE naissance >= "1998-1-1" AND naissance < "2000-1-1"`
|
||||
- **OR** : `WHERE naissance >= "2000-1-1" OR naissance < "1998-1-1"`
|
||||
-
|
||||
|
||||
|
||||
|
||||
#### Afficher un résultat unique:
|
||||
|
||||
`SELECT DISTINCT col1 FROM table;`
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT DISTINCT sexe FROM animal;
|
||||
+------+
|
||||
| sexe |
|
||||
+------+
|
||||
| f |
|
||||
| m |
|
||||
+------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Trier les résultats:
|
||||
|
||||
`SELECT col1, col2 FROM table ORDER BY col2;`
|
||||
|
||||
`SELECT col1, col2 FROM table ORDER BY col2 DESC;`
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT nom, naissance FROM animal ORDER BY naissance DESC;
|
||||
+----------+------------+
|
||||
| nom | naissance |
|
||||
+----------+------------+
|
||||
| Puffball | 1999-03-30 |
|
||||
| Slim | 1996-03-30 |
|
||||
| Chirpy | 1996-03-10 |
|
||||
| Bowser | 1989-08-31 |
|
||||
| Fluffy | 1984-11-10 |
|
||||
+----------+------------+
|
||||
|
||||
```
|
||||
|
||||
!!! Tri sur plusieurs colonnes
|
||||
|
||||
|
||||
|
||||
#### Calcul sur les dates:
|
||||
|
||||
Alias: `AS`
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT nom, naissance, CURRENT_DATE,(YEAR(CURRENT_DATE)-YEAR(naissance)) - (RIGHT(CURRENT_DATE,5)<RIGHT(naissance,5)) AS age FROM animal ORDER BY nom;
|
||||
+----------+------------+--------------+------+
|
||||
| nom | naissance | CURRENT_DATE | age |
|
||||
+----------+------------+--------------+------+
|
||||
| Bowser | 1989-08-31 | 2021-09-04 | 32 |
|
||||
| Chirpy | 1996-03-10 | 2021-09-04 | 25 |
|
||||
| Fluffy | 1984-11-10 | 2021-09-04 | 36 |
|
||||
| Puffball | 1999-03-30 | 2021-09-04 | 22 |
|
||||
| Slim | 1996-03-30 | 2021-09-04 | 25 |
|
||||
+----------+------------+--------------+------+
|
||||
```
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT nom, naissance, MONTH(naissance) AS 'mois de naissance' FROM animal;
|
||||
+----------+------------+-------------------+
|
||||
| nom | naissance | mois de naissance |
|
||||
+----------+------------+-------------------+
|
||||
| Puffball | 1999-03-30 | 3 |
|
||||
| Slim | 1996-03-30 | 3 |
|
||||
| Chirpy | 1996-03-10 | 3 |
|
||||
| Fluffy | 1984-11-10 | 11 |
|
||||
| Bowser | 1989-08-31 | 8 |
|
||||
+----------+------------+-------------------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Valeur NULL:
|
||||
|
||||
Conceptuellement, NULL représente une valeur qui manque, ou une valeur inconnue. Utilisez les opérateurs IS NULL et IS NOT NULL.
|
||||
|
||||
Avec MySQL, 0 et NULL représentent le booléen faux, et tout le reste représente le booléen vrai. La valeur par défaut du booléen vrai issue d'une comparaison est 1.
|
||||
|
||||
Lorsque vous utilisez la clause ORDER BY, les valeurs NULL sont toujours triées en premier, même si vous utilisez l'attribut DESC.
|
||||
|
||||
Chercher les animaux morts:
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT nom, naissance, mort FROM animal WHERE mort IS NOT NULL;
|
||||
+--------+------------+------------+
|
||||
| nom | naissance | mort |
|
||||
+--------+------------+------------+
|
||||
| Bowser | 1989-08-31 | 1995-07-29 |
|
||||
+--------+------------+------------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Recherche de modèles:
|
||||
|
||||
`LIKE '_a'`: _ remplace n'importe quel caractère
|
||||
|
||||
`LIKE '___'`: trouve les noms de 3 caractères
|
||||
|
||||
`LIKE '%y'`: se termine par 'y'
|
||||
|
||||
`LIKE 'f%'`: commence par 'f'
|
||||
|
||||
`LIKE '%b%'`: contenant un 'b'
|
||||
|
||||
`NOT LIKE '%y'`: ne se termine pas par 'y'
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT * FROM animal WHERE nom LIKE "%y";
|
||||
+--------+--------+--------+------+------------+------+
|
||||
| nom | maitre | espece | sexe | naissance | mort |
|
||||
+--------+--------+--------+------+------------+------+
|
||||
| Chirpy | Gwen | oiseau | m | 1996-03-10 | NULL |
|
||||
| Fluffy | Harold | chat | m | 1984-11-10 | NULL |
|
||||
+--------+--------+--------+------+------------+------+
|
||||
```
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT * FROM animal WHERE nom LIKE "f%";
|
||||
+--------+--------+--------+------+------------+------+
|
||||
| nom | maitre | espece | sexe | naissance | mort |
|
||||
+--------+--------+--------+------+------------+------+
|
||||
| Fluffy | Harold | chat | m | 1984-11-10 | NULL |
|
||||
+--------+--------+--------+------+------------+------+
|
||||
```
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT * FROM animal WHERE nom LIKE "%b%";
|
||||
+----------+--------+---------+------+------------+------------+
|
||||
| nom | maitre | espece | sexe | naissance | mort |
|
||||
+----------+--------+---------+------+------------+------------+
|
||||
| Puffball | Diane | hamster | f | 1999-03-30 | NULL |
|
||||
| Bowser | Diane | chien | m | 1989-08-31 | 1995-07-29 |
|
||||
+----------+--------+---------+------+------------+------------+
|
||||
```
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT * FROM animal WHERE nom LIKE "______";
|
||||
+--------+--------+--------+------+------------+------------+
|
||||
| nom | maitre | espece | sexe | naissance | mort |
|
||||
+--------+--------+--------+------+------------+------------+
|
||||
| Chirpy | Gwen | oiseau | m | 1996-03-10 | NULL |
|
||||
| Fluffy | Harold | chat | m | 1984-11-10 | NULL |
|
||||
| Bowser | Diane | chien | m | 1989-08-31 | 1995-07-29 |
|
||||
+--------+--------+--------+------+------------+------------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Regex:
|
||||
|
||||
`REGEXP`
|
||||
|
||||
`NOT REGEXP`
|
||||
|
||||
Quelques caractéristiques des expressions régulières étendues sont :
|
||||
|
||||
- Le caractère ‘.’ trouve n'importe quel caractère.
|
||||
- Une classe de caractères ‘[...]’ trouve n'importe quel caractère contenu entre les crochets. Par exemple, la classe de caractères ‘[abc]’ trouve le caractère ‘a’, ‘b’, ou ‘c’. Pour définir un intervalle de caractères, utilisez un trait d'union. La classe de caractères ‘[a-z]’ trouvera n'importe quel caractère minuscule, tout comme la classe ‘[0-9]’ trouvera n'importe quel nombre.
|
||||
- Le caractère ‘*’ trouvera aucune ou plus d'instances du caractère qui le précède. Par exemple, ‘x*’ trouvera n'importe quel nombre de fois le caractère ‘x’, ‘[0-9]*’ trouvera n'importe quel nombre et ‘.*’ trouvera n'importe quel nombre de fois n'importe quel caractère.
|
||||
- Le modèle est trouvé s'il se produit n'importe où dans la valeur testée. (Les modèles SQL ne sont trouvés que s'ils sont présents en valeur entière.)
|
||||
- Pour ancrer un modèle de sorte qu'il soit trouvé au début ou à la fin de valeur testée, utilisez ‘^’ au début ou bien ‘$’ à la fin du modèle.
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT * FROM animal WHERE nom REGEXP "y$";
|
||||
+--------+--------+--------+------+------------+------+
|
||||
| nom | maitre | espece | sexe | naissance | mort |
|
||||
+--------+--------+--------+------+------------+------+
|
||||
| Chirpy | Gwen | oiseau | m | 1996-03-10 | NULL |
|
||||
| Fluffy | Harold | chat | m | 1984-11-10 | NULL |
|
||||
+--------+--------+--------+------+------------+------+
|
||||
|
||||
```
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT * FROM animal WHERE nom REGEXP "^f";
|
||||
+--------+--------+--------+------+------------+------+
|
||||
| nom | maitre | espece | sexe | naissance | mort |
|
||||
+--------+--------+--------+------+------------+------+
|
||||
| Fluffy | Harold | chat | m | 1984-11-10 | NULL |
|
||||
+--------+--------+--------+------+------------+------+
|
||||
```
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT * FROM animal WHERE nom REGEXP "b";
|
||||
+----------+--------+---------+------+------------+------------+
|
||||
| nom | maitre | espece | sexe | naissance | mort |
|
||||
+----------+--------+---------+------+------------+------------+
|
||||
| Puffball | Diane | hamster | f | 1999-03-30 | NULL |
|
||||
| Bowser | Diane | chien | m | 1989-08-31 | 1995-07-29 |
|
||||
+----------+--------+---------+------+------------+------------+
|
||||
```
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT * FROM animal WHERE nom REGEXP "^......$";
|
||||
+--------+--------+--------+------+------------+------------+
|
||||
| nom | maitre | espece | sexe | naissance | mort |
|
||||
+--------+--------+--------+------+------------+------------+
|
||||
| Chirpy | Gwen | oiseau | m | 1996-03-10 | NULL |
|
||||
| Fluffy | Harold | chat | m | 1984-11-10 | NULL |
|
||||
| Bowser | Diane | chien | m | 1989-08-31 | 1995-07-29 |
|
||||
+--------+--------+--------+------+------------+------------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Compter les lignes:
|
||||
|
||||
`COUNT()`
|
||||
|
||||
La fonction COUNT() compte le nombre de résultats non NULL
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT COUNT(*) FROM animal;
|
||||
+----------+
|
||||
| COUNT(*) |
|
||||
+----------+
|
||||
| 5 |
|
||||
+----------+
|
||||
```
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> SELECT maitre, COUNT(*) FROM animal GROUP BY maitre;
|
||||
+--------+----------+
|
||||
| maitre | COUNT(*) |
|
||||
+--------+----------+
|
||||
| Benny | 1 |
|
||||
| Diane | 2 |
|
||||
| Gwen | 1 |
|
||||
| Harold | 1 |
|
||||
+--------+----------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Modifier une donnée:
|
||||
|
||||
`UPDATE table SET colonne1="x" WHERE colonne2="y";`
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> UPDATE animal SET naissance = "1989-08-31" WHERE nom = "Bowser";
|
||||
Query OK, 1 row affected (0.006 sec)
|
||||
Rows matched: 1 Changed: 1 Warnings: 0
|
||||
```
|
||||
|
||||
173
docs/MySQL/tables.md
Normal file
@@ -0,0 +1,173 @@
|
||||
# Tables:
|
||||
|
||||
|
||||
|
||||
### Voir les tables de la base courante:
|
||||
|
||||
`mysql [database]> SHOW TABLES;`
|
||||
|
||||
```mysql
|
||||
MariaDB [wordpress]> SHOW TABLES;
|
||||
+-----------------------+
|
||||
| Tables_in_wordpress |
|
||||
+-----------------------+
|
||||
| wp_commentmeta |
|
||||
| wp_comments |
|
||||
| wp_links |
|
||||
| wp_options |
|
||||
| wp_postmeta |
|
||||
| wp_posts |
|
||||
| wp_term_relationships |
|
||||
| wp_term_taxonomy |
|
||||
| wp_termmeta |
|
||||
| wp_terms |
|
||||
| wp_usermeta |
|
||||
| wp_users |
|
||||
+-----------------------+
|
||||
12 rows in set (0.003 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Structure d’une table:
|
||||
|
||||
`mysql [database]> DESCRIBE table;`
|
||||
|
||||
```mysql
|
||||
MariaDB [wordpress]> DESCRIBE wp_terms;
|
||||
+------------+---------------------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+------------+---------------------+------+-----+---------+----------------+
|
||||
| term_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
|
||||
| name | varchar(200) | NO | MUL | | |
|
||||
| slug | varchar(200) | NO | MUL | | |
|
||||
| term_group | bigint(10) | NO | | 0 | |
|
||||
+------------+---------------------+------+-----+---------+----------------+
|
||||
4 rows in set (0.006 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Renommer une table:
|
||||
|
||||
`mysql [database]> ALTER TABLE table AS new_table;`
|
||||
|
||||
```mysql
|
||||
MariaDB [zenphoto]> ALTER TABLE _tags RENAME AS _new-tags;
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Créer une table:
|
||||
|
||||
`mysql [database]> CREATE TABLE table;`
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> CREATE TABLE animal (nom VARCHAR(20), maitre VARCHAR(20), espece VARCHAR(20), sexe CHAR(1), naissance DATE, mort DATE);
|
||||
Query OK, 0 rows affected (0.138 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Charger des données dans une table:
|
||||
|
||||
`mysql [database]> INSERT INTO table VALUES ('','');`
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> INSERT INTO animal VALUES ('Puffball','Diane','hamster','f','1999-03-30',NULL);
|
||||
Query OK, 1 row affected (0.012 sec)
|
||||
```
|
||||
|
||||
`mysql [database]> LOAD DATA LOCAL INFILE "file.txt" INTO TABLE table;`
|
||||
|
||||
```mariadb
|
||||
MariaDB [mydatabase]> LOAD DATA LOCAL INFILE "evenements.txt" INTO TABLE evenement;
|
||||
Query OK, 11 rows affected, 3 warnings (0.017 sec)
|
||||
Records: 11 Deleted: 0 Skipped: 0 Warnings: 3
|
||||
```
|
||||
|
||||
Le fichier .txt doit être dans le dossier qui contient les tables:
|
||||
|
||||
```bash
|
||||
/opt/homebrew/var/mysql/mydatabase master 13:26:16
|
||||
❯ ls -la
|
||||
total 208
|
||||
drwx------ 8 bruno admin 256 sep 6 13:26 .
|
||||
drwxr-xr-x 18 bruno admin 576 sep 4 08:00 ..
|
||||
-rw-rw---- 1 bruno admin 741 sep 4 09:17 animal.frm
|
||||
-rw-rw---- 1 bruno admin 98304 sep 4 09:17 animal.ibd
|
||||
-rw-rw---- 1 bruno admin 67 sep 4 08:00 db.opt
|
||||
-rw-rw---- 1 bruno admin 1377 sep 6 11:18 evenement.frm
|
||||
-rw-rw---- 1 bruno admin 98304 sep 6 11:18 evenement.ibd
|
||||
-rw-r--r-- 1 bruno admin 529 sep 6 13:26 evenements.txt
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Vérification des tables :
|
||||
|
||||
<u>2 solutions:</u>
|
||||
|
||||
**1) CHECK TABLE table;**
|
||||
|
||||
```mysql
|
||||
MariaDB [wordpress]> CHECK TABLE wp_terms;
|
||||
+--------------------+-------+----------+----------+
|
||||
| Table | Op | Msg_type | Msg_text |
|
||||
+--------------------+-------+----------+----------+
|
||||
| wordpress.wp_terms | check | status | OK |
|
||||
+--------------------+-------+----------+----------+
|
||||
1 row in set (0.008 sec)
|
||||
```
|
||||
|
||||
|
||||
|
||||
**2) [mysqlcheck](https://mariadb.com/kb/en/library/mysqlcheck/)**
|
||||
|
||||
mysqlcheck verrouille chaque table en lecture seule (la base est alors inaccessible pour les autres processus pendant ce temps) pour vérification ou réparation.
|
||||
|
||||
```bash
|
||||
❯ mysqlcheck -u root -ppassword wordpress
|
||||
wordpress.wp_commentmeta OK
|
||||
wordpress.wp_comments OK
|
||||
wordpress.wp_links OK
|
||||
wordpress.wp_options OK
|
||||
wordpress.wp_postmeta OK
|
||||
wordpress.wp_posts OK
|
||||
wordpress.wp_term_relationships OK
|
||||
wordpress.wp_term_taxonomy OK
|
||||
wordpress.wp_termmeta OK
|
||||
wordpress.wp_terms OK
|
||||
wordpress.wp_usermeta OK
|
||||
wordpress.wp_users OK
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Optimiser:
|
||||
|
||||
Les bases InnoDB ne supportent pas l’option OPTIMIZE.
|
||||
|
||||
A la place,MySQL crée une nouvelle table, y copie toutes les lignes, efface l’ancienne table, renomme la nouvelle et lance ANALYSE
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
❯ mysqlcheck -u root -psncfp1p2 -o --all-databases
|
||||
mysql.column_stats Table is already up to date
|
||||
mysql.columns_priv Table is already up to date
|
||||
mysql.db OK
|
||||
mysql.event Table is already up to date
|
||||
...
|
||||
wordpress.wp_commentmeta
|
||||
note : Table does not support optimize, doing recreate + analyze instead
|
||||
status : OK
|
||||
wordpress.wp_comments
|
||||
note : Table does not support optimize, doing recreate + analyze instead
|
||||
status : OK
|
||||
wordpress.wp_links
|
||||
note : Table does not support optimize, doing recreate + analyze instead
|
||||
status : OK
|
||||
```
|
||||
|
||||