1er commit
De la docs au format Mkdocs
This commit is contained in:
BIN
docs/.DS_Store
vendored
Normal file
BIN
docs/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
docs/Divers/.DS_Store
vendored
Normal file
BIN
docs/Divers/.DS_Store
vendored
Normal file
Binary file not shown.
26
docs/Divers/Chromium.md
Normal file
26
docs/Divers/Chromium.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Chromium
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Chromium** est un navigateur Web, open source et libre, dont une partie a servi de base à l'élaboration du navigateur propriétaire (à code fermé) Google Chrome.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[:fa-link: http://chromium.woolyss.com/?stb=1#mac](http://chromium.woolyss.com/?stb=1#mac)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
La version **No sync • No WebRTC • No Widevine** pour Windows 64bits **protège sévèrement votre vie privée** :
|
||||||
|
|
||||||
|
- Ne comporte pas Sync :
|
||||||
|
- La clé Google API est indéfinie dans cette version, donc :
|
||||||
|
- Les services Google tels que Sync, Hotword, Translate, Now, Hangout ne fonctionnent pas.
|
||||||
|
- Vous ne serez pas en mesure de vous connecter avec votre compte Google et synchroniser vos données.
|
||||||
|
- Enfin seul !
|
||||||
|
|
||||||
|
- Ne comporte pas WebRTC :
|
||||||
|
- Chromium ne sera pas en mesure d'utiliser l'API Real-Time Web Communication.
|
||||||
|
- Cela empêche la divulgation de votre adresse IP (via WebRTC)
|
||||||
|
|
||||||
|
- Ne comporte pas Widevine :
|
||||||
|
- Chromium ne sera pas en mesure de lire des contenus protégés par des DRM (Digital Rights Management - Gestion des droits numériques) (sur le site Netflix, par exemple). Il s'agit d'étroites collaborations entre les composants logiciels de gestion des droits numériques (protections anti-copie, protection anti-lecture, etc. ...) de tout ce qui protégé par des droits de type Copyright et droits d'auteurs, et les composants électroniques du terminal (ordinateur, tablette, smartphone, etc. ...) marqués individuellement, à leur fabrication, par des identifiants uniques infalsifiables (contrairement à un ancien marquage, mais falsifiable : la [MAC adress (Adresse MAC - Media Access Control)](http://assiste.com/MAC_Address.html)).
|
||||||
78
docs/Divers/Vider_cache_DNS.md
Normal file
78
docs/Divers/Vider_cache_DNS.md
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# Vider le cache DNS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Sous Windows XP:
|
||||||
|
|
||||||
|
S'assurer que le client DNS est démarré:
|
||||||
|
|
||||||
|
Démarrer -> Exécuter > services.msc
|
||||||
|
|
||||||
|
1. <u>Etat</u>: **démarré**
|
||||||
|
2. <u>Type de démarrage</u>: **automatique**
|
||||||
|
|
||||||
|
Ouvrir une fenêtre DOS et taper:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ipconfig /flushdns
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Sous Windows 7 (et plus):
|
||||||
|
|
||||||
|
Ouvrir une fenêtre DOS et taper:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ipconfig /flushdns
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Sous OS X 10.12 (Sierra):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache
|
||||||
|
```
|
||||||
|
|
||||||
|
#### SousOS X 10.11 (El Capitan):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#sudo killall -HUP mDNSResponder
|
||||||
|
```
|
||||||
|
|
||||||
|
#### SousOS X 10.10 (Yosemite):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Sous OSX 10.10.1, 10.10.2, 10.10.3:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#sudo discoveryutil udnsflushcaches
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Sous OS X 10.9 (Mavericks):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#dscacheutil -flushcache; sudo killall -HUP mDNSResponder
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Sous OS X 10.7 (Lion) and 10.8 (Mountain Lion):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#sudo killall -HUP mDNSResponder
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Sous OS X 10.5 (Leopard) and 10.6 (Snow Leopard):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#dscacheutil -flushcache
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Sous OS X 10.4 (Tiger):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#lookupd -flushcache
|
||||||
|
```
|
||||||
175
docs/Divers/batch/Commandes_DOS.md
Normal file
175
docs/Divers/batch/Commandes_DOS.md
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
# Commandes DOS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ASSOC Affiche ou modifie les applications associées aux extensions de fichiers.
|
||||||
|
|
||||||
|
ATTRIB Affiche ou modifie les attributs d'un fichier.
|
||||||
|
|
||||||
|
BREAK Active ou désactive le contrôle étendu de CTRL+C.
|
||||||
|
|
||||||
|
BCDEDIT Définit les propriétés dans la base de données de démarrage pour le contrôle du chargement d'amorçage.
|
||||||
|
|
||||||
|
CACLS Affiche ou modifie les listes de contrôles d'accès aux fichiers.
|
||||||
|
|
||||||
|
CALL Appelle un fichier de commandes à partir d'un autre fichier de commandes.
|
||||||
|
|
||||||
|
CD Modifie le répertoire ou affiche le répertoire actif.
|
||||||
|
|
||||||
|
CHCP Modifie ou affiche le numéro de la page de code active.
|
||||||
|
|
||||||
|
CHDIR Modifie le répertoire ou affiche le nom du répertoire actif.
|
||||||
|
|
||||||
|
CHKDSK Vérifie un disque et affiche un rapport d'état.
|
||||||
|
|
||||||
|
CHKNTFS Affiche ou modifie la vérification du disque au démarrage.
|
||||||
|
|
||||||
|
CLS Efface l'écran.
|
||||||
|
|
||||||
|
CMD Exécute une nouvelle instance de l'interpréteur de commandes de Windows.
|
||||||
|
|
||||||
|
COLOR Modifie les couleurs du premier plan et de l'arrière-plan de la console.
|
||||||
|
|
||||||
|
COMP Compare les contenus de deux fichiers ou groupes de fichiers.
|
||||||
|
|
||||||
|
COMPACT Modifie ou affiche la compression des fichiers sur une partition NTFS.
|
||||||
|
|
||||||
|
CONVERT Convertit des volumes FAT en volumes NTFS. Vous ne pouvez pas convertir le lecteur en cours d'utilisation.
|
||||||
|
|
||||||
|
COPY Copie un ou plusieurs fichiers.
|
||||||
|
|
||||||
|
DATE Affiche ou définit la date.
|
||||||
|
|
||||||
|
DEL Supprime un ou plusieurs fichiers.
|
||||||
|
|
||||||
|
DIR Affiche la liste des fichiers et des sous-répertoires d'un répertoire.
|
||||||
|
|
||||||
|
DISKCOMP Compare les contenus de deux disquettes.
|
||||||
|
|
||||||
|
DISKCOPY Copie le contenu d'une disquette sur une autre.
|
||||||
|
|
||||||
|
DISKPART Affiche ou configure les propriétés d'une partition de disque.
|
||||||
|
|
||||||
|
DOSKEY Modifie les lignes de commande, rappelle des commandes Windows, et crée des macros.
|
||||||
|
|
||||||
|
DRIVERQUERY Affiche l'état et les propriétés du pilote de périphérique en cours d'utilisation.
|
||||||
|
|
||||||
|
ECHO Affiche des messages ou active/désactive l'affichage des commandes.
|
||||||
|
|
||||||
|
ENDLOCAL Stoppe la localisation des modifications d'environnement dans un fichier de commandes.
|
||||||
|
|
||||||
|
ERASE Supprime un ou plusieurs fichiers.
|
||||||
|
|
||||||
|
EXIT Quitte l'interpréteur de commandes (CMD.EXE).
|
||||||
|
|
||||||
|
FC Compare deux fichiers ou groupes de fichiers et affiche les différences.
|
||||||
|
|
||||||
|
FIND Recherche une chaîne de caractères dans un ou plusieurs fichiers.
|
||||||
|
|
||||||
|
FINDSTR Cherche des chaînes dans les fichiers.
|
||||||
|
|
||||||
|
FOR Exécute une commande sur chaque fichier d'un ensemble de fichiers.
|
||||||
|
|
||||||
|
FORMAT Formate un disque devant être utilisé avec Windows.
|
||||||
|
|
||||||
|
FSUTIL Affiche ou configure les propriétés du système de fichiers.
|
||||||
|
|
||||||
|
FTYPE Affiche ou modifie les types de fichiers utilisés dans les associations d'extensions.
|
||||||
|
|
||||||
|
GOTO Indique l'exécution d'un fichier de commandes pour une ligne identifiée par une étiquette.
|
||||||
|
|
||||||
|
GPRESULT Affiche les informations de stratégie de groupe pour un ordinateur ou un utilisateur.
|
||||||
|
|
||||||
|
GRAFTABL Permet à Windows d'afficher un jeu de caractères en mode graphique.
|
||||||
|
|
||||||
|
HELP Affiche des informations sur les commandes de Windows.
|
||||||
|
|
||||||
|
ICACLS Afficher, modifier, sauvegarder ou restaurer les listes de contrôle d'accès pour les fichiers et les répertoires.
|
||||||
|
|
||||||
|
IF Effectue un traitement conditionnel dans un fichier de commandes.
|
||||||
|
|
||||||
|
LABEL Crée, modifie ou supprime le nom de volume d'un disque.
|
||||||
|
|
||||||
|
MD Crée un répertoire.
|
||||||
|
|
||||||
|
MKDIR Crée un répertoire.
|
||||||
|
|
||||||
|
MKLINK Créer des liens symboliques et des liens réels
|
||||||
|
|
||||||
|
MODE Configure un périphérique du système.
|
||||||
|
|
||||||
|
MORE Affiche la sortie écran par écran.
|
||||||
|
|
||||||
|
MOVE Déplace un ou plusieurs fichiers d'un répertoire à un autre.
|
||||||
|
|
||||||
|
OPENFILES Affiche les fichiers partagés ouverts à distance par les utilisateurs.
|
||||||
|
|
||||||
|
PATH Affiche ou définit le chemin de recherche des fichiers exécutables.
|
||||||
|
|
||||||
|
PAUSE Interrompt l'exécution d'un fichier de commandes et affiche un message.
|
||||||
|
|
||||||
|
POPD Restaure la valeur précédente du répertoire actif enregistrée par PUSHD.
|
||||||
|
|
||||||
|
PRINT Imprime un fichier texte.
|
||||||
|
|
||||||
|
PROMPT Modifie l'invite de commande de Windows.
|
||||||
|
|
||||||
|
PUSHD Enregistre le répertoire actif puis le modifie.
|
||||||
|
|
||||||
|
RD Supprime un répertoire.
|
||||||
|
|
||||||
|
RECOVER Récupère l'information lisible d'un disque défectueux.
|
||||||
|
|
||||||
|
REM Insère un commentaire dans un fichier de commandes ou CONFIG.SYS.
|
||||||
|
|
||||||
|
REN Renomme un ou plusieurs fichiers.
|
||||||
|
|
||||||
|
RENAME Renomme un ou plusieurs fichiers.
|
||||||
|
|
||||||
|
REPLACE Remplace des fichiers.
|
||||||
|
|
||||||
|
RMDIR Supprime un répertoire.
|
||||||
|
|
||||||
|
ROBOCOPY Utilitaire avancé pour copier les fichiers et les arborescences de répertoires
|
||||||
|
|
||||||
|
SET Affiche, définit ou supprime des variables d'environnement Windows.
|
||||||
|
|
||||||
|
SETLOCAL Commence la localisation des modifications d'environnement dans un fichier de commandes.
|
||||||
|
|
||||||
|
SC Affiche ou configure les services (processus en arrière-plan).
|
||||||
|
|
||||||
|
SCHTASKS Planifie les commandes et les programmes à exécuter sur l'ordinateur.
|
||||||
|
|
||||||
|
SHIFT Modifie la position des paramètres remplaçables dans un fichier de commandes.
|
||||||
|
|
||||||
|
SHUTDOWN Permet un arrêt local ou distant correct de l'ordinateur.
|
||||||
|
|
||||||
|
SORT Trie les entrées.
|
||||||
|
|
||||||
|
START Ouvre une fenêtre séparée pour l'exécution d'un programme ou d'une commande spécifique.
|
||||||
|
|
||||||
|
SUBST Associe un chemin d'accès à une lettre de lecteur.
|
||||||
|
|
||||||
|
SYSTEMINFO Affiche les propriétés et la configuration spécifiques de l'ordinateur.
|
||||||
|
|
||||||
|
TASKLIST Affiche toutes les tâches en cours d'exécution, y compris les services.
|
||||||
|
|
||||||
|
TASKKILL Termine ou interrompt un processus ou une application en cours d'exécution.
|
||||||
|
|
||||||
|
TIME Affiche ou définit l'heure du système.
|
||||||
|
|
||||||
|
TITLE Définit le titre de la fenêtre pour une session CMD.EXE.
|
||||||
|
|
||||||
|
TREE Affiche le graphisme de la structure de répertoire d'un lecteur ou d'un chemin d'accès.
|
||||||
|
|
||||||
|
TYPE Affiche le contenu d'un fichier texte.
|
||||||
|
|
||||||
|
VER Affiche la version de Windows.
|
||||||
|
|
||||||
|
VERIFY Demande à Windows de vérifier si vos fichiers sont correctement écrits sur le disque.
|
||||||
|
|
||||||
|
VOL Affiche le nom et le numéro de série d'un volume de disque.
|
||||||
|
|
||||||
|
XCOPY Copie les fichiers et les arborescences de répertoires.
|
||||||
|
|
||||||
|
WMIC Affiche les informations WMI dans l'interface de commande interactive.
|
||||||
157
docs/Divers/batch/Commandes_DOS_2.md
Normal file
157
docs/Divers/batch/Commandes_DOS_2.md
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
# Commandes DOS (suite)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%WINDIR%\SYSTEM32\RESTORE\RSTRUI.EXE : ouvre l'outil de restauration de système (Pour XP uniquement).
|
||||||
|
ACCESS.CPL : ouvre les options d'accessibilité (Pour XP uniquement)
|
||||||
|
APPWIZ.CPL : ouvre l'outil Ajouter/Supprimer un programme
|
||||||
|
AZMAN.MSC : ouvre le gestionnaire d'autorisations (Pour Vista uniquement)
|
||||||
|
CALC : ouvre la calculatrice
|
||||||
|
CERTMGR.MSC : ouvre les certificats pour l'utilisateur actuel
|
||||||
|
CHARMAP : ouvre la table des caractères
|
||||||
|
CLICONFG : ouvre la configuration des clients SQL
|
||||||
|
CLIPBRD : ouvre le presse papier (Pour XP uniquement
|
||||||
|
CMD : ouvre l'invite de commandes
|
||||||
|
COLLAB.CPL : ouvre le voisinage immédiat (Pour Vista uniquement)
|
||||||
|
COMEXP.MSC ou bien DCOMCNFG : ouvre l'outil services et composants (Pour Vista uniquement)
|
||||||
|
COMPMGMT.MSC : ouvre l'outil de gestion de l'ordinateur
|
||||||
|
COMPUTERDEFAULTS : ouvrir l'outil des programmes par défaut (Pour Vista uniquement)
|
||||||
|
CONTROL /NAME MICROSOFT.BACKUPANDRESTORECENTER : ouvre le centre de sauvegarde et de restauration (Pour Vista uniquement). Tutoriel ICI
|
||||||
|
CONTROL : ouvre le panneau de configuration
|
||||||
|
CONTROL ADMINTOOLS : ouvre les outils d'administrations
|
||||||
|
CONTROL COLOR : ouvre les paramètres de l'apparence
|
||||||
|
CONTROL FOLDERS : ouvre les options de dossiers
|
||||||
|
CONTROL FONTS : ouvre le gestionnaire de polices
|
||||||
|
CONTROL INTERNATIONAL ou bien INTL.CPL : ouvre les options régionales et linguistiques
|
||||||
|
CONTROL KEYBOARD : ouvre les propriétés du clavier
|
||||||
|
CONTROL MOUSE ou bien MAIN.CPL : ouvre les propriétés de la souris
|
||||||
|
CONTROL PRINTERS : ouvre les imprimantes et les fax disponibles
|
||||||
|
CONTROL USERPASSWORDS : ouvre l'éditeur des comptes utilisateurs
|
||||||
|
CONTROL USERPASSWORDS2 ou bien NETPLWIZ : contrôle les utilisateurs et leurs accès
|
||||||
|
CREDWIZ : ouvre l'outil de sauvegarde et restauration des mots de passe des utilisateurs (Pour Vista uniquement)
|
||||||
|
DESK.CPL : ouvre les paramètres d'affichage
|
||||||
|
DEVMGMT.MSC : ouvre les gestionnaire de périphériques. Tutoriel ICI
|
||||||
|
DIALER : ouvre le numérateur téléphonique de Windows
|
||||||
|
DRWTSN32 : ouvre Dr. Watson (Pour XP uniquement)
|
||||||
|
DVDPLAY : ouvre votre lecteur DVD
|
||||||
|
DXDIAG : ouvre l'outil de diagnostic DirectX
|
||||||
|
EUDCEDIT : ouvre l'éditeur de caractères privés
|
||||||
|
EVENTVWR ou bien EVENTVWR.MSC : ouvre l'observateur d'évènements
|
||||||
|
EXPLORER : ouvre l'explorateur Windows
|
||||||
|
FSMGMT.MSC : ouvre les dossiers partagés
|
||||||
|
FSQUIRT : Assistant transfert Bluetooth
|
||||||
|
GPEDIT.MSC : ouvre l'éditeur des stratégies de groupe (Pour les éditions professionnelles et plus de Windows)
|
||||||
|
HDWWIZ.CPL : ouvre l'assistant ajout de matériels
|
||||||
|
IEXPLORE : ouvre Internet Explorer
|
||||||
|
IEXPRESS : ouvre l'assistant de création des archives auto-extractibles.
|
||||||
|
INFOCARDCPL.CPL : ouvre l'assistant compatibilité des programmes
|
||||||
|
IRPROPS.CPL : ouvre le gestionnaire d'infrarouge
|
||||||
|
ISCSICPL : ouvre l'outil de configuration de l'initiateur ISCI Microsoft (Pour Vista uniquement)
|
||||||
|
JOURNAL : ouvre un nouveau journal (Pour Vista uniquement)
|
||||||
|
JOY.CPL : ouvre l'outil de contrôleur de jeu
|
||||||
|
LPKSETUP : ouvre l'assistant d'installation et désinstallation des langues d'affichage (Pour Vista uniquement)
|
||||||
|
LUSRMGR.MSC : ouvre l'éditeur des utilisateurs et groupes locaux
|
||||||
|
MAGNIFY : ouvre la loupe
|
||||||
|
MBLCTR : ouvre le centre de mobilité de Windows (Pour Vista uniquement)
|
||||||
|
MDSCHED : ouvre l'outil de diagnostics de la mémoire Windows (Pour Vista uniquement)
|
||||||
|
MIGWIZ : ouvre l'outil de transfert de fichiers et de paramètres Windows (Pour Vista uniquement)
|
||||||
|
MIGWIZ.EXE : ouvre l'outil de transfert de fichiers et de paramètres Windows (pour XP uniquement)
|
||||||
|
MMC : ouvre une nouvelle console vide
|
||||||
|
MMSYS.CPL : ouvre les paramètres de sons
|
||||||
|
MOBSYNC : ouvre le centre de synchronisation
|
||||||
|
MOVIEMK : ouvre Windows Movie Maker
|
||||||
|
MRT : lance l'utilitaire de suppression de logiciel malveillant.
|
||||||
|
MSCONFIG : ouvre l'outil de configuration du système
|
||||||
|
MSDT : ouvre l'outil de diagnostics et support Microsoft
|
||||||
|
MSINFO32 : ouvre les informations système
|
||||||
|
MSPAINT : ouvre Paint
|
||||||
|
MSRA : ouvre l'assistance à distance Windows
|
||||||
|
MSTSC : ouvre l'outil de connexion du bureau a distance
|
||||||
|
NAPCLCFG.MSC : ouvre l'outil de configuration du client NAP (Pour Vista uniquement)
|
||||||
|
NOTEPAD : ouvre le bloc-notes
|
||||||
|
NTMSMGR.MSC : ouvre le gestionnaire des supports de stockage amovibles
|
||||||
|
NTMSOPRQ.MSC : ouvre les demandes de l'opérateur de stockage amovible
|
||||||
|
ODBCAD32 : ouvre l'administrateur de sources de données ODBC
|
||||||
|
OPTIONALFEATURES : ouvre l'outil Ajouter/Supprimer des composants Windows (Pour Vista uniquement)
|
||||||
|
OSK : ouvre le clavier visuel.
|
||||||
|
PERFMON ou bien PERFMON.MSC : ouvre le moniteur de fiabilité et de performances Windows.
|
||||||
|
POWERCFG.CPL : ouvre le gestionnaire des modes d'alimentation (Pour Vista uniquement)
|
||||||
|
PRINTBRMUI : ouvre l'assistant de migration d'imprimante (Vista uniquement)
|
||||||
|
REGEDIT ou bien REGEDT32 (Pour Vista uniquement) : ouvre l'éditeur de registre
|
||||||
|
REKEYWIZ : ouvre le gestionnaire des certificats de chiffrement de fichiers (Pour Vista uniquement)
|
||||||
|
RSOP.MSC : ouvre le jeu de stratégie résultant
|
||||||
|
RSTRUI : ouvre l'outil de restauration du système (Pour Vista uniquement)
|
||||||
|
SECPOL.MSC : ouvre les paramètres de sécurités locales
|
||||||
|
SERVICES.MSC : ouvre le gestionnaire de services
|
||||||
|
SIDEBAR : ouvre le volet Windows (Pour Vista uniquement)
|
||||||
|
SIGVERIF : ouvre l'outil de vérification des signatures de fichiers
|
||||||
|
SLUI : ouvre l'assistant d'activation de Windows (Pour Vista uniquement)
|
||||||
|
SNDVOL : ouvre le mélangeur de volume
|
||||||
|
SNIPPINGTOOL : ouvre l'outil capture d'écran (Pour Vista uniquement).
|
||||||
|
SOUNDRECORDER : ouvre le magnétophone
|
||||||
|
STIKYNOT : ouvre le pense-bête (Pour Vista uniquement)
|
||||||
|
SYSDM.CPL : ouvre les propriétés système
|
||||||
|
SYSEDIT : ouvre l'éditeur de configuration système (Attention, à manipuler avec prudence)
|
||||||
|
SYSKEY : ouvre l'utilitaire de protection de la base de données des comptes Windows (Attention, à manipuler avec extrême prudence !)
|
||||||
|
SYSPREP: ouvre le dossier contenant l'outil de préparation du système (Pour Vista uniquement)
|
||||||
|
TABLETPC.CPL : ouvre les paramètres pour Tablet pc (Pour Vista uniquement)
|
||||||
|
TABTIP : ouvre le panneau de saisie Tablet PC (Pour Vista uniquement)
|
||||||
|
TASKMGR : ouvre le gestionnaire des tâches Windows
|
||||||
|
TASKSCHD.MSC ou bien CONTROL SCHEDTASKS : ouvre le planificateur de tâches (Pour Vista uniquement)
|
||||||
|
TELEPHON.CPL : ouvre l'outil de connexion téléphonique
|
||||||
|
TIMEDATE.CPL : ouvre les paramètres de l'heure et de la date
|
||||||
|
TPM.MSC : ouvre l'outil gestion de module de plateforme sécurisée sur l'ordinateur local (Pour Vista uniquement)
|
||||||
|
UTILMAN : ouvre les options d'ergonomie (Pour Vista uniquement)
|
||||||
|
VERIFIER : ouvre le gestionnaire de vérification des pilotes
|
||||||
|
WAB : ouvre les contacts (Pour Vista uniquement)
|
||||||
|
WERCON : ouvre l'outil de rapports et de solutions aux problèmes (Pour Vista uniquement)
|
||||||
|
WINCAL : ouvre le calendrier Windows (Pour Vista uniquement)
|
||||||
|
WINCHAT : ouvre le logiciel Microsoft de chat en réseau (Pour Windows XP uniquement)
|
||||||
|
WINDOWSANYTIMEUPGRADE : permet la mise à niveau de Windows Vista
|
||||||
|
WINVER : ouvre la fenêtre pour connaître votre version Windows
|
||||||
|
WINWORD: ouvre Word (si il est installé)
|
||||||
|
WMIMGMT.MSC : ouvre Windows Management Infrastructure
|
||||||
|
WMPLAYER : ouvre le lecteur Windows Media
|
||||||
|
WRITE ou bien Wordpad : ouvre Wordpad
|
||||||
|
WSCUI.CPL : ouvre le centre de sécurité Windows
|
||||||
|
WUAUCPL.CPL : ouvre le service de mise à jour Windows (Pour XP uniquement)
|
||||||
|
|
||||||
|
Gestion des disques
|
||||||
|
CHKDSK : effectue une analyse de la partition précisée dans les paramètres de la commande (Pour plus d'informations, tapez CHKDSK /? dans l'invite de commande CMD)
|
||||||
|
CLEANMGR : ouvre l'outil de nettoyage de disque
|
||||||
|
DEFRAG: Défragmente le disque dur
|
||||||
|
DFRG.MSC : ouvre l'outil de défragmentation de disque
|
||||||
|
DISKMGMT.MSC : ouvre le gestionnaire de disques
|
||||||
|
DISKPART : ouvre l'outil de partitionnement
|
||||||
|
|
||||||
|
Gestion des réseaux et Internet
|
||||||
|
CONTROL NETCONNECTIONS ou bien NCPA.CPL : ouvre les connexions réseau
|
||||||
|
FIREWALL.CPL : ouvre le pare-feu Windows
|
||||||
|
INETCPL.CPL : ouvre les propriétés internet
|
||||||
|
IPCONFIG : affiche les configurations des adresses IP sur l'ordinateur (Pour plus d'informations, tapez IPCONFIG /? dans l'invite de commande CMD)
|
||||||
|
NETSETUP.CPL : ouvre l'assistant configuration réseau (Pour XP uniquement)
|
||||||
|
WF.MSC : ouvre les fonctions avancées du pare-feu Windows (Pour Vista uniquement).
|
||||||
|
|
||||||
|
Autres commandes
|
||||||
|
%HOMEDRIVE% : ouvre l'explorateur sur la partition ou le système d'exploitation est installé
|
||||||
|
%HOMEPATH% : ouvre le dossier d'utilisateur connecté actuellement C:\Documents and settings\[nom d'utilisateur]
|
||||||
|
%PROGRAMFILES% : ouvre le dossier d'installation d'autres programmes (Program Files)
|
||||||
|
%TEMP% ou bien %TMP% : ouvre le dossier temporaire
|
||||||
|
%USERPROFILE% : ouvre le dossier du profil de l'utilisateur connecté actuellement
|
||||||
|
%WINDIR% ou bien %SYSTEMROOT% : ouvre le dossier d'installation de Windows
|
||||||
|
%WINDIR%\system32\rundll32.exe shell32.dll,Control_RunDLL hotplug.dll : affiche la fenêtre "Supprimer le périphérique en toute sécurité"
|
||||||
|
AC3FILTER.CPL : ouvre les propriétés du filtre AC3 (Si installé)
|
||||||
|
FIREFOX : lance Mozilla FireFox (Si installé)
|
||||||
|
JAVAWS : Visualise le cache du logiciel JAVA (Si installé)
|
||||||
|
LOGOFF : ferme la session actuelle
|
||||||
|
NETPROJ : autorise ou pas la connexion à un projecteur réseau (Pour Vista uniquement)
|
||||||
|
Vérificateur des fichiers système (Nécessite un CD de Windows si le cache n'est pas disponible): (Tutoriel ICI)
|
||||||
|
SFC /SCANNOW : scanne immédiatement tous les fichiers système et répare les fichiers endommagés
|
||||||
|
SFC /VERIFYONLY : scanne seulement les fichiers système
|
||||||
|
SFC /SCANFILE="nom et chemin de fichier" : scanne le fichier précisé, et le répare s'il est endommagé
|
||||||
|
SFC /VERIFYFILE="nom et chemin de fichier" : scanne seulement le fichier précisé
|
||||||
|
SFC /SCANONCE : scanne les fichiers système au prochain redémarrage
|
||||||
|
SFC /REVERT : remet la configuration initiale (Pour plus d'informations, tapez SFC /? dans l'invite de commande CMD.
|
||||||
|
SHUTDOWN : éteint Windows
|
||||||
|
SHUTDOWN -A : interrompe l'arrêt de Windows
|
||||||
|
VSP1CLN : supprime le cache d'installation du service pack 1 de Vista
|
||||||
249
docs/Divers/git/git-session.md
Normal file
249
docs/Divers/git/git-session.md
Normal file
@@ -0,0 +1,249 @@
|
|||||||
|
# Session de travail avec GIT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
I. On développe dans la branche **master**.
|
||||||
|
|
||||||
|
=> <u>HEAD pointe sur la branche **master**</u>
|
||||||
|
|
||||||
|
Penser à valider la copie de travail avant de changer de branche.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git commit -a -m 'validation'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
II. On bascule dans la branche prob53 que l'on crée en même temps.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git checkout -b prob53
|
||||||
|
Switched to a new branch "prob53"
|
||||||
|
```
|
||||||
|
|
||||||
|
=> <u>HEAD pointe sur la branche **prob53**</u>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
III. On réalise une modification ...
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ vim index.html
|
||||||
|
$ git commit -a -m 'ajout d'un pied de page [problème 53]'
|
||||||
|
```
|
||||||
|
|
||||||
|
… avant de retourner dans la branche **master**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git checkout master
|
||||||
|
Switched to branch "master"
|
||||||
|
```
|
||||||
|
|
||||||
|
=> <u>HEAD pointe sur la branche **master**</u>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IV. On a un correctif à réaliser. On crée donc une nouvelle branche **correctif**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git checkout -b 'correctif'
|
||||||
|
Switched to a new branch "correctif"
|
||||||
|
```
|
||||||
|
|
||||||
|
On réalise le correctif:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ vim index.html
|
||||||
|
$ git commit -a -m "correction d'une adresse mail incorrecte"
|
||||||
|
[correctif]: created 3a0874c: "correction d'une adresse mail incorrecte"
|
||||||
|
1 files changed, 0 insertions(+), 1 deletions(-)
|
||||||
|
```
|
||||||
|
|
||||||
|
=> <u>HEAD pointe sur la branche **correctif**</u>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
V. On réalise des tests sur le projet pour s'assurer que la correction est efficace.
|
||||||
|
|
||||||
|
Si tout est ok, il est temps de la fusionner dans la branche **master** pour la déployer en production:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git checkout master
|
||||||
|
$ git merge correctif
|
||||||
|
Updating f42c576..3a0874c
|
||||||
|
Fast forward
|
||||||
|
LISEZMOI | 1 -
|
||||||
|
1 files changed, 0 insertions(+), 1 deletions(-)
|
||||||
|
```
|
||||||
|
|
||||||
|
=> <u>HEAD pointe sur la branche **master**</u>
|
||||||
|
|
||||||
|
*Git a réalisé un Fast forward*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VI. **master** et **correctif** pointent sur le même commit, on peut supprimer la branche **correctif**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git branch -d correctif
|
||||||
|
Deleted branch correctif (3a0874c).
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VII. On rebascule sur la branche **prob53** pour continuer à travailler sur le problème:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git checkout prob53
|
||||||
|
Switched to branch "prob53"
|
||||||
|
$ vim index.html
|
||||||
|
$ git commit -a -m 'Nouveau pied de page terminé [problème 53]'
|
||||||
|
[prob53]: created ad82d7a: "Nouveau pied de page terminé [problème 53]"
|
||||||
|
1 files changed, 1 insertions(+), 0 deletions(-)
|
||||||
|
```
|
||||||
|
|
||||||
|
=> <u>HEAD pointe sur la branche prob53</u>
|
||||||
|
|
||||||
|
*Les travaux réalisés dans correctif ne sont pas contenu dans les fichiers de la branche **prob53**.*
|
||||||
|
Si vous avez besoin de les y rapatrier, vous pouvez fusionner la branche master dans la branche **prob53** en lançant la commande `git merge master`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VIII. ... suite du développement ...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IX. Les travaux sur la branche **prob53** sont terminés et prêt à être fusionnés avec **master**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git checkout master
|
||||||
|
$ git merge prob53
|
||||||
|
Merge made by recursive.
|
||||||
|
README | 1 +
|
||||||
|
1 files changed, 1 insertions(+), 0 deletions(-)
|
||||||
|
```
|
||||||
|
|
||||||
|
=> HEAD pointe sur la branche **master**
|
||||||
|
|
||||||
|
*Git a réalisé une simple fusion à trois sources et créer un <u>commit de fusion</u>.*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
X. Le travail a été fusionné, on n'a plus besoin de la branche **prob53**. On peut l'effacer et <u>fermer manuellement le ticket</u> dans l'outil de suivi de faits techniques:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git branch -d prob53
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### APPENDIX:
|
||||||
|
|
||||||
|
#### Conflits:
|
||||||
|
|
||||||
|
Si on modifie différemment la même partie du même fichier dans les deux branches que l'on souhaite fusionner, Git ne sera pas capable de réaliser proprement la fusion.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git merge prob53
|
||||||
|
Auto-merging index.html
|
||||||
|
CONFLICT (content): Merge conflict in index.html
|
||||||
|
Automatic merge failed; fix conflicts and then commit the result.
|
||||||
|
```
|
||||||
|
|
||||||
|
Git n'a pas automatiquement créé le *commit* du fusion.
|
||||||
|
|
||||||
|
Il a arrêté le processus le temps que vous résolviez le conflit. Lancez `git status` pour voir à tout moment après l'apparition du conflit de fusion quels fichiers n'ont pas été fusionnés :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[master*]$ git status
|
||||||
|
index.html: needs merge
|
||||||
|
# On branch master
|
||||||
|
# Changes not staged for commit:
|
||||||
|
# (use "git add <file>..." to update what will be committed)
|
||||||
|
# (use "git checkout -- <file>..." to discard changes in working directory)
|
||||||
|
#
|
||||||
|
# unmerged: index.html
|
||||||
|
#
|
||||||
|
```
|
||||||
|
|
||||||
|
Tout ce qui comporte des conflits de fusion et n'a pas été résolu est listé comme `unmerged`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Git ajoute des marques de conflit standard dans les fichiers qui comportent des conflits:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<<<<<<< HEAD:index.html
|
||||||
|
<div id="footer">contact : email.support@github.com</div>
|
||||||
|
=======
|
||||||
|
<div id="footer">
|
||||||
|
please contact us at support@github.com
|
||||||
|
</div>
|
||||||
|
>>>>>>> prob53:index.html
|
||||||
|
```
|
||||||
|
|
||||||
|
Au-dessus de la ligne ======= : version dans HEAD (master)
|
||||||
|
|
||||||
|
Au-dessous de la ligne ======= : version dans prob53
|
||||||
|
|
||||||
|
```html
|
||||||
|
<div id="footer">
|
||||||
|
please contact us at email.support@github.com
|
||||||
|
</div>
|
||||||
|
```
|
||||||
|
|
||||||
|
… résout le conflit.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Après avoir résolu chacune de ces sections dans chaque fichier comportant un conflit, lancez `git add` sur chaque fichier pour le marquer comme résolu.
|
||||||
|
|
||||||
|
Si vous souhaitez utiliser un outil graphique pour résoudre ces problèmes, vous pouvez lancer `git mergetool` qui démarre l'outil graphique de fusion approprié et vous permet de naviguer dans les conflits :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git mergetool
|
||||||
|
|
||||||
|
This message is displayed because 'merge.tool' is not configured.
|
||||||
|
See 'git mergetool --tool-help' or 'git help config' for more details.
|
||||||
|
'git mergetool' will now attempt to use one of the following tools:
|
||||||
|
opendiff kdiff3 tkdiff xxdiff meld tortoisemerge gvimdiff diffuse diffmerge ecmerge p4merge araxis bc3 codecompare vimdiff emerge
|
||||||
|
Merging:
|
||||||
|
index.html
|
||||||
|
|
||||||
|
Normal merge conflict for 'index.html':
|
||||||
|
{local}: modified file
|
||||||
|
{remote}: modified file
|
||||||
|
Hit return to start merge resolution tool (opendiff):
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Après avoir quitté l'outil de fusion, Git vous demande si la fusion a été réussie. Si vous répondez par la positive à l'outil, il indexe le fichier pour le marquer comme résolu.
|
||||||
|
|
||||||
|
Vous pouvez lancer à nouveau la commande `git status` pour vérifier que tous les conflits ont été résolus :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git status
|
||||||
|
# On branch master
|
||||||
|
# Changes to be committed:
|
||||||
|
# (use "git reset HEAD <file>..." to unstage)
|
||||||
|
#
|
||||||
|
# modified: index.html
|
||||||
|
#
|
||||||
|
```
|
||||||
|
|
||||||
|
Si cela vous convient et que vous avez vérifié que tout ce qui comportait un conflit a été indexé, vous pouvez taper la commande `git commit` pour finaliser le *commit* de fusion.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Merge branch 'prob53'
|
||||||
|
|
||||||
|
Conflicts:
|
||||||
|
index.html
|
||||||
|
#
|
||||||
|
# It looks like you may be committing a MERGE.
|
||||||
|
# If this is not correct, please remove the file
|
||||||
|
# .git/MERGE_HEAD
|
||||||
|
# and try again.
|
||||||
|
#
|
||||||
|
```
|
||||||
|
|
||||||
377
docs/Divers/git/git.md
Normal file
377
docs/Divers/git/git.md
Normal file
@@ -0,0 +1,377 @@
|
|||||||
|
# git
|
||||||
|
|
||||||
|
### Créer un repo git
|
||||||
|
|
||||||
|
Sur le serveur (DS916), aller dans le dossier Repo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dsm916> cd /volume1/Repositories/
|
||||||
|
|
||||||
|
dsm916> git init –-bare wp2012.git
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Sur le client (Mac), se mettre dans le dossier source:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~/ git init
|
||||||
|
|
||||||
|
bruno@macbook-pro:~/ git remote -v
|
||||||
|
|
||||||
|
bruno@macbook-pro:~/ git remote add origin ssh:dsm916/volume1/Repositories/wp2012.git
|
||||||
|
bruno@macbook-pro:~/ git remote add origin bruno@dsm916:/volume1/Repositories/wp2012.git
|
||||||
|
|
||||||
|
bruno@macbook-pro:~/ git add *
|
||||||
|
|
||||||
|
bruno@macbook-pro:~/ git commit -m "Created my repo"
|
||||||
|
|
||||||
|
bruno@macbook-pro:~/ git push –-all origin
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ssh:dsm916/volume1/Repositories/shell_scripts.git
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Démarrage:
|
||||||
|
|
||||||
|
Les fichiers peuvent avoir 3 états:
|
||||||
|
|
||||||
|
1. <u>Validé</u> signifie que les données sont stockées en sécurité dans votre base de données locale.
|
||||||
|
2. <u>Modifié</u> signifie que vous avez modifié le fichier mais qu'il n'a pas encore été validé en base.
|
||||||
|
3. <u>Indexé</u> signifie que vous avez marqué un fichier modifié dans sa version actuelle pour qu'il fasse partie du prochain instantané du projet.
|
||||||
|
|
||||||
|
Ce qui induit les 3 sections d'un projey git:
|
||||||
|
|
||||||
|
1. Le <u>répertoire Git</u> est l'endroit où Git stocke les méta-données et la base de données des objets de votre projet. C'est la partie la plus importante de Git, et c'est ce qui est copié lorsque vous clonez un dépôt depuis un autre ordinateur.
|
||||||
|
2. Le <u>répertoire de travail</u> (working copy) est une extraction unique d'une version du projet. Ces fichiers sont extraits depuis la base de données compressée dans le répertoire Git et placés sur le disque pour pouvoir être utilisés ou modifiés.
|
||||||
|
3. La <u>zone d'index</u> est un simple fichier, généralement situé dans le répertoire Git, qui stocke les informations concernant ce qui fera partie du prochain instantané.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Fichier de config:
|
||||||
|
|
||||||
|
Pour l'utilisateur: `~/.gitconfig`
|
||||||
|
|
||||||
|
#### Configurer git:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git config --global user.name "Bruno 21"
|
||||||
|
|
||||||
|
# --global Pour l'utilisateur (~/.gitconfig)
|
||||||
|
# paramètres: user.email, core.editor, merge.tool
|
||||||
|
|
||||||
|
$ git config --list
|
||||||
|
credential.helper=osxkeychain
|
||||||
|
user.name=Bruno 21
|
||||||
|
user.email=bruno@clicclac.info
|
||||||
|
filter.lfs.clean=git-lfs clean -- %f
|
||||||
|
filter.lfs.smudge=git-lfs smudge -- %f
|
||||||
|
filter.lfs.process=git-lfs filter-process
|
||||||
|
filter.lfs.required=true
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Aide git:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git help <verbe>
|
||||||
|
$ git <verbe> --help
|
||||||
|
$ man git-<verbe>
|
||||||
|
|
||||||
|
$ git help config
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Démarrer un dépôt Git:
|
||||||
|
|
||||||
|
#### [Initialisation d'un dépôt Git dans un répertoire existant](https://git-scm.com/book/fr/v1/Les-bases-de-Git-D%C3%A9marrer-un-d%C3%A9p%C3%B4t-Git#Initialisation-d'un-d%C3%A9p%C3%B4t-Git-dans-un-r%C3%A9pertoire-existant)
|
||||||
|
|
||||||
|
Se placer dans le répertoire:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git init
|
||||||
|
```
|
||||||
|
|
||||||
|
Ajouter les fichiers à suivre:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git add *.php
|
||||||
|
```
|
||||||
|
|
||||||
|
Valider:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git commit –m 'version initiale du projet'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### [Cloner un dépôt existant:](https://git-scm.com/book/fr/v1/Les-bases-de-Git-D%C3%A9marrer-un-d%C3%A9p%C3%B4t-Git#Cloner-un-d%C3%A9p%C3%B4t-existant)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git clone git://github.com/depot/projet.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Crée un répertoire <u>grit</u> contenant les données du dépôt ainsi qu'un répertoire .git
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git clone git://github.com/depot/projet.git mondossier
|
||||||
|
```
|
||||||
|
|
||||||
|
Crée un clone du depot dans le dossier mondossier
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Enregistrer des modifications dans le dépôt:
|
||||||
|
|
||||||
|
#### [Vérifier l'état des fichiers](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Enregistrer-des-modifications-dans-le-d%C3%A9p%C3%B4t#V%C3%A9rifier-l'%C3%A9tat-des-fichiers)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git status
|
||||||
|
On branch master
|
||||||
|
Your branch is ahead of 'origin/master' by 1 commit.
|
||||||
|
(use "git push" to publish your local commits)
|
||||||
|
|
||||||
|
nothing to commit, working tree clean
|
||||||
|
```
|
||||||
|
|
||||||
|
1 commit en attente de push.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### [Placer de nouveaux fichiers sous suivi de version](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Enregistrer-des-modifications-dans-le-d%C3%A9p%C3%B4t#Placer-de-nouveaux-fichiers-sous-suivi-de-version)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git add LISEZMOI
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### [Ignorer des fichiers](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Enregistrer-des-modifications-dans-le-d%C3%A9p%C3%B4t#Ignorer-des-fichiers)
|
||||||
|
|
||||||
|
Les fichiers ajoutés à <u>.gitignore</u> ne seront pas sous suivi de version.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cat .gitignore
|
||||||
|
.DS_STore
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### [Inspecter les modifications indexées et non indexées](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Enregistrer-des-modifications-dans-le-d%C3%A9p%C3%B4t#Inspecter-les-modifications-index%C3%A9es-et-non-index%C3%A9es)
|
||||||
|
|
||||||
|
Pour visualiser ce qui a été modifié mais pas encore indexé, tapez:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git diff
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### [Valider vos modifications](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Enregistrer-des-modifications-dans-le-d%C3%A9p%C3%B4t#Valider-vos-modifications)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git commit
|
||||||
|
```
|
||||||
|
|
||||||
|
Ouvre l'éditeur de texte pour renseigner le message de validation.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git commit -m "Correction d'un bug"
|
||||||
|
```
|
||||||
|
|
||||||
|
Le message est dans la commande.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git commit -a -m "Correction d'un bug"
|
||||||
|
```
|
||||||
|
|
||||||
|
Ordonne à Git de placer automatiquement tout fichier déjà en suivi de version dans la zone d'index avant de réaliser la validation, évitant ainsi d'avoir à taper les commandes `git add`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### [Effacer des fichiers](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Enregistrer-des-modifications-dans-le-d%C3%A9p%C3%B4t#Effacer-des-fichiers)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git rm LISEZMOI
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### [Déplacer des fichiers](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Enregistrer-des-modifications-dans-le-d%C3%A9p%C3%B4t#D%C3%A9placer-des-fichiers)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git mv nom_origine nom_cible
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Visualiser l'historique des validations:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git log
|
||||||
|
|
||||||
|
# -p montre les différences entre chaque validation
|
||||||
|
# -2 les deux entrées les plus récentes
|
||||||
|
|
||||||
|
$ git log --pretty=format:"%h - %an, %ar : %s"
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Annuler des actions:
|
||||||
|
|
||||||
|
#### [Modifier le dernier *commit*](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Annuler-des-actions#Modifier-le-dernier-commit)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git commit -m 'validation initiale'
|
||||||
|
$ git add fichier_oublie
|
||||||
|
$ git commit --amend
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### [Désindexer un fichier déjà indexé](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Annuler-des-actions#D%C3%A9sindexer-un-fichier-d%C3%A9j%C3%A0-index%C3%A9)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git reset HEAD benchmarks.rb
|
||||||
|
$ git status
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### [Réinitialiser un fichier modifié](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Annuler-des-actions#R%C3%A9initialiser-un-fichier-modifi%C3%A9)
|
||||||
|
|
||||||
|
Ramener le fichier à son état du dernier instantané (ou lors du clonage, ou dans l'état dans lequel vous l'avez obtenu dans votre copie de travail)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git checkout -- benchmarks.rb
|
||||||
|
$ git status
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Dépot distants:
|
||||||
|
|
||||||
|
#### [Afficher les dépôts distants](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Travailler-avec-des-d%C3%A9p%C3%B4ts-distants#Afficher-les-d%C3%A9p%C3%B4ts-distants)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git remote -v
|
||||||
|
```
|
||||||
|
|
||||||
|
#### [Récupérer et tirer depuis des dépôts distants](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Travailler-avec-des-d%C3%A9p%C3%B4ts-distants#R%C3%A9cup%C3%A9rer-et-tirer-depuis-des-d%C3%A9p%C3%B4ts-distants)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git fetch [nom-distant]
|
||||||
|
```
|
||||||
|
|
||||||
|
#### [Pousser son travail sur un dépôt distant](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Travailler-avec-des-d%C3%A9p%C3%B4ts-distants#Pousser-son-travail-sur-un-d%C3%A9p%C3%B4t-distant)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git push origin master
|
||||||
|
```
|
||||||
|
|
||||||
|
#### [Inspecter un dépôt distant](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Travailler-avec-des-d%C3%A9p%C3%B4ts-distants#Inspecter-un-d%C3%A9p%C3%B4t-distant)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git remote show origin
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Etiquettes:
|
||||||
|
|
||||||
|
#### Lister les étiquettes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git tag
|
||||||
|
|
||||||
|
$ git tag -l 'v1.4.2.*'
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Créer des étiquettes annotées
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git tag -a v1.4 -m 'my version 1.4'
|
||||||
|
|
||||||
|
# -a étiquette
|
||||||
|
# -m message d'étiquetage
|
||||||
|
```
|
||||||
|
|
||||||
|
../..
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Branches:
|
||||||
|
|
||||||
|
https://git-scm.com/book/fr/v1/Les-branches-avec-Git-Ce-qu-est-une-branche
|
||||||
|
|
||||||
|
#### Gérer les branches
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git branch # Permet de lister les branches
|
||||||
|
$ git branch -v # Visualiser les dernières validations sur chaque branche
|
||||||
|
$ git branch <branche> # Permet de créer une nouvelle branche <branche>
|
||||||
|
$ git branch -m <branche> # Renomme la branche courante en <branche>
|
||||||
|
$ git branch -d <branche> # Permet de supprimer une branche
|
||||||
|
$ git branch -D <branche> # Supprime la branche même si elle n'a pas été fusionnée
|
||||||
|
$ git branch --merged # Quelles branches ont déjà été fusionnées dans votre branche actuelle ?
|
||||||
|
$ git branch --no-merged # Branches qui contiennent des travaux qui n'ont pas encore été fusionnés
|
||||||
|
```
|
||||||
|
|
||||||
|
**master** est la branche par défaut.
|
||||||
|
|
||||||
|
**HEAD** est un pointeur qui indique la branche courante.
|
||||||
|
|
||||||
|
`$ git branch <branche>` crée une nouvelle branche mais ne fait pas basculer la <u>copie de travail</u> vers celle-ci.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Passer d'une branche à l'autre
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git checkout <branche>
|
||||||
|
$ git checkout -b <branche> # sauter sur une branche qui n'existe pas en la créant au préalable
|
||||||
|
```
|
||||||
|
|
||||||
|
Le pointeur **HEAD** pointe désormais sur <branche>
|
||||||
|
|
||||||
|
La <u>copie de travail</u> a basculée sur la nouvelle branche:
|
||||||
|
|
||||||
|
- la nouvelle branche pointera sur les nouveaux commit
|
||||||
|
- la branche **master** pointera sur le dernier commit au moment du checkout.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Fusionner les branches
|
||||||
|
|
||||||
|
Merge permet de ramener une branche sur une autre et ainsi de la fusionner. La fusion de 2 branche se fait toujours à partir de la branche principale.
|
||||||
|
|
||||||
|
- La branche "source" sera affectée en récupérant l'historique de la branche ou un commit de fusion
|
||||||
|
- La branche fusionnée ne sera pas affectée
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git merge <branche>
|
||||||
|
```
|
||||||
|
|
||||||
|
https://git-scm.com/book/fr/v1/Les-branches-avec-Git-Brancher-et-fusionner%C2%A0%3A-les-bases
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Les branches distantes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Rebaser
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### => [Session de travail avec git](git-session.md) <=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
http://www.ntu.edu.sg/home/ehchua/programming/howto/Git_HowTo.html
|
||||||
8
docs/Divers/git/index.md
Normal file
8
docs/Divers/git/index.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Divers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[git](git.md)
|
||||||
|
|
||||||
|
[Session de travail avec git](git-session.md)
|
||||||
|
|
||||||
131
docs/Divers/go.md
Normal file
131
docs/Divers/go.md
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
# go
|
||||||
|
|
||||||
|
[The Go Programming Language](https://golang.org/)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install go
|
||||||
|
```
|
||||||
|
|
||||||
|
et ajouter le chemin de l'installation au $PATH
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PATH=$PATH:/usr/local/opt/go/libexec/bin
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Créer un workspace:
|
||||||
|
|
||||||
|
Par défaut: $HOME/go
|
||||||
|
|
||||||
|
Sinon:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mkdir $HOME/Documents/go
|
||||||
|
```
|
||||||
|
|
||||||
|
puis créer 2 sous-dossiers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# programmes
|
||||||
|
$ mkdir $HOME/Documents/go/bin
|
||||||
|
|
||||||
|
# sources
|
||||||
|
$ mkdir $HOME/Documents/go/src
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Ajouter les 2 variables d'environnement à .bash_profile
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export GOPATH=$HOME/Documents/go
|
||||||
|
export GOBIN=$HOME/Documents/go/bin
|
||||||
|
```
|
||||||
|
|
||||||
|
Ajouter les dossiers des exécutables au $PATH
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PATH=$PATH:$(go env GOPATH)/bin
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ go env
|
||||||
|
GOARCH="amd64"
|
||||||
|
GOBIN="/Users/xxx/Documents/go/bin"
|
||||||
|
GOCACHE="/Users/xxx/Library/Caches/go-build"
|
||||||
|
GOEXE=""
|
||||||
|
GOHOSTARCH="amd64"
|
||||||
|
GOHOSTOS="darwin"
|
||||||
|
GOOS="darwin"
|
||||||
|
GOPATH="/Users/xxx/Documents/go"
|
||||||
|
GORACE=""
|
||||||
|
GOROOT="/usr/local/Cellar/go/1.10.3/libexec"
|
||||||
|
GOTMPDIR=""
|
||||||
|
GOTOOLDIR="/usr/local/Cellar/go/1.10.3/libexec/pkg/tool/darwin_amd64"
|
||||||
|
GCCGO="gccgo"
|
||||||
|
CC="clang"
|
||||||
|
CXX="clang++"
|
||||||
|
CGO_ENABLED="1"
|
||||||
|
CGO_CFLAGS="-g -O2"
|
||||||
|
CGO_CPPFLAGS=""
|
||||||
|
CGO_CXXFLAGS="-g -O2"
|
||||||
|
CGO_FFLAGS="-g -O2"
|
||||||
|
CGO_LDFLAGS="-g -O2"
|
||||||
|
PKG_CONFIG="pkg-config"
|
||||||
|
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/s5/zy63nf3953sb_4k0ppcy16sw0000gn/T/go-build083426751=/tmp/go-build -gno-record-gcc-switches -fno-common"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Créer une application:
|
||||||
|
|
||||||
|
Dans le dossier **src**, créer un nouveau dossier pour l'application **hello**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mkdir $GOPATH/src/hello
|
||||||
|
|
||||||
|
$ cd $GOPATH/src/hello
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un fichier **hello.go** pour l'application
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cat hello.go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Printf("hello, world\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Le compiler:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ go build
|
||||||
|
|
||||||
|
# crée un executable 'hello'
|
||||||
|
```
|
||||||
|
|
||||||
|
L'installer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ go install
|
||||||
|
|
||||||
|
# déplacer l'exécutable dans le dossier bin
|
||||||
|
```
|
||||||
|
|
||||||
|
ou la supprimer
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ go clean -i
|
||||||
|
```
|
||||||
|
|
||||||
16
docs/Divers/index.md
Normal file
16
docs/Divers/index.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Divers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Chromium](Chromium.md)
|
||||||
|
|
||||||
|
[git](git/index.md)
|
||||||
|
|
||||||
|
[plex](plex.md)
|
||||||
|
|
||||||
|
[Vider le cache DNS](Vider_cache_DNS.md)
|
||||||
|
|
||||||
|
[wp-cli](wp-cli/index.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
168
docs/Divers/plex.md
Normal file
168
docs/Divers/plex.md
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
# Plex
|
||||||
|
|
||||||
|
### Réinstaller une ancienne version de PMS:
|
||||||
|
|
||||||
|
- arrêter le serveur
|
||||||
|
- désinstaller Plex (la bibliothèque /Plex/Library n'est pas effacée)
|
||||||
|
- installer Plex
|
||||||
|
|
||||||
|
### Bibliothèque Plex:
|
||||||
|
|
||||||
|
|
||||||
|
`/volume1/Plex/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db`
|
||||||
|
|
||||||
|
`-rwx------+ 1 plex users 36980736 Jan 1 15:17 com.plexapp.plugins.library.db`
|
||||||
|
``
|
||||||
|
|
||||||
|
### Plex Plugins Folder Locations:
|
||||||
|
|
||||||
|
**Windows**
|
||||||
|
`%LOCALAPPDATA%\Plex Media Server\Plug-Ins\`
|
||||||
|
|
||||||
|
**Mac OS X**
|
||||||
|
`~\Library\Application Support\Plex Media Server\Plug-Ins\`
|
||||||
|
|
||||||
|
**Linux**
|
||||||
|
`$PLEX_HOME\Library\Application Support\Plex Media Server\Plug-Ins`
|
||||||
|
|
||||||
|
**QNAP (Network Attached Storage)**
|
||||||
|
`/root/library/Plex Media Server/Plug-ins`
|
||||||
|
|
||||||
|
**ReadyNAS ROS6**
|
||||||
|
`apps/plexmediaserver/Medialibrary/Plex Media Server/Plug-ins`
|
||||||
|
|
||||||
|
**Seagate**
|
||||||
|
`sudo rainbow -enter com.plex.plexmediaserver`
|
||||||
|
`/data/plex_conf/Library/Application\Support/Plex\ Media\ Server/Plug-Ins`
|
||||||
|
|
||||||
|
**Synology**
|
||||||
|
`/Volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins`
|
||||||
|
|
||||||
|
cd /volume1/Plex/Library/Application\ Support/Plex\ Media\ Server/Plug-ins
|
||||||
|
|
||||||
|
**Western Digital**
|
||||||
|
`/mnt/HD/HD_a2/plex_conf/Plex Media Server/Plug-Ins`
|
||||||
|
|
||||||
|
**Western Digital Wireless Pro**
|
||||||
|
`.wdcache/.Plexmediaserver/Plex Media Server/Plug-ins`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer un plug-in IPTV:
|
||||||
|
|
||||||
|
1. Télécharger [IPTV.bundle](https://github.com/Cigaras/IPTV.bundle) ([wiki](https://github.com/Cigaras/IPTV.bundle/wiki))
|
||||||
|
|
||||||
|
2. Copier l'archive dans le dossier Plug-ins
|
||||||
|
|
||||||
|
```
|
||||||
|
$ scp -r -P 42666 markdown.txt bruno@clicclac.synology.me:/volume1/web
|
||||||
|
$ ssh dsm916e
|
||||||
|
$ sudo -i
|
||||||
|
# mv /volume1/web/markdown.txt /volume1/Plex/Library/Application\ Support/Plex\ Media\ Server/Plug-ins
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Extraire, puis vérifier permissions et users
|
||||||
|
|
||||||
|
```
|
||||||
|
# cd /volume1/Plex/Library/Application\ Support/Plex\ Media\ Server/Plug-ins
|
||||||
|
# unzip IPTV.bundle.zip
|
||||||
|
# mv IPTV.bundle.master IPTV.bundle
|
||||||
|
# chmod 700 -R IPTV.bundle
|
||||||
|
# chown plex:users -R IPTV.bundle
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Relancer Plex Server
|
||||||
|
|
||||||
|
5. Importer une [playlist](https://github.com/Cigaras/IPTV.bundle/wiki/Playlist)
|
||||||
|
|
||||||
|
|
||||||
|
Création de la playlist [m3u](https://it-tuto.com/kodiopenelec-preparer-playlist-m3u-kodi-iptv/)
|
||||||
|
Forum [plex](https://forums.plex.tv/discussion/83083/rel-iptv-bundle-plug-in-that-plays-iptv-streams-from-a-m3u-playlist/p1)
|
||||||
|
Plug-in [MultiPlex](https://github.com/JayTheHatWearer/MultiPLEX.bundle)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer WebTools:
|
||||||
|
|
||||||
|
[WebTools](https://github.com/ukdtom/WebTools.bundle) est un plug-in Plex qui regroupe plusieurs outils pour Plex, dont l'UAS (Unsupported AppStore).
|
||||||
|
|
||||||
|
Le paquet pour NAS Synology se trouve [ici](https://github.com/ukdtom/WTInstaller/releases/latest).
|
||||||
|
|
||||||
|
WebTools se lance depuis [DSM](http://192.168.1.7:33400/#!/uas) (et pas depuis Plex)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer WebGrabPlus:
|
||||||
|
|
||||||
|
1. Installer [:fa-link: mono](http://www.mono-project.com):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install mono
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Télécharger [WebGrabPlus pour linux](http://webgrabplus.com/download) et le dernier [SiteIni.Pack](http://webgrabplus.com/epg-channels)
|
||||||
|
|
||||||
|
3. Installer WebGrabPlus:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd ~
|
||||||
|
$ tar -zxvf WebGrabPlus_V2.1_install.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Finir l'installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd .wg++/
|
||||||
|
$ ./install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
5. [Configurer WebGrabPlus](http://webgrabplus.com/documentation/configuration/webgrabconfigxml):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ edit WebGrab++.config.xml
|
||||||
|
```
|
||||||
|
|
||||||
|
6. Mettre à jour le dossier *siteini.pack*:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ ./bin/SiteIni.Pack.Update.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
7. Exécuter le programme:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ ./run.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
8. Envoyer le fichier *guide.xml* sur le serveur:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~/.wg++$ scp guide.xml funnymac@ftp.cluster011.ovh.net:www/guide.xml
|
||||||
|
funnymac@ftp.cluster011.ovh.net's password:
|
||||||
|
guide.xml 100% 2792KB 92.8KB/s 00:30
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Logs:
|
||||||
|
|
||||||
|
Réglages -> Serveur -> Aide -> Télécharger les logs
|
||||||
|
|
||||||
|
Pour les logs des plug-ins, aller directement sur le serveur:
|
||||||
|
|
||||||
|
`/volume1/Plex/Library/Application Support/Plex Media Server/Logs/PMS Plugin Logs`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Liens:
|
||||||
|
|
||||||
|
[:fa-link: Plex Synology FAQ](https://forums.plex.tv/discussion/191000/faqs-read-this-first#latest)
|
||||||
|
|
||||||
|
[:fa-link: Plex For Apple TV](https://forums.plex.tv/categories/plex-for-apple-tv)
|
||||||
|
|
||||||
|
[:fa-link: Plex Downloads](https://plex.tv/downloads?channel=plexpass)
|
||||||
|
|
||||||
|
[:fa-link: Remettre à Zéro un plug-in](https://github.com/ukdtom/WebTools.bundle/wiki/Reset)
|
||||||
|
|
||||||
137
docs/Divers/wp-cli/Installation.md
Normal file
137
docs/Divers/wp-cli/Installation.md
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
# Installation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 1. Installer wp-cli sur osx
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install wp-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Installer le script [**wp-cli bash completion**](https://github.com/wp-cli/wp-cli/raw/master/utils/wp-completion.bash)
|
||||||
|
|
||||||
|
- Télécharger le script et le copier dans le dossier Home
|
||||||
|
- Ajouter source ~/wp-completion.bash au .bash_profile
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "source ~/wp-completion.bash" >> .bash_profile
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Taper wp<espace><tab 2x> pour voir la liste des commandes disponibles.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 2. Installer wp-cli sur ovh mutualisé
|
||||||
|
|
||||||
|
Télécharger le fichier **wp-cli.phar**
|
||||||
|
https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||||
|
L'envoyer sur ovh dans `/opt/bin`
|
||||||
|
puis
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chmod +x wp-cli.phar
|
||||||
|
ln -s wp-cli.phar wp
|
||||||
|
```
|
||||||
|
|
||||||
|
Aller dans le dossier wordpress pour tester wp-cli
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/www/wordpress
|
||||||
|
~/www/wordpress $ wp plugin list
|
||||||
|
+---------------------------------------------+----------+-----------+---------+
|
||||||
|
| name | status | update | version |
|
||||||
|
+---------------------------------------------+----------+-----------+---------+
|
||||||
|
| add-from-server | inactive | none | 3.3.3 |
|
||||||
|
| admin-post-navigation | active | none | 2.1 |
|
||||||
|
| akismet | active | none | 4.0.8 |
|
||||||
|
| wp-retina-2x-pro | active | available | 5.2.9 |
|
||||||
|
| wp-super-cache | inactive | none | 1.6.3 |
|
||||||
|
| wordpress-seo | active | none | 7.9.1 |
|
||||||
|
+---------------------------------------------+----------+-----------+---------+
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 3. Installer wp-cli sur un NAS Synology
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# !/usr/bin/env bash
|
||||||
|
|
||||||
|
# Télécharger
|
||||||
|
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||||
|
|
||||||
|
# Test
|
||||||
|
php wp-cli.phar --info
|
||||||
|
|
||||||
|
chmod +x wp-cli.phar
|
||||||
|
sudo mv wp-cli.phar /usr/local/bin/wp
|
||||||
|
|
||||||
|
# Test
|
||||||
|
wp --info
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Par défaut, wp se lance avec php 5.6 (d'origine Synology).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp --info
|
||||||
|
OS: Linux DS916 3.10.105 #23739 SMP Tue Jul 10 00:16:03 CST 2018 x86_64
|
||||||
|
Shell: /opt/bin/bash
|
||||||
|
PHP binary: /usr/bin/php
|
||||||
|
PHP version: 5.6.11
|
||||||
|
php.ini used: /etc/php/php.ini
|
||||||
|
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
|
||||||
|
WP-CLI vendor dir: phar://wp-cli.phar/vendor
|
||||||
|
WP_CLI phar path: /usr/local/bin
|
||||||
|
WP-CLI packages dir:
|
||||||
|
WP-CLI global config:
|
||||||
|
WP-CLI project config:
|
||||||
|
WP-CLI version: 2.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Pour le lancer avec PHP70 (paquet Synology),
|
||||||
|
|
||||||
|
- Créer un script **wp.sh** dans `/usr/local/bin`
|
||||||
|
- Ajouter le contenu suivant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Running wp-cli on Synology NAS
|
||||||
|
|
||||||
|
# Add '-d extension=phar.so' to use wp-cli.phar with php70. No needed with php or php56
|
||||||
|
php70 -d extension=phar.so wp-cli.phar $*
|
||||||
|
```
|
||||||
|
|
||||||
|
- Rendre le script exécutable et le renommer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chmod +X wp.sh
|
||||||
|
|
||||||
|
$ mv wp.sh wp
|
||||||
|
```
|
||||||
|
|
||||||
|
- Utilisation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp --info
|
||||||
|
OS: Linux 3.10.105 #23739 SMP Tue Jul 10 00:16:03 CST 2018 x86_64
|
||||||
|
Shell: /opt/bin/bash
|
||||||
|
PHP binary: /volume1/@appstore/PHP7.0/usr/local/bin/php70
|
||||||
|
PHP version: 7.0.30
|
||||||
|
php.ini used: /usr/local/etc/php70/php.ini
|
||||||
|
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
|
||||||
|
WP-CLI vendor dir: phar://wp-cli.phar/vendor
|
||||||
|
WP_CLI phar path: /usr/local/bin
|
||||||
|
WP-CLI packages dir:
|
||||||
|
WP-CLI global config:
|
||||||
|
WP-CLI project config:
|
||||||
|
WP-CLI version: 2.0.0
|
||||||
|
```
|
||||||
|
|
||||||
99
docs/Divers/wp-cli/autres.md
Normal file
99
docs/Divers/wp-cli/autres.md
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
# Autres commandes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
wp super-cache
|
||||||
|
|
||||||
|
Cette commande nécessite l'installation du package <u>wp-cli/wp-super-cache-cli</u>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp package install wp-cli/wp-super-cache-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp super-cache --help
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp super-cache
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Manages the WP Super Cache plugin
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp super-cache <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
disable Disable the WP Super Cache.
|
||||||
|
enable Enable the WP Super Cache.
|
||||||
|
flush Clear something from the cache.
|
||||||
|
preload Primes the cache by creating static pages before users visit them
|
||||||
|
status Get the status of the cache.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Lancer le cron immédiatement:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp cron event run --due-now
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des crons:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp cron event list
|
||||||
|
+------------------------------------+---------------------+-----------------------+---------------+
|
||||||
|
| hook | next_run_gmt | next_run_relative | recurrence |
|
||||||
|
+------------------------------------+---------------------+-----------------------+---------------+
|
||||||
|
| wp_cache_gc | 2018-08-13 19:00:37 | 2 minutes 43 seconds | Non-repeating |
|
||||||
|
| wp_privacy_delete_old_export_files | 2018-08-13 19:50:32 | 52 minutes 38 seconds | 1 heure |
|
||||||
|
| wp_update_plugins | 2018-08-13 20:19:43 | 1 heure 21 minutes | 12 heures |
|
||||||
|
| wp_update_themes | 2018-08-13 20:19:43 | 1 heure 21 minutes | 12 heures |
|
||||||
|
| wp_version_check | 2018-08-13 20:19:43 | 1 heure 21 minutes | 12 heures |
|
||||||
|
| delete_expired_transients | 2018-08-14 06:15:04 | 11 heures 17 minutes | 1 jour |
|
||||||
|
| wp_scheduled_delete | 2018-08-14 08:20:11 | 13 heures 22 minutes | 1 jour |
|
||||||
|
| wp_scheduled_auto_draft_delete | 2018-08-14 08:27:44 | 13 heures 29 minutes | 1 jour |
|
||||||
|
| wpseo-reindex-links | 2018-08-14 12:18:00 | 17 heures 20 minutes | 1 jour |
|
||||||
|
| wp_cache_full_preload_hook | 2018-08-17 11:53:06 | 3 jours 16 heures | Non-repeating |
|
||||||
|
+------------------------------------+---------------------+-----------------------+---------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Changer l'URL de WordPress:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp option update home 'http://example.com'
|
||||||
|
$ wp option update siteurl 'http://example.com'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Supprimer les transients expirés:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp transient delete --expired
|
||||||
|
```
|
||||||
|
|
||||||
|
Vider le cache:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp cache flush
|
||||||
|
```
|
||||||
|
|
||||||
|
Ajouter les 2 dernières à la crontab:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
crontab -e
|
||||||
|
@daily sudo -u www-data wp transient delete --expired
|
||||||
|
@daily sudo -u www-data wp cache flush
|
||||||
|
```
|
||||||
|
|
||||||
133
docs/Divers/wp-cli/index.md
Normal file
133
docs/Divers/wp-cli/index.md
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
# wp-cli
|
||||||
|
|
||||||
|
WP-CLI est un outil en ligne de commande pour interagir et gérer des sites WordPress.
|
||||||
|
|
||||||
|
[Installer wp-cli](Installation.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Version:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp --version
|
||||||
|
WP-CLI 2.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$wp help
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Manage WordPress through the command-line.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
cache Adds, removes, fetches, and flushes the WP Object Cache object.
|
||||||
|
cap Adds, removes, and lists capabilities of a user role.
|
||||||
|
cli Review current WP-CLI info, check for updates, or see defined aliases.
|
||||||
|
comment Creates, updates, deletes, and moderates comments.
|
||||||
|
config Generates and reads the wp-config.php file.
|
||||||
|
core Downloads, installs, updates, and manages a WordPress installation.
|
||||||
|
cron Tests, runs, and deletes WP-Cron events; manages WP-Cron schedules.
|
||||||
|
db Performs basic database operations using credentials stored in wp- config.php.
|
||||||
|
embed Inspects oEmbed providers, clears embed cache, and more.
|
||||||
|
eval Executes arbitrary PHP code.
|
||||||
|
eval-file Loads and executes a PHP file.
|
||||||
|
export Exports WordPress content to a WXR file.
|
||||||
|
help Get help on WP-CLI, or on a specific command.
|
||||||
|
i18n Provides internationalization tools for WordPress projects.
|
||||||
|
import Imports content from a given WXR file.
|
||||||
|
language Installs, activates, and manages language packs.
|
||||||
|
media Imports files as attachments, regenerates thumbnails, or lists registered image sizes.
|
||||||
|
menu Lists, creates, assigns, and deletes the active theme's navigation menus.
|
||||||
|
network Perform network-wide operations.
|
||||||
|
option Retrieves and sets site options, including plugin and WordPress settings.
|
||||||
|
package Lists, installs, and removes WP-CLI packages.
|
||||||
|
plugin Manages plugins, including installs, activations, and updates.
|
||||||
|
post Manages posts, content, and meta.
|
||||||
|
post-type Retrieves details on the site's registered post types.
|
||||||
|
rewrite Lists or flushes the site's rewrite rules, updates the permalink structure.
|
||||||
|
role Manages user roles, including creating new roles and resetting to defaults.
|
||||||
|
scaffold Generates code for post types, taxonomies, plugins, child themes, etc.
|
||||||
|
search-replace Searches/replaces strings in the database.
|
||||||
|
server Launches PHP's built-in web server for a specific WordPress installation.
|
||||||
|
shell Opens an interactive PHP console for running and testing PHP code.
|
||||||
|
sidebar Lists registered sidebars.
|
||||||
|
site Creates, deletes, empties, moderates, and lists one or more sites on a multisite installation.
|
||||||
|
super-admin Lists, adds, or removes super admin users on a multisite installation.
|
||||||
|
super-cache Manages the WP Super Cache plugin
|
||||||
|
taxonomy Retrieves information about registered taxonomies.
|
||||||
|
term Manages taxonomy terms and term meta, with create, delete, and list commands.
|
||||||
|
theme Manages themes, including installs, activations, and updates.
|
||||||
|
transient Adds, gets, and deletes entries in the WordPress Transient Cache.
|
||||||
|
user Manages users, along with their roles, capabilities, and meta.
|
||||||
|
widget Manages widgets, including adding and moving them within sidebars.
|
||||||
|
yoast Control the Yoast SEO plugin through the command line.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- [wp cli](wp_cli.md)
|
||||||
|
- [wp comment](wp_comment.md)
|
||||||
|
- [wp config](wp_config.md)
|
||||||
|
- [wp core](wp_core.md)
|
||||||
|
- [wp db](wp_db.md)
|
||||||
|
- [wp language](wp_language.md)
|
||||||
|
- [wp media](wp_media.md)
|
||||||
|
- [wp package](wp_package.md)
|
||||||
|
- [wp plugin](wp_plugin.md)
|
||||||
|
- [wp post](wp_post.md)
|
||||||
|
- [wp revisions](wp_revisions.md)
|
||||||
|
- [wp scaffold](wp_scaffold.md)
|
||||||
|
- [wp search-replace](wp_search-replace.md)
|
||||||
|
- [wp site](wp_site.md)
|
||||||
|
- [wp theme](wp_theme.md)
|
||||||
|
- [wp user](wp_user.md)
|
||||||
|
- [autres](autres.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Paramètres globaux (même comportement pour toutes les commandes):
|
||||||
|
|
||||||
|
| **Argument** | **Description** |
|
||||||
|
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||||
|
| `--path=<path>` | Path to the WordPress files. |
|
||||||
|
| `--url=<url>` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
|
||||||
|
| `--ssh=[<scheme>:][<user>@]<host\|container>[:<port>][<path>]` | Perform operation against a remote server over SSH (or a container using scheme of “docker”, “docker-compose”, “vagrant”). |
|
||||||
|
| `--http=<http>` | Perform operation against a remote WordPress install over HTTP. |
|
||||||
|
| `--user=<id\|login\|email>` | Set the WordPress user. |
|
||||||
|
| `--skip-plugins[=<plugins>]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
|
||||||
|
| `--skip-themes[=<themes>]` | Skip loading all themes, or a comma-separated list of themes. |
|
||||||
|
| `--skip-packages` | Skip loading all installed packages. |
|
||||||
|
| `--require=<path>` | Load PHP file before running the command (may be used more than once). |
|
||||||
|
| `--[no-]color` | Whether to colorize the output. |
|
||||||
|
| `--debug[=<group>]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
|
||||||
|
| `--prompt[=<assoc>]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
|
||||||
|
| `--quiet` | Suppress informational messages. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Scénarios:
|
||||||
|
|
||||||
|
[Installer ou mettre à jour WordPress](scenarios.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Liens:
|
||||||
|
|
||||||
|
https://www.hongkiat.com/blog/wordpress-command-line/
|
||||||
|
https://www.siteground.com/tutorials/wordpress/wp-cli/
|
||||||
|
https://code.tutsplus.com/tutorials/what-is-wp-cli-a-beginners-guide--cms-28649
|
||||||
86
docs/Divers/wp-cli/scenarios.md
Normal file
86
docs/Divers/wp-cli/scenarios.md
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
# Scenarios
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer WordPress:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Télécharger WordPress:
|
||||||
|
$ wp core download --locale=fr_FR
|
||||||
|
Downloading WordPress 4.9.8 (fr_FR)...
|
||||||
|
md5 hash verified: dc365d9f51eaf1cf99562d159754a5e9
|
||||||
|
Success: WordPress downloaded.
|
||||||
|
|
||||||
|
# Créer le fichier de config (wp-config.php):
|
||||||
|
#$ wp config create --dbname=testdb --dbuser=wp --dbpass=yourpassword
|
||||||
|
$ wp core config --dbname=databasename --dbuser=databaseuser --dbpass=databasepassword --dbhost=localhost --dbprefix=prfx_
|
||||||
|
|
||||||
|
# Avec Des options supplémentaires:
|
||||||
|
$ wp core config --dbname=wordpress5 --dbuser=www --dbpass=zzz --dbhost=localhost --dbprefix=wp5_ --extra-php <<PHP
|
||||||
|
define( 'WP_DEBUG', true );
|
||||||
|
define( 'WP_DEBUG_LOG', true );
|
||||||
|
PHP
|
||||||
|
Success: Generated 'wp-config.php' file.
|
||||||
|
|
||||||
|
# Créer la bdd 'wordpress5':
|
||||||
|
$ wp db create
|
||||||
|
Success: Database created.
|
||||||
|
|
||||||
|
# Pour connaitre les encodages utilisés:
|
||||||
|
$ wp db cli
|
||||||
|
MariaDB [wordpress5]> SELECT @@character_set_database, @@collation_database;
|
||||||
|
+--------------------------+----------------------+
|
||||||
|
| @@character_set_database | @@collation_database |
|
||||||
|
+--------------------------+----------------------+
|
||||||
|
| utf8 | utf8_general_ci |
|
||||||
|
+--------------------------+----------------------+
|
||||||
|
1 row in set (0.000 sec)
|
||||||
|
|
||||||
|
# Installer WordPress:
|
||||||
|
$ wp core install --url=silverbook.local --title="WordPress Silverbook" --admin_user=bruno --admin_password=xxxxxxxx --admin_email="bruno@xxx.yyy"
|
||||||
|
Success: WordPress installed successfully.
|
||||||
|
|
||||||
|
# Changement de la structure des liens pour ne conserver que le nom de l'article
|
||||||
|
$ wp rewrite structure '/%postname%'
|
||||||
|
|
||||||
|
# Liste les thèmes trouvable dans l'installation
|
||||||
|
$ wp theme list
|
||||||
|
|
||||||
|
# Installer un thème:
|
||||||
|
$ wp theme install twentyseventeen
|
||||||
|
|
||||||
|
# Activer le thème:
|
||||||
|
$ wp theme activate twentyseventeen
|
||||||
|
|
||||||
|
# Installer et activer les plugins:
|
||||||
|
$ wp plugin install admin-post-navigation jetpack meow-lightbox simple-tags sola-newsletters wp-retina-2x-pro wp-super-cache --activate
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mettre-à-jour WordPress:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Vérifier si des MAJ sont disponibles ?
|
||||||
|
$ wp core check-update
|
||||||
|
|
||||||
|
Mettre à jour WordPress:
|
||||||
|
$ wp core update
|
||||||
|
|
||||||
|
Mettre à jour la bdd:
|
||||||
|
$ wp core update-db
|
||||||
|
|
||||||
|
Vérifier si des MAJ de plugins sont disponibles ?
|
||||||
|
$ wp plugin update --all --dry-run
|
||||||
|
|
||||||
|
Mettre à jour tous les plugins:
|
||||||
|
$ wp plugin update --all
|
||||||
|
|
||||||
|
Vérifier si des MAJ de themes sont disponibles ?
|
||||||
|
$ wp theme update --all --dry-run
|
||||||
|
|
||||||
|
Mettre à jour tous les themes:
|
||||||
|
$ wp theme update --all
|
||||||
|
```
|
||||||
|
|
||||||
74
docs/Divers/wp-cli/wp_cli.md
Normal file
74
docs/Divers/wp-cli/wp_cli.md
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
# wp cli
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help cli
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp cli
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Review current WP-CLI info, check for updates, or see defined aliases.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp cli <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
alias List available WP-CLI aliases.
|
||||||
|
check-update Check to see if there is a newer version of WP-CLI available.
|
||||||
|
cmd-dump Dump the list of installed commands, as JSON.
|
||||||
|
completions Generate tab completion strings.
|
||||||
|
has-command Detects if a command exists
|
||||||
|
info Print various details about the WP-CLI environment.
|
||||||
|
param-dump Dump the list of global parameters, as JSON or in var_export format.
|
||||||
|
update Update WP-CLI to the latest release.
|
||||||
|
version Print WP-CLI version.
|
||||||
|
```
|
||||||
|
|
||||||
|
Version:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp cli version
|
||||||
|
WP-CLI 2.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
Vérifier les mises-à-jour:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp cli check-update
|
||||||
|
Success: WP-CLI is at the latest version.
|
||||||
|
```
|
||||||
|
|
||||||
|
Mettre-à-jour WP-CLI
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp cli update
|
||||||
|
Success: WP-CLI is at the latest version.
|
||||||
|
```
|
||||||
|
|
||||||
|
Info:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp cli info
|
||||||
|
OS: Darwin 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
|
||||||
|
Shell: /bin/bash
|
||||||
|
PHP binary: /usr/local/Cellar/php/7.2.8/bin/php
|
||||||
|
PHP version: 7.2.8
|
||||||
|
php.ini used: /usr/local/etc/php/7.2/php.ini
|
||||||
|
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
|
||||||
|
WP-CLI vendor dir: phar://wp-cli.phar/vendor
|
||||||
|
WP_CLI phar path: /Users/bruno/Sites/wordpress
|
||||||
|
WP-CLI packages dir:
|
||||||
|
WP-CLI global config:
|
||||||
|
WP-CLI project config:
|
||||||
|
WP-CLI version: 2.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
141
docs/Divers/wp-cli/wp_comment.md
Normal file
141
docs/Divers/wp-cli/wp_comment.md
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
# wp comment
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help comment
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp comment
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Creates, updates, deletes, and moderates comments.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp comment <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
approve Approves a comment.
|
||||||
|
count Counts comments, on whole blog or on a given post.
|
||||||
|
create Creates a new comment.
|
||||||
|
delete Deletes a comment.
|
||||||
|
exists Verifies whether a comment exists.
|
||||||
|
generate Generates some number of new dummy comments.
|
||||||
|
get Gets the data of a single comment.
|
||||||
|
list Gets a list of comments.
|
||||||
|
meta Adds, updates, deletes, and lists comment custom fields.
|
||||||
|
recount Recalculates the comment_count value for one or more posts.
|
||||||
|
spam Marks a comment as spam.
|
||||||
|
status Gets the status of a comment.
|
||||||
|
trash Trashes a comment.
|
||||||
|
unapprove Unapproves a comment.
|
||||||
|
unspam Unmarks a comment as spam.
|
||||||
|
untrash Untrashes a comment.
|
||||||
|
update Updates one or more comments.
|
||||||
|
```
|
||||||
|
|
||||||
|
Affiche le nombre de commentaires:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp comment count
|
||||||
|
approved: 2
|
||||||
|
spam: 0
|
||||||
|
trash: 0
|
||||||
|
post-trashed: 0
|
||||||
|
all: 2
|
||||||
|
moderated: 0
|
||||||
|
total_comments: 2
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des commentaires (approuvés ou non):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp comment list
|
||||||
|
+------------+-----------------+---------------------+------------------+---------------------------+-------------------------+
|
||||||
|
| comment_ID | comment_post_ID | comment_date | comment_approved | comment_author | comment_author_email |
|
||||||
|
+------------+-----------------+---------------------+------------------+---------------------------+-------------------------+
|
||||||
|
| 5 | 209 | 2018-08-14 08:00:18 | 1 | bruno | bruno@clicclac.info |
|
||||||
|
| 4 | 209 | 2018-08-14 07:59:55 | 0 | bruno | bruno@clicclac.info |
|
||||||
|
| 1 | 1 | 2017-01-29 09:19:42 | 1 | Un commentateur WordPress | wapuu@wordpress.example |
|
||||||
|
+------------+-----------------+---------------------+------------------+---------------------------+-------------------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste de tous les commentaires (y compris spam, supprimés, post supprimés):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp comment list --status=all,spam,trash,post-trashed
|
||||||
|
+------------+-----------------+---------------------+------------------+---------------------------+-------------------------+
|
||||||
|
| comment_ID | comment_post_ID | comment_date | comment_approved | comment_author | comment_author_email |
|
||||||
|
+------------+-----------------+---------------------+------------------+---------------------------+-------------------------+
|
||||||
|
| 8 | 210 | 2018-08-14 08:11:08 | post-trashed | bruno | bruno@clicclac.info |
|
||||||
|
| 7 | 209 | 2018-08-14 08:01:02 | 1 | bruno | bruno@clicclac.info |
|
||||||
|
| 6 | 209 | 2018-08-14 08:00:46 | trash | bruno | bruno@clicclac.info |
|
||||||
|
| 5 | 209 | 2018-08-14 08:00:18 | 1 | bruno | bruno@clicclac.info |
|
||||||
|
| 4 | 209 | 2018-08-14 07:59:55 | 0 | bruno | bruno@clicclac.info |
|
||||||
|
| 3 | 209 | 2018-08-14 07:59:27 | 1 | bruno | bruno@clicclac.info |
|
||||||
|
| 2 | 57 | 2017-01-29 20:20:06 | spam | bruno | bruno@clicclac.info |
|
||||||
|
| 1 | 1 | 2017-01-29 09:19:42 | 1 | Un commentateur WordPress | wapuu@wordpress.example |
|
||||||
|
+------------+-----------------+---------------------+------------------+---------------------------+-------------------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Déclarer un commentaire en SPAM:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp comment spam 2
|
||||||
|
Success: Marked as spam comment 2.
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des SPAMs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp comment list --status=spam
|
||||||
|
+------------+-----------------+---------------------+------------------+----------------+----------------------+
|
||||||
|
| comment_ID | comment_post_ID | comment_date | comment_approved | comment_author | comment_author_email |
|
||||||
|
+------------+-----------------+---------------------+------------------+----------------+----------------------+
|
||||||
|
| 2 | 57 | 2017-01-29 20:20:06 | spam | bruno | bruno@clicclac.info |
|
||||||
|
+------------+-----------------+---------------------+------------------+----------------+----------------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Ne plus déclarer un commentaire en SPAM:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp comment unspam 2
|
||||||
|
Warning: Site url not set - defaulting to 'example.com'. Any notification emails sent to post author may appear to come from 'example.com'.
|
||||||
|
Success: Unspammed comment 2.
|
||||||
|
```
|
||||||
|
|
||||||
|
Effacer le SPAM:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp comment delete $(wp comment list --status=spam --format=ids)
|
||||||
|
Success: Trashed comment 2.
|
||||||
|
```
|
||||||
|
|
||||||
|
Effacer les commentaires supprimés et post supprimés:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp comment delete $(wp comment list --status=trash,post-trashed --format=ids)
|
||||||
|
Success: Trashed comment 8.
|
||||||
|
Success: Deleted comment 6.
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des trackback:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp comment list --type=trackback --format=ids
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des Pingback:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp comment list --type=pingback --format=ids
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
63
docs/Divers/wp-cli/wp_config.md
Normal file
63
docs/Divers/wp-cli/wp_config.md
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
# wp config
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help config
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp config
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Generates and reads the wp-config.php file.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp config <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
create Generates a wp-config.php file.
|
||||||
|
delete Deletes a specific constant or variable from the wp-config.php file.
|
||||||
|
edit Launches system editor to edit the wp-config.php file.
|
||||||
|
get Gets the value of a specific constant or variable defined in wp-config.php file.
|
||||||
|
has Checks whether a specific constant or variable exists in the wp-config.php file.
|
||||||
|
list Lists variables, constants, and file includes defined in wp-config.php file.
|
||||||
|
path Gets the path to wp-config.php file.
|
||||||
|
set Sets the value of a specific constant or variable defined in wp-config.php file.
|
||||||
|
shuffle-salts Refreshes the salts defined in the wp-config.php file.
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des variables et constantes du fichier <u>config.php</u>:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp config list
|
||||||
|
+-------------------+------------------------------------------------------------------+----------+
|
||||||
|
| name | value | type |
|
||||||
|
+-------------------+------------------------------------------------------------------+----------+
|
||||||
|
| table_prefix | wp_ | variable |
|
||||||
|
| WP_CACHE | 1 | constant |
|
||||||
|
| WPCACHEHOME | /Users/bruno/Sites/wordpress/wp-content/plugins/wp-super-cache/ | constant |
|
||||||
|
| DB_NAME | wordpress4 | constant |
|
||||||
|
| DB_USER | xxx | constant |
|
||||||
|
| DB_PASSWORD | yyy | constant |
|
||||||
|
| DB_HOST | localhost | constant |
|
||||||
|
| DB_CHARSET | utf8mb4 | constant |
|
||||||
|
| DB_COLLATE | | constant |
|
||||||
|
| AUTH_KEY | ---------------------------------------------------------------- | constant |
|
||||||
|
| SECURE_AUTH_KEY | ---------------------------------------------------------------- | constant |
|
||||||
|
| LOGGED_IN_KEY | ---------------------------------------------------------------- | constant |
|
||||||
|
| NONCE_KEY | ---------------------------------------------------------------- | constant |
|
||||||
|
| AUTH_SALT | ---------------------------------------------------------------- | constant |
|
||||||
|
| SECURE_AUTH_SALT | ---------------------------------------------------------------- | constant |
|
||||||
|
| LOGGED_IN_SALT | ---------------------------------------------------------------- | constant |
|
||||||
|
| NONCE_SALT | ---------------------------------------------------------------- | constant |
|
||||||
|
| WP_POST_REVISIONS | 3 | constant |
|
||||||
|
| WP_DEBUG | | constant |
|
||||||
|
+-------------------+------------------------------------------------------------------+----------+
|
||||||
|
```
|
||||||
|
|
||||||
73
docs/Divers/wp-cli/wp_core.md
Normal file
73
docs/Divers/wp-cli/wp_core.md
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
# wp core
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help core
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp core
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Downloads, installs, updates, and manages a WordPress installation.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp core <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
check-update Checks for WordPress updates via Version Check API.
|
||||||
|
download Downloads core WordPress files.
|
||||||
|
install Runs the standard WordPress installation process.
|
||||||
|
is-installed Checks if WordPress is installed.
|
||||||
|
multisite-convert Transforms an existing single-site installation into a multisite installation.
|
||||||
|
multisite-install Installs WordPress multisite from scratch.
|
||||||
|
update Updates WordPress to a newer version.
|
||||||
|
update-db Runs the WordPress database update procedure.
|
||||||
|
verify-checksums Verifies WordPress files against WordPress.org's checksums.
|
||||||
|
version Displays the WordPress version.
|
||||||
|
```
|
||||||
|
|
||||||
|
Version courante de WordPress:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp core version --path=/Users/bruno/Sites/wordpress
|
||||||
|
4.9.8
|
||||||
|
```
|
||||||
|
|
||||||
|
Vérifier les mises-à-jour:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp core check-update
|
||||||
|
Success: WordPress is at the latest version.
|
||||||
|
```
|
||||||
|
|
||||||
|
Mise-à-jour de WordPress:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp core update
|
||||||
|
```
|
||||||
|
|
||||||
|
Mise-à-jour de la bdd:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp core update-db
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer une ancienne version
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp core update --version=4.7.1
|
||||||
|
```
|
||||||
|
|
||||||
|
Télécharger la version 4.2.2 en langue grecque:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp core download --version=4.2.2 --locale=el_GR
|
||||||
|
```
|
||||||
|
|
||||||
109
docs/Divers/wp-cli/wp_db.md
Normal file
109
docs/Divers/wp-cli/wp_db.md
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
# wp db
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help db
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp db
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Performs basic database operations using credentials stored in wp-config.php.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp db <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
check Checks the current status of the database.
|
||||||
|
clean Removes all tables with `$table_prefix` from the database.
|
||||||
|
cli Opens a MySQL console using credentials from wp-config.php
|
||||||
|
columns Displays information about a given table.
|
||||||
|
create Creates a new database.
|
||||||
|
drop Deletes the existing database.
|
||||||
|
export Exports the database to a file or to STDOUT.
|
||||||
|
import Imports a database from a file or from STDIN.
|
||||||
|
optimize Optimizes the database.
|
||||||
|
prefix Displays the database table prefix.
|
||||||
|
query Executes a SQL query against the database.
|
||||||
|
repair Repairs the database.
|
||||||
|
reset Removes all tables from the database.
|
||||||
|
search Finds a string in the database.
|
||||||
|
size Displays the database name and size.
|
||||||
|
tables Lists the database tables.
|
||||||
|
```
|
||||||
|
|
||||||
|
Optimiser la bdd:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp db optimize
|
||||||
|
wordpress4.wp_comments
|
||||||
|
note : Table does not support optimize, doing recreate + analyze instead
|
||||||
|
status : OK
|
||||||
|
wordpress4.wp_cptch_images
|
||||||
|
note : Table does not support optimize, doing recreate + analyze instead
|
||||||
|
status : OK
|
||||||
|
.../...
|
||||||
|
Success: Database optimized.
|
||||||
|
```
|
||||||
|
|
||||||
|
Vérifier la bdd:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp db check
|
||||||
|
wordpress4.wp_cntctfrm_field OK
|
||||||
|
wordpress4.wp_commentmeta OK
|
||||||
|
wordpress4.wp_comments OK
|
||||||
|
wordpress4.wp_cptch_images OK
|
||||||
|
.../...
|
||||||
|
Success: Database checked.
|
||||||
|
```
|
||||||
|
|
||||||
|
Réparer la bdd:
|
||||||
|
This command only works on database tables that use the MyISAM storage engine. It does not work on InnoDB tables.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp db repair
|
||||||
|
wordpress4.wp_options
|
||||||
|
note : The storage engine for the table doesn't support repair
|
||||||
|
wordpress4.wp_postmeta
|
||||||
|
note : The storage engine for the table doesn't support repair
|
||||||
|
.../...
|
||||||
|
Success: Database repaired.
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer une sauvegarde de la base de bonnée de WordPress:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp db export
|
||||||
|
Success: Exported to 'wordpress4-2018-08-11-d930b79.sql'.
|
||||||
|
```
|
||||||
|
|
||||||
|
Tester une requête:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp db query "SELECT * FROM wp_options"
|
||||||
|
```
|
||||||
|
|
||||||
|
Ouvrir une console MySQL:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp db cli
|
||||||
|
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
||||||
|
Your MariaDB connection id is 407
|
||||||
|
Server version: 10.3.8-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 [wordpress4]>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
124
docs/Divers/wp-cli/wp_language.md
Normal file
124
docs/Divers/wp-cli/wp_language.md
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
# wp language
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help language
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp language
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Installs, activates, and manages language packs.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp language <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
core Installs, activates, and manages core language packs.
|
||||||
|
plugin Installs, activates, and manages plugin language packs.
|
||||||
|
theme Installs, activates, and manages theme language packs.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Language de WordPress actif:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp language core list --status=active
|
||||||
|
+----------+-----------------+-------------+--------+--------+---------------------+
|
||||||
|
| language | english_name | native_name | status | update | updated |
|
||||||
|
+----------+-----------------+-------------+--------+--------+---------------------+
|
||||||
|
| fr_FR | French (France) | Français | active | none | 2018-08-12 05:36:43 |
|
||||||
|
+----------+-----------------+-------------+--------+--------+---------------------+
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Languages de WordPress installés:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp language core list --status=installed
|
||||||
|
+----------+-------------------------+-------------------------+-----------+--------+---------+
|
||||||
|
| language | english_name | native_name | status | update | updated |
|
||||||
|
+----------+-------------------------+-------------------------+-----------+--------+---------+
|
||||||
|
| en_US | English (United States) | English (United States) | installed | none | |
|
||||||
|
+----------+-------------------------+-------------------------+-----------+--------+---------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Language des plugins actifs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp language plugin list --status=active --all
|
||||||
|
+--------------------------------+----------+-----------------+-------------+--------+--------+---------------------+
|
||||||
|
| plugin | language | english_name | native_name | status | update | updated |
|
||||||
|
+--------------------------------+----------+-----------------+-------------+--------+--------+---------------------+
|
||||||
|
| admin-post-navigation | fr_FR | French (France) | Français | active | none | 2015-10-14 15:18:47 |
|
||||||
|
| akismet | fr_FR | French (France) | Français | active | none | 2018-06-20 06:39:46 |
|
||||||
|
| gutenberg | fr_FR | French (France) | Français | active | none | 2018-08-09 14:57:31 |
|
||||||
|
| jetpack | fr_FR | French (France) | Français | active | none | 2018-08-08 19:21:07 |
|
||||||
|
| regenerate-thumbnails | fr_FR | French (France) | Français | active | none | 2018-06-13 11:44:47 |
|
||||||
|
| simple-tags | fr_FR | French (France) | Français | active | none | 2017-06-11 12:58:24 |
|
||||||
|
| subscribe-to-comments-reloaded | fr_FR | French (France) | Français | active | none | 2016-08-14 12:04:59 |
|
||||||
|
| wp-db-backup | fr_FR | French (France) | Français | active | none | 2016-09-09 07:58:42 |
|
||||||
|
| wp-jquery-lightbox | fr_FR | French (France) | Français | active | none | 2017-03-29 14:53:35 |
|
||||||
|
| wordpress-seo | fr_FR | French (France) | Français | active | none | 2018-07-24 15:40:07 |
|
||||||
|
+--------------------------------+----------+-----------------+-------------+--------+--------+---------------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des mise-à-jour du language de WordPress disponibles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp language core list --update=available --all
|
||||||
|
+----------+--------------+-------------+--------+--------+---------+
|
||||||
|
| language | english_name | native_name | status | update | updated |
|
||||||
|
+----------+--------------+-------------+--------+--------+---------+
|
||||||
|
+----------+--------------+-------------+--------+--------+---------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des mise-à-jour du language des plugins disponibles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp language plugin list --update=available --all
|
||||||
|
+--------+----------+--------------+-------------+--------+--------+---------+
|
||||||
|
| plugin | language | english_name | native_name | status | update | updated |
|
||||||
|
+--------+----------+--------------+-------------+--------+--------+---------+
|
||||||
|
+--------+----------+--------------+-------------+--------+--------+---------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des mise-à-jour du language des themes disponibles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp language theme list --update=available --all
|
||||||
|
+-------+----------+--------------+-------------+--------+--------+---------+
|
||||||
|
| theme | language | english_name | native_name | status | update | updated |
|
||||||
|
+-------+----------+--------------+-------------+--------+--------+---------+
|
||||||
|
+-------+----------+--------------+-------------+--------+--------+---------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Met à jour tous les fichiers de language de WordPress:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp language core update
|
||||||
|
Success: Translations are up to date.
|
||||||
|
```
|
||||||
|
|
||||||
|
Met à jour tous les fichiers de language de tous les plug-ins:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp language plugin update --all
|
||||||
|
Success: Translations are up to date.
|
||||||
|
```
|
||||||
|
|
||||||
|
Met à jour tous les fichiers de language de tous les thèmes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp language theme update --all
|
||||||
|
Success: Translations are up to date.
|
||||||
|
```
|
||||||
|
|
||||||
136
docs/Divers/wp-cli/wp_media.md
Normal file
136
docs/Divers/wp-cli/wp_media.md
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
# wp media
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help media
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp media
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Imports files as attachments, regenerates thumbnails, or lists registered image sizes.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp media <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
image-size Lists image sizes registered with WordPress.
|
||||||
|
import Creates attachments from local files or URLs.
|
||||||
|
regenerate Regenerates thumbnails for one or more attachments.
|
||||||
|
```
|
||||||
|
|
||||||
|
Afficher les tailles d'image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp media image-size
|
||||||
|
+--------------+-------+--------+------+-------+
|
||||||
|
| name | width | height | crop | ratio |
|
||||||
|
+--------------+-------+--------+------+-------+
|
||||||
|
| full | | | N/A | N/A |
|
||||||
|
| medium_large | 768 | 0 | soft | N/A |
|
||||||
|
| large | 610 | 610 | soft | N/A |
|
||||||
|
| medium | 400 | 400 | soft | N/A |
|
||||||
|
| thumbnail | 200 | 200 | hard | 1:1 |
|
||||||
|
+--------------+-------+--------+------+-------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Regénérer toutes les vignettes (<u>sans confirmation</u>):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp media regenerate --yes
|
||||||
|
Found 20 images to regenerate.
|
||||||
|
1/20 Regenerated thumbnails for "2016-06-24_LaPleureuse-LaSauffaz_0729" (ID 70).
|
||||||
|
2/20 Regenerated thumbnails for "2016-06-24_CascadeDeLaPleureuse_0700" (ID 69).
|
||||||
|
3/20 Regenerated thumbnails for "2016-06-24_TorrentDeSales_0844" (ID 68).
|
||||||
|
4/20 Regenerated thumbnails for "2016-06-23_CirqueDuFerACheval_0498" (ID 67).
|
||||||
|
5/20 Regenerated thumbnails for "2008-09-09_BihoreauGris_2081" (ID 35).
|
||||||
|
6/20 Regenerated thumbnails for "2008-09-08_BihoreauGris_1889" (ID 34).
|
||||||
|
7/20 Regenerated thumbnails for "2008-09-08_BihoreauGris_1858" (ID 33).
|
||||||
|
8/20 Regenerated thumbnails for "2008-09-08_BihoreauGris_1797" (ID 32).
|
||||||
|
9/20 Regenerated thumbnails for "2008-09-07_BihoreauGris_1113" (ID 31).
|
||||||
|
10/20 Regenerated thumbnails for "2008-09-07_BihoreauGris_1052" (ID 30).
|
||||||
|
11/20 Regenerated thumbnails for "2008-09-07_BihoreauGris_1030" (ID 29).
|
||||||
|
12/20 Regenerated thumbnails for "2008-09-07_BihoreauGris_1028" (ID 28).
|
||||||
|
13/20 Regenerated thumbnails for "2016-09-26_Brame_7811" (ID 25).
|
||||||
|
14/20 Regenerated thumbnails for "2016-09-26_Brame_7775" (ID 24).
|
||||||
|
15/20 Regenerated thumbnails for "2016-09-26_Brame_7801" (ID 23).
|
||||||
|
16/20 Regenerated thumbnails for "logo" (ID 15).
|
||||||
|
17/20 Regenerated thumbnails for "2014-09-13_BolClassic_7483" (ID 13).
|
||||||
|
18/20 Regenerated thumbnails for "2014-09-13_BolClassic_7126" (ID 12).
|
||||||
|
19/20 Regenerated thumbnails for "2014-09-13_BolClassic_7040" (ID 11).
|
||||||
|
20/20 Regenerated thumbnails for "2014-09-13_BolClassic_6826" (ID 10).
|
||||||
|
Success: Regenerated 20 of 20 images.
|
||||||
|
```
|
||||||
|
|
||||||
|
Regénérer toutes les vignettes de taille <u>large</u>:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp media regenerate --image_size=large
|
||||||
|
Do you really want to regenerate the "large" image size for all images? [y/n] y
|
||||||
|
Found 20 images to regenerate.
|
||||||
|
1/20 Regenerated "large" thumbnail for "2016-06-24_LaPleureuse-LaSauffaz_0729" (ID 70).
|
||||||
|
2/20 Regenerated "large" thumbnail for "2016-06-24_CascadeDeLaPleureuse_0700" (ID 69).
|
||||||
|
3/20 Regenerated "large" thumbnail for "2016-06-24_TorrentDeSales_0844" (ID 68).
|
||||||
|
4/20 Regenerated "large" thumbnail for "2016-06-23_CirqueDuFerACheval_0498" (ID 67).
|
||||||
|
5/20 Regenerated "large" thumbnail for "2008-09-09_BihoreauGris_2081" (ID 35).
|
||||||
|
6/20 Regenerated "large" thumbnail for "2008-09-08_BihoreauGris_1889" (ID 34).
|
||||||
|
7/20 Regenerated "large" thumbnail for "2008-09-08_BihoreauGris_1858" (ID 33).
|
||||||
|
8/20 Regenerated "large" thumbnail for "2008-09-08_BihoreauGris_1797" (ID 32).
|
||||||
|
9/20 Regenerated "large" thumbnail for "2008-09-07_BihoreauGris_1113" (ID 31).
|
||||||
|
10/20 Regenerated "large" thumbnail for "2008-09-07_BihoreauGris_1052" (ID 30).
|
||||||
|
11/20 Regenerated "large" thumbnail for "2008-09-07_BihoreauGris_1030" (ID 29).
|
||||||
|
12/20 Regenerated "large" thumbnail for "2008-09-07_BihoreauGris_1028" (ID 28).
|
||||||
|
13/20 Regenerated "large" thumbnail for "2016-09-26_Brame_7811" (ID 25).
|
||||||
|
14/20 Regenerated "large" thumbnail for "2016-09-26_Brame_7775" (ID 24).
|
||||||
|
15/20 Regenerated "large" thumbnail for "2016-09-26_Brame_7801" (ID 23).
|
||||||
|
16/20 No "large" thumbnail regeneration needed for "logo" (ID 15).
|
||||||
|
17/20 Regenerated "large" thumbnail for "2014-09-13_BolClassic_7483" (ID 13).
|
||||||
|
18/20 Regenerated "large" thumbnail for "2014-09-13_BolClassic_7126" (ID 12).
|
||||||
|
19/20 Regenerated "large" thumbnail for "2014-09-13_BolClassic_7040" (ID 11).
|
||||||
|
20/20 Regenerated "large" thumbnail for "2014-09-13_BolClassic_6826" (ID 10).
|
||||||
|
Success: Regenerated 20 of 20 images.
|
||||||
|
```
|
||||||
|
|
||||||
|
Regénérer toutes les vignettes pour les <u>attachement d'ID</u> suivants:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp media regenerate 10 11 12
|
||||||
|
Found 3 images to regenerate.
|
||||||
|
1/3 Regenerated thumbnails for "2014-09-13_BolClassic_7040" (ID 11).
|
||||||
|
2/3 Regenerated thumbnails for "2014-09-13_BolClassic_7126" (ID 12).
|
||||||
|
3/3 Regenerated thumbnails for "2014-09-13_BolClassic_6826" (ID 10).
|
||||||
|
Success: Regenerated 3 of 3 images.
|
||||||
|
```
|
||||||
|
|
||||||
|
Regénérer toutes les vignettes pour les <u>attachement d'ID 10 à 20</u>:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ seq 10 20 | xargs wp media regenerate
|
||||||
|
Found 5 images to regenerate.
|
||||||
|
1/5 Regenerated thumbnails for "logo" (ID 15).
|
||||||
|
2/5 Regenerated thumbnails for "2014-09-13_BolClassic_7483" (ID 13).
|
||||||
|
3/5 Regenerated thumbnails for "2014-09-13_BolClassic_7040" (ID 11).
|
||||||
|
4/5 Regenerated thumbnails for "2014-09-13_BolClassic_7126" (ID 12).
|
||||||
|
5/5 Regenerated thumbnails for "2014-09-13_BolClassic_6826" (ID 10).
|
||||||
|
Success: Regenerated 5 of 5 images.
|
||||||
|
```
|
||||||
|
|
||||||
|
Importer une image locale pour être "i<u>mage à la une</u> " pour un post:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp media import ~/Downloads/image.png --post_id=123 --title="A downloaded picture" --featured_image
|
||||||
|
Success: Imported file '/home/person/Downloads/image.png' as attachment ID 1753 and attached to post 123 as featured image.
|
||||||
|
```
|
||||||
|
|
||||||
|
Importer un paquet d'images:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp media import images_folder/*
|
||||||
|
```
|
||||||
86
docs/Divers/wp-cli/wp_package.md
Normal file
86
docs/Divers/wp-cli/wp_package.md
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
# wp package
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help package
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp package
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Lists, installs, and removes WP-CLI packages.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp package <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
browse Browses WP-CLI packages available for installation.
|
||||||
|
install Installs a WP-CLI package.
|
||||||
|
list Lists installed WP-CLI packages.
|
||||||
|
path Gets the path to an installed WP-CLI package, or the package directory.
|
||||||
|
uninstall Uninstalls a WP-CLI package.
|
||||||
|
update Updates all installed WP-CLI packages to their latest version.
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des packages installés:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp package list
|
||||||
|
+---------------------------+-------------+------------+--------+----------------+
|
||||||
|
| name | authors | version | update | update_version |
|
||||||
|
+---------------------------+-------------+------------+--------+----------------+
|
||||||
|
| trepmal/wp-revisions-cli | | dev-master | none | |
|
||||||
|
| wp-cli/wp-super-cache-cli | WP-CLI Team | dev-master | none | |
|
||||||
|
+---------------------------+-------------+------------+--------+----------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer un package:
|
||||||
|
```bash
|
||||||
|
$ wp package install wp-cli/wp-super-cache-cli
|
||||||
|
Installing package wp-cli/wp-super-cache-cli (dev-master)
|
||||||
|
Updating /Users/bruno/.wp-cli/packages/composer.json to require the package...
|
||||||
|
|
||||||
|
## Using Composer to install the package...
|
||||||
|
|
||||||
|
Loading composer repositories with package information
|
||||||
|
Updating dependencies
|
||||||
|
Resolving dependencies through SAT
|
||||||
|
Looking at all rules.
|
||||||
|
|
||||||
|
Dependency resolution completed in 0.221 seconds
|
||||||
|
Analyzed 1299 packages to resolve dependencies
|
||||||
|
Analyzed 24098 rules to resolve dependencies
|
||||||
|
Package operations: 1 install, 0 updates, 0 removals
|
||||||
|
Installs: wp-cli/wp-super-cache-cli:dev-master 4993755
|
||||||
|
|
||||||
|
- Installing wp-cli/wp-super-cache-cli (dev-master 4993755)
|
||||||
|
Writing lock file
|
||||||
|
Generating autoload files
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
Success: Package installed.
|
||||||
|
```
|
||||||
|
|
||||||
|
Tester si un package est installé:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# !/bin/bash
|
||||||
|
|
||||||
|
packages_list=$(wp package list | sed -n '1!p' | awk '{print $1'})
|
||||||
|
|
||||||
|
# Si le package /wp-cli/admin-command est installé
|
||||||
|
if [ -n "$(echo "$packages_list" | awk '$1 ~ /wp-cli\/admin-command/')" ]; then
|
||||||
|
echo "/wp-cli/admin-command est installé"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
360
docs/Divers/wp-cli/wp_plugin.md
Normal file
360
docs/Divers/wp-cli/wp_plugin.md
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
# wp plugin
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help plugin
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp plugin
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Manages plugins, including installs, activations, and updates.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp plugin <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
activate Activates one or more plugins.
|
||||||
|
deactivate Deactivates one or more plugins.
|
||||||
|
delete Deletes plugin files without deactivating or uninstalling.
|
||||||
|
get Gets details about an installed plugin.
|
||||||
|
install Installs one or more plugins.
|
||||||
|
is-active Checks if a given plugin is active.
|
||||||
|
is-installed Checks if a given plugin is installed.
|
||||||
|
list Gets a list of plugins.
|
||||||
|
path Gets the path to a plugin or to the plugin directory.
|
||||||
|
search Searches the WordPress.org plugin directory.
|
||||||
|
status Reveals the status of one or all plugins.
|
||||||
|
toggle Toggles a plugin's activation state.
|
||||||
|
uninstall Uninstalls one or more plugins.
|
||||||
|
update Updates one or more plugins.
|
||||||
|
verify-checksums Verifies plugin files against WordPress.org's checksums.
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des plug-ins:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin list --path=/Users/bruno/Sites/wordpress
|
||||||
|
+--------------------------------+----------+-----------+------------+
|
||||||
|
| name | status | update | version |
|
||||||
|
+--------------------------------+----------+-----------+------------+
|
||||||
|
| admin-post-navigation | active | none | 2.1 |
|
||||||
|
| akismet | inactive | none | 4.0.8 |
|
||||||
|
| audio-story-images | inactive | none | 0.0.3 |
|
||||||
|
| boxers-and-swipers | inactive | none | 3.11 |
|
||||||
|
| captcha | active | none | 4.4.5 |
|
||||||
|
| contact-form-plugin | active | none | 4.1.0 |
|
||||||
|
| easy-swipebox | inactive | none | 1.1.0 |
|
||||||
|
| exif-caption | inactive | none | 2.11 |
|
||||||
|
| thesography | inactive | none | 1.3 |
|
||||||
|
| google-sitemap-generator | inactive | none | 4.0.9 |
|
||||||
|
| gutenberg | active | available | 3.4.0 |
|
||||||
|
| hello | inactive | none | 1.6 |
|
||||||
|
| jetpack | inactive | available | 6.3.3 |
|
||||||
|
| jquery-updater | inactive | none | 3.3.1 |
|
||||||
|
| knowledge-base-cpt | inactive | none | 1.1.0 |
|
||||||
|
| link-manager | active | none | 0.1-beta |
|
||||||
|
| meow-lightbox | active | available | 1.1.2 |
|
||||||
|
| sola-newsletters | active | none | 4.0.19 |
|
||||||
|
| regenerate-thumbnails | active | none | 3.0.2 |
|
||||||
|
| responsive-lightbox | inactive | none | 2.0.5 |
|
||||||
|
| simple-tags | active | none | 2.4.7 |
|
||||||
|
| subscribe-to-comments-reloaded | inactive | none | 180225 |
|
||||||
|
| theme-check | inactive | none | 20160523.1 |
|
||||||
|
| wp-db-backup | inactive | none | 2.3.3 |
|
||||||
|
| wp-jquery-lightbox | inactive | none | 1.4.8 |
|
||||||
|
| wp-print | inactive | none | 2.58 |
|
||||||
|
| wp-image-protect | inactive | none | 2.7.1 |
|
||||||
|
| wp-log-viewer | inactive | none | 1.2.1 |
|
||||||
|
| wp-mapeditor | inactive | none | 0.2.2 |
|
||||||
|
| rest-api-oauth1 | inactive | none | 0.3.0 |
|
||||||
|
| wp-retina-2x-pro | active | available | 5.4.0 |
|
||||||
|
| wp-super-cache | active | available | 1.6.2 |
|
||||||
|
| wptouch-pro | inactive | none | 4.0.17 |
|
||||||
|
| wp-xhprof-master | inactive | none | 0.1 |
|
||||||
|
| yada-wiki | inactive | none | 3.0 |
|
||||||
|
| wordpress-seo | active | available | 7.9 |
|
||||||
|
| zenlatest | inactive | none | 1.3 |
|
||||||
|
| zenphotopress | inactive | none | 1.8 |
|
||||||
|
| advanced-cache.php | dropin | none | |
|
||||||
|
+--------------------------------+----------+-----------+------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Choisir les champs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin list --fields=name,version
|
||||||
|
+--------------------------------+------------+
|
||||||
|
| name | version |
|
||||||
|
+--------------------------------+------------+
|
||||||
|
| admin-post-navigation | 2.1 |
|
||||||
|
| akismet | 4.0.8 |
|
||||||
|
| audio-story-images | 0.0.3 |
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des plug-ins activés:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin list --status=active
|
||||||
|
+-----------------------+--------+-----------+----------+
|
||||||
|
| name | status | update | version |
|
||||||
|
+-----------------------+--------+-----------+----------+
|
||||||
|
| admin-post-navigation | active | none | 2.1 |
|
||||||
|
| captcha | active | none | 4.4.5 |
|
||||||
|
| contact-form-plugin | active | none | 4.1.0 |
|
||||||
|
| gutenberg | active | available | 3.4.0 |
|
||||||
|
| link-manager | active | none | 0.1-beta |
|
||||||
|
| meow-lightbox | active | available | 1.1.2 |
|
||||||
|
| sola-newsletters | active | none | 4.0.19 |
|
||||||
|
| regenerate-thumbnails | active | none | 3.0.2 |
|
||||||
|
| simple-tags | active | none | 2.4.7 |
|
||||||
|
| wp-retina-2x-pro | active | available | 5.4.0 |
|
||||||
|
| wp-super-cache | active | available | 1.6.2 |
|
||||||
|
| wordpress-seo | active | available | 7.9 |
|
||||||
|
+-----------------------+--------+-----------+----------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des plug-ins mis-à-jour:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin list --update=available
|
||||||
|
+------------------+--------+-----------+---------+
|
||||||
|
| name | status | update | version |
|
||||||
|
+------------------+--------+-----------+---------+
|
||||||
|
| gutenberg | active | available | 3.4.0 |
|
||||||
|
| meow-lightbox | active | available | 1.1.2 |
|
||||||
|
| wp-retina-2x-pro | active | available | 5.4.0 |
|
||||||
|
| wp-super-cache | active | available | 1.6.2 |
|
||||||
|
| wordpress-seo | active | available | 7.9 |
|
||||||
|
+------------------+--------+-----------+---------+
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin list --fields=name,version --update=available
|
||||||
|
+------------------+---------+
|
||||||
|
| name | version |
|
||||||
|
+------------------+---------+
|
||||||
|
| gutenberg | 3.4.0 |
|
||||||
|
| meow-lightbox | 1.1.2 |
|
||||||
|
| wp-retina-2x-pro | 5.4.0 |
|
||||||
|
| wp-super-cache | 1.6.2 |
|
||||||
|
| wordpress-seo | 7.9 |
|
||||||
|
+------------------+---------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Résultat de la commande au format JSON:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin list --update=available --format=json
|
||||||
|
[{"name":"gutenberg","status":"active","update":"available","version":"3.4.0"},{"name":"meow-lightbox","status":"active","update":"available","version":"1.1.2"},{"name":"wp-retina-2x-pro","status":"active","update":"available","version":"5.4.0"},{"name":"wp-super-cache","status":"active","update":"available","version":"1.6.2"},{"name":"wordpress-seo","status":"active","update":"available","version":"7.9"}]
|
||||||
|
```
|
||||||
|
|
||||||
|
Résultat de la commande au format CSV:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin list --update=available --format=csv
|
||||||
|
name,status,update,version
|
||||||
|
gutenberg,active,available,3.4.0
|
||||||
|
meow-lightbox,active,available,1.1.2
|
||||||
|
wp-retina-2x-pro,active,available,5.4.0
|
||||||
|
wp-super-cache,active,available,1.6.2
|
||||||
|
wordpress-seo,active,available,7.9
|
||||||
|
```
|
||||||
|
|
||||||
|
Autres formats:
|
||||||
|
- table
|
||||||
|
– csv
|
||||||
|
– count
|
||||||
|
– json
|
||||||
|
– yaml
|
||||||
|
|
||||||
|
Champs affichés par défaut:
|
||||||
|
- name
|
||||||
|
- status
|
||||||
|
- update
|
||||||
|
- version
|
||||||
|
|
||||||
|
Champs optionnels:
|
||||||
|
- update_version
|
||||||
|
- update_package (url)
|
||||||
|
- update_id
|
||||||
|
- title
|
||||||
|
- description
|
||||||
|
|
||||||
|
Vérifier si des MAJ de plugins sont disponibles ?
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin update --all --dry-run
|
||||||
|
Available plugin updates:
|
||||||
|
+------------------+--------+---------+----------------+
|
||||||
|
| name | status | version | update_version |
|
||||||
|
+------------------+--------+---------+----------------+
|
||||||
|
| gutenberg | active | 3.4.0 | 3.5.0 |
|
||||||
|
| meow-lightbox | active | 1.1.2 | 1.2.1 |
|
||||||
|
| wp-retina-2x-pro | active | 5.4.0 | 5.4.1 |
|
||||||
|
| wp-super-cache | active | 1.6.2 | 1.6.3 |
|
||||||
|
| wordpress-seo | active | 7.9 | 7.9.1 |
|
||||||
|
+------------------+--------+---------+----------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin list --fields=name,version,update_version,description --update=available
|
||||||
|
+------------------+---------+----------------+-------------------------------------------------------------------------------------+
|
||||||
|
| name | version | update_version | description |
|
||||||
|
+------------------+---------+----------------+-------------------------------------------------------------------------------------+
|
||||||
|
| gutenberg | 3.4.0 | 3.5.0 | Printing since 1440. This is the development plugin for the new block editor in cor |
|
||||||
|
| | | | e. |
|
||||||
|
| meow-lightbox | 1.1.2 | 1.2.1 | Lightbox designed by and for photographers. |
|
||||||
|
| wp-retina-2x-pro | 5.4.0 | 5.4.1 | Make your website look beautiful and crisp on modern displays by creating + display |
|
||||||
|
| | | | ing retina images. |
|
||||||
|
| wp-super-cache | 1.6.2 | 1.6.3 | Very fast caching plugin for WordPress. |
|
||||||
|
| wordpress-seo | 7.9 | 7.9.1 | The first true all-in-one SEO solution for WordPress, including on-page content ana |
|
||||||
|
| | | | lysis, XML sitemaps and much more. |
|
||||||
|
+------------------+---------+----------------+-------------------------------------------------------------------------------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Etat des plug-ins sur le site:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin status
|
||||||
|
21 installed plugins:
|
||||||
|
A admin-post-navigation 2.1
|
||||||
|
I akismet 4.0.8
|
||||||
|
I google-sitemap-generator 4.0.9
|
||||||
|
UA gutenberg 3.4.0
|
||||||
|
I hello 1.6
|
||||||
|
I jetpack 6.4.2
|
||||||
|
I jquery-updater 3.3.1
|
||||||
|
A link-manager 0.1-beta
|
||||||
|
UA meow-lightbox 1.1.2
|
||||||
|
A sola-newsletters 4.0.19
|
||||||
|
A regenerate-thumbnails 3.0.2
|
||||||
|
I responsive-lightbox 2.0.5
|
||||||
|
A simple-tags 2.4.7
|
||||||
|
I rest-api-oauth1 0.3.0
|
||||||
|
UA wp-retina-2x-pro 5.4.0
|
||||||
|
UA wp-super-cache 1.6.2
|
||||||
|
I wptouch-pro 4.0.17
|
||||||
|
UA wordpress-seo 7.9
|
||||||
|
I zenlatest 1.3
|
||||||
|
I zenphotopress 1.8
|
||||||
|
D advanced-cache.php
|
||||||
|
|
||||||
|
Legend: A = Active, I = Inactive, D = Drop-In, U = Update Available
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer un plug-in:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin install <Plugin_Name>
|
||||||
|
```
|
||||||
|
|
||||||
|
Activer un plug-in:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ wp plugin activate <Plugin_Name>
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer et activer un plug-in:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin install <Plugin_Name> --activate
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer plusieurs plug-in:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin install <Plugin_Name_1> <Plugin_Name_2> <Plugin_Name_3>
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer un plug-in depuis un serveur:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin install https://d1qas1txbec8n.cloudfront.net/wp-content/uploads/2015/06/23073607/myplugin.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer une ancienne version:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin install wordpress-seo --version=4.8
|
||||||
|
```
|
||||||
|
|
||||||
|
Mettre-à-jour un plug-in:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin update jetpack
|
||||||
|
Téléchargement de la mise à jour depuis https://downloads.wordpress.org/plugin/jetpack.6.4.2.zip…
|
||||||
|
Décompression de la mise à jour...
|
||||||
|
Installation de la dernière version...
|
||||||
|
Retrait de l’ancienne version de l’extension...
|
||||||
|
L’extension a bien été mise à jour.
|
||||||
|
Success: Updated 1 of 1 plugins.
|
||||||
|
+---------+-------------+-------------+---------+
|
||||||
|
| name | old_version | new_version | status |
|
||||||
|
+---------+-------------+-------------+---------+
|
||||||
|
| jetpack | 6.3.3 | 6.4.2 | Updated |
|
||||||
|
+---------+-------------+-------------+---------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Mettre-à-jour tous les plugins:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin update --all
|
||||||
|
$ wp plugin update --all --exclude=akismet
|
||||||
|
|
||||||
|
# mode quiet
|
||||||
|
$ wp plugin update --all --quiet > /dev/null 2>&1
|
||||||
|
```
|
||||||
|
|
||||||
|
Désactiver un plugin:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin deactivate <Plugin_Name>
|
||||||
|
```
|
||||||
|
|
||||||
|
Désactiver tous les plugins:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin deactivate --all
|
||||||
|
```
|
||||||
|
|
||||||
|
Désactiver puis dé-installer un plugin:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin deactivate <Plugin_Name> --uninstall
|
||||||
|
```
|
||||||
|
|
||||||
|
Dé-installer un plugin:
|
||||||
|
Par défaut, seuls les plugins désactivés peuvent être dé-installer.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin uninstall <Plugin_Name>
|
||||||
|
```
|
||||||
|
|
||||||
|
Désactive puis désinstalle un plugin:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin uninstall <Plugin_Name> --deactivate
|
||||||
|
```
|
||||||
|
|
||||||
|
Supprimer un plugin:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin delete <Plugin_Name>
|
||||||
|
```
|
||||||
|
|
||||||
|
Supprimer les plugins inactifs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp plugin delete $(wp plugin list --status=inactive --field=name)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
240
docs/Divers/wp-cli/wp_post.md
Normal file
240
docs/Divers/wp-cli/wp_post.md
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
# wp post
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help post
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp post
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Manages posts, content, and meta.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp post <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
create Creates a new post.
|
||||||
|
delete Deletes an existing post.
|
||||||
|
edit Launches system editor to edit post content.
|
||||||
|
generate Generates some posts.
|
||||||
|
get Gets details about a post.
|
||||||
|
list Gets a list of posts.
|
||||||
|
meta Adds, updates, deletes, and lists post custom fields.
|
||||||
|
term Adds, updates, removes, and lists post terms.
|
||||||
|
update Updates one or more existing posts.
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des posts:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post list
|
||||||
|
+-----+---------------------------------+-----------------------+---------------------+-------------+
|
||||||
|
| ID | post_title | post_name | post_date | post_status |
|
||||||
|
+-----+---------------------------------+-----------------------+---------------------+-------------+
|
||||||
|
| 184 | Welcome to the Gutenberg Editor | | 2018-08-03 13:55:41 | draft |
|
||||||
|
| 159 | zenphoto | zenphoto-3 | 2018-02-02 09:14:55 | publish |
|
||||||
|
| 154 | zenphoto | zenphoto-2 | 2018-02-02 09:12:51 | publish |
|
||||||
|
| 111 | Image en ligne | image-en-ligne | 2017-02-16 12:31:56 | publish |
|
||||||
|
| 106 | Flickr | flickr | 2017-02-15 18:58:02 | publish |
|
||||||
|
| 81 | WP - ZP | wp-zp | 2017-02-03 16:25:12 | publish |
|
||||||
|
| 78 | zen geo | zen-geo | 2017-02-02 06:28:45 | publish |
|
||||||
|
| 66 | Geo data | geo-data | 2017-01-31 14:02:20 | publish |
|
||||||
|
| 54 | Zenphoto | zenphoto | 2017-01-29 19:55:47 | publish |
|
||||||
|
| 27 | Bihoreau | bihoreau | 2017-01-29 17:23:20 | publish |
|
||||||
|
| 22 | Brame | brame | 2017-01-29 17:17:07 | publish |
|
||||||
|
| 9 | Bol d'Or Classic 2014 | bol-dor-classic-2014 | 2017-01-29 09:56:51 | publish |
|
||||||
|
| 1 | Bonjour tout le monde ! | bonjour-tout-le-monde | 2017-01-29 09:19:42 | publish |
|
||||||
|
+-----+---------------------------------+-----------------------+---------------------+-------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des posts (<u>status brouillon</u>):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post list --post_status=draft
|
||||||
|
+-----+---------------------------------+-----------+---------------------+-------------+
|
||||||
|
| ID | post_title | post_name | post_date | post_status |
|
||||||
|
+-----+---------------------------------+-----------+---------------------+-------------+
|
||||||
|
| 184 | Welcome to the Gutenberg Editor | | 2018-08-03 13:55:41 | draft |
|
||||||
|
+-----+---------------------------------+-----------+---------------------+-------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des pages:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post list --post_type=page
|
||||||
|
+-----+---------------------------------+---------------------+---------------------+-------------+
|
||||||
|
| ID | post_title | post_name | post_date | post_status |
|
||||||
|
+-----+---------------------------------+---------------------+---------------------+-------------+
|
||||||
|
| 186 | My test post | my-test-post | 2018-08-11 19:53:45 | publish |
|
||||||
|
| 136 | Map | map | 2017-02-21 09:55:17 | publish |
|
||||||
|
| 57 | Livre d'Or | livre-dor | 2017-01-29 20:18:16 | publish |
|
||||||
|
| 48 | License des photos | license-des-photos | 2017-01-29 18:35:44 | publish |
|
||||||
|
| 46 | Liens | liens | 2017-01-29 18:33:58 | publish |
|
||||||
|
| 39 | Ce mois-ci | ce-mois-ci | 2017-01-29 18:27:49 | publish |
|
||||||
|
| 37 | Contact | contact | 2017-01-29 18:22:58 | publish |
|
||||||
|
| 6 | Newsletter Sign Up Confirmation | nl-confirm-signup | 2017-01-29 09:36:46 | publish |
|
||||||
|
| 7 | Newsletter Unsubscription | nl-unsubscribe-page | 2017-01-29 09:36:46 | publish |
|
||||||
|
| 4 | Accueil | accueil | 2017-01-29 09:27:58 | publish |
|
||||||
|
| 2 | Page d’exemple | page-d-exemple | 2017-01-29 09:19:42 | publish |
|
||||||
|
+-----+---------------------------------+---------------------+---------------------+-------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des posts **ET** pages:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post list --post_type=page,post --fields=ID,post_title,post_name,post_date,post_status,post_type
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post list --post_type=page,post --fields=ID,post_title,post_name,post_status,post_type
|
||||||
|
+-----+---------------------------------+----------------------+-------------+-----------+
|
||||||
|
| ID | post_title | post_name | post_status | post_type |
|
||||||
|
+-----+---------------------------------+----------------------+-------------+-----------+
|
||||||
|
| 211 | Article 23 | post-23 | publish | post |
|
||||||
|
| 208 | Article 20 | post-20 | publish | post |
|
||||||
|
| 209 | Article 21 | post-21 | publish | post |
|
||||||
|
| 186 | My test post | my-test-post | publish | page |
|
||||||
|
| 184 | Welcome to the Gutenberg Editor | | draft | post |
|
||||||
|
| 159 | zenphoto | zenphoto-3 | publish | post |
|
||||||
|
| 154 | zenphoto | zenphoto-2 | publish | post |
|
||||||
|
| 136 | Map | map | publish | page |
|
||||||
|
| 111 | Image en ligne | image-en-ligne | publish | post |
|
||||||
|
| 106 | Flickr | flickr | publish | post |
|
||||||
|
| 81 | WP - ZP | wp-zp | publish | post |
|
||||||
|
| 78 | zen geo | zen-geo | publish | post |
|
||||||
|
| 66 | Geo data | geo-data | publish | post |
|
||||||
|
| 57 | Livre d'Or | livre-dor | publish | page |
|
||||||
|
| 54 | Zenphoto | zenphoto | publish | post |
|
||||||
|
| 48 | License des photos | license-des-photos | publish | page |
|
||||||
|
| 46 | Liens | liens | publish | page |
|
||||||
|
| 39 | Ce mois-ci | ce-mois-ci | publish | page |
|
||||||
|
| 37 | Contact | contact | publish | page |
|
||||||
|
| 27 | Bihoreau | bihoreau | publish | post |
|
||||||
|
| 22 | Brame | brame | publish | post |
|
||||||
|
| 9 | Bol d'Or Classic 2014 | bol-dor-classic-2014 | publish | post |
|
||||||
|
| 6 | Newsletter Sign Up Confirmation | nl-confirm-signup | publish | page |
|
||||||
|
| 7 | Newsletter Unsubscription | nl-unsubscribe-page | publish | page |
|
||||||
|
| 4 | Accueil | accueil | publish | page |
|
||||||
|
| 1 | Bonjour tout le monde ! | bonjour-tout-le-monde| publish | post |
|
||||||
|
| 2 | Page d’exemple | page-d-exemple | publish | page |
|
||||||
|
+-----+---------------------------------+----------------------+-------------+-----------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un post:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post create --post_type=page --post_status=publish --post_title='My test post' --post_content='This is a test post'
|
||||||
|
Success: Created post 186.
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post create --post_title='Just a Post' --post_content='I wandered lonely as a cloud.' --post_status='publish'
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un post dont l'auteur est Bob (ID2):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post create --post_author=2 --post_status=publish --post_title='The Bob post' --post_content='This is a test post'
|
||||||
|
Success: Created post 213.
|
||||||
|
```
|
||||||
|
|
||||||
|
Supprimer un post:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post delete 187
|
||||||
|
Success: Trashed post 187.
|
||||||
|
```
|
||||||
|
|
||||||
|
Générer des posts:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post generate --count=3
|
||||||
|
Generating posts 100% [================================================================================================] 0:01 / 0:02
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post list
|
||||||
|
+-----+---------------------------------+-----------------------+---------------------+-------------+
|
||||||
|
| ID | post_title | post_name | post_date | post_status |
|
||||||
|
+-----+---------------------------------+-----------------------+---------------------+-------------+
|
||||||
|
| 189 | Article 13 | post-13 | 2018-08-11 20:28:12 | future |
|
||||||
|
| 190 | Article 14 | post-14 | 2018-08-11 20:28:12 | future |
|
||||||
|
| 191 | Article 15 | post-15 | 2018-08-11 20:28:12 | future |
|
||||||
|
| 184 | Welcome to the Gutenberg Editor | | 2018-08-03 13:55:41 | draft |
|
||||||
|
```
|
||||||
|
|
||||||
|
Générer des posts avec du dummy-text:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ curl http://loripsum.net/api/4 | wp post generate --post_content --count=3
|
||||||
|
% Total % Received % Xferd Average Speed Time Time Time Current
|
||||||
|
Dload Upload Total Spent Left Speed
|
||||||
|
100 1991 0 1991 0 0 326 0 --:--:-- 0:00:06 --:--:-- 326
|
||||||
|
Generating posts 100% [===========================================] 0:00 / 0:00
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post list
|
||||||
|
+-----+---------------------------------+-----------------------+---------------------+-------------+
|
||||||
|
| ID | post_title | post_name | post_date | post_status |
|
||||||
|
+-----+---------------------------------+-----------------------+---------------------+-------------+
|
||||||
|
| 208 | Article 20 | post-20 | 2018-08-13 17:42:52 | future |
|
||||||
|
| 209 | Article 21 | post-21 | 2018-08-13 17:42:52 | future |
|
||||||
|
| 210 | Article 22 | post-22 | 2018-08-13 17:42:52 | future |
|
||||||
|
```
|
||||||
|
|
||||||
|
Générer des pages:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post generate --post_type=page --count=3
|
||||||
|
Generating posts 100% [================================================================================================] 0:00 / 0:00
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post list --post_type=page
|
||||||
|
+-----+---------------------------------+---------------------+---------------------+-------------+
|
||||||
|
| ID | post_title | post_name | post_date | post_status |
|
||||||
|
+-----+---------------------------------+---------------------+---------------------+-------------+
|
||||||
|
| 201 | Page 12 | post-12 | 2018-08-11 20:37:31 | future |
|
||||||
|
| 202 | Page 13 | post-13 | 2018-08-11 20:37:31 | future |
|
||||||
|
| 203 | Page 14 | post-14 | 2018-08-11 20:37:31 | future |
|
||||||
|
| 186 | My test post | my-test-post | 2018-08-11 19:53:45 | publish |
|
||||||
|
| 136 | Map | map | 2017-02-21 09:55:17 | publish |
|
||||||
|
| 57 | Livre d'Or | livre-dor | 2017-01-29 20:18:16 | publish |
|
||||||
|
| 48 | License des photos | license-des-photos | 2017-01-29 18:35:44 | publish |
|
||||||
|
| 46 | Liens | liens | 2017-01-29 18:33:58 | publish |
|
||||||
|
| 39 | Ce mois-ci | ce-mois-ci | 2017-01-29 18:27:49 | publish |
|
||||||
|
| 37 | Contact | contact | 2017-01-29 18:22:58 | publish |
|
||||||
|
| 6 | Newsletter Sign Up Confirmation | nl-confirm-signup | 2017-01-29 09:36:46 | publish |
|
||||||
|
| 7 | Newsletter Unsubscription | nl-unsubscribe-page | 2017-01-29 09:36:46 | publish |
|
||||||
|
| 4 | Accueil | accueil | 2017-01-29 09:27:58 | publish |
|
||||||
|
| 2 | Page d’exemple | page-d-exemple | 2017-01-29 09:19:42 | publish |
|
||||||
|
+-----+---------------------------------+---------------------+---------------------+-------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Générer un post avec un prompt:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp post generate --prompt
|
||||||
|
1/10 [--count=<number>]: 1
|
||||||
|
2/10 [--post_type=<type>]:
|
||||||
|
3/10 [--post_status=<status>]:
|
||||||
|
4/10 [--post_title=<post_title>]:
|
||||||
|
5/10 [--post_author=<login>]:
|
||||||
|
6/10 [--post_date=<yyyy-mm-dd-hh-ii-ss>]:
|
||||||
|
7/10 [--post_date_gmt=<yyyy-mm-dd-hh-ii-ss>]:
|
||||||
|
8/10 [--post_content] (Y/n):
|
||||||
|
9/10 [--max_depth=<number>]:
|
||||||
|
10/10 [--format=<format>]:
|
||||||
|
Generating posts 100% [================================================================================================] 0:00 / 0:00
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
53
docs/Divers/wp-cli/wp_revisions.md
Normal file
53
docs/Divers/wp-cli/wp_revisions.md
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# wp revisions
|
||||||
|
|
||||||
|
Cette commande nécessite l'installation du package [trepmal/wp-revisions-cli](https://github.com/trepmal/wp-revisions-cli)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp package install trepmal/wp-revisions-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help revisions
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp revisions
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Manage revisions
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp revisions <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
clean Delete old revisions
|
||||||
|
dump Delete all revisions
|
||||||
|
generate Generate revisions
|
||||||
|
list List all revisions
|
||||||
|
status Get revision status
|
||||||
|
```
|
||||||
|
|
||||||
|
Garder seulement les <keep> plus récentes révisions:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp revisions clean 3
|
||||||
|
Cleaning revisions for 39 post(s) 100% [===============================================================================] 0:00 / 0:00
|
||||||
|
Success: Finished removing 2 old revisions.
|
||||||
|
```
|
||||||
|
|
||||||
|
Valeur de WP_POST_REVISIONS:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp revisions status
|
||||||
|
Success: Keeping the last 3 revisions
|
||||||
|
```
|
||||||
|
|
||||||
67
docs/Divers/wp-cli/wp_scaffold.md
Normal file
67
docs/Divers/wp-cli/wp_scaffold.md
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# wp scaffold
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help scaffold
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp scaffold
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Generates code for post types, taxonomies, plugins, child themes, etc.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp scaffold <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
_s Generates starter code for a theme based on _s.
|
||||||
|
block Generates PHP, JS and CSS code for registering a Gutenberg block for a plugin or theme.
|
||||||
|
child-theme Generates child theme based on an existing theme.
|
||||||
|
plugin Generates starter code for a plugin.
|
||||||
|
plugin-tests Generates files needed for running PHPUnit tests in a plugin.
|
||||||
|
post-type Generates PHP code for registering a custom post type.
|
||||||
|
taxonomy Generates PHP code for registering a custom taxonomy.
|
||||||
|
theme-tests Generates files needed for running PHPUnit tests in a theme.
|
||||||
|
```
|
||||||
|
|
||||||
|
Create your [underscores](https://underscores.me) based theme:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp scaffold _s myNewTheme
|
||||||
|
Success: Created theme 'MyNewTheme'
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un child-theme:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp scaffold child-theme tw17-clone --parent_theme=twentyseventeen --theme_name="TW17 Clone"
|
||||||
|
Success: Created '/Users/bruno/Sites/wordpress/wp-content/themes/tw17-clone'.
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp scaffold child-theme tw17-clone --parent_theme=twentyseventeen --theme_name="TW17 Clone" --author=FULL-NAME --author_uri=URI --theme_uri=URI --activate --force
|
||||||
|
Success: Created '/Users/bruno/Sites/wordpress/wp-content/themes/tw17-clone'.
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un nouveau plugin avec unit tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp scaffold plugin sample-plugin
|
||||||
|
Success: Created plugin files.
|
||||||
|
Success: Created test files.
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un nouveau plugin sans unit tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp scaffold plugin sample-plugin --skip-tests
|
||||||
|
Success: Created plugin files.
|
||||||
|
```
|
||||||
|
|
||||||
93
docs/Divers/wp-cli/wp_search-replace.md
Normal file
93
docs/Divers/wp-cli/wp_search-replace.md
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
# wp search-replace
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help search-replace
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp search-replace
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Searches/replaces strings in the database.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp search-replace <old> <new> [<table>...][--dry-run] [--network][--all-tables-with-prefix] [--all-tables][--export[=]]
|
||||||
|
[--export_insert_size=<rows>][--skip-tables=] [--skip-columns=<columns>][--include-columns=] [--precise]
|
||||||
|
[--recurse-objects][--verbose] [--regex][--regex-flags=] [--regex-delimiter=<regex-delimiter>]
|
||||||
|
[--regex-limit=<regex-limit>][--format=] [--report][--report-changed-only] [--log[=<file>]][--before_context=]
|
||||||
|
[--after_context=<num>]
|
||||||
|
```
|
||||||
|
|
||||||
|
Chercher/remplacer dans la bdd:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp search-replace 'moto' 'auto' --dry-run --skip-columns=guid
|
||||||
|
+--------------------+-----------------------+--------------+------+
|
||||||
|
| Table | Column | Replacements | Type |
|
||||||
|
+--------------------+-----------------------+--------------+------+
|
||||||
|
| wp_commentmeta | meta_key | 0 | SQL |
|
||||||
|
| wp_commentmeta | meta_value | 0 | SQL |
|
||||||
|
| wp_comments | comment_author | 0 | SQL |
|
||||||
|
| wp_comments | comment_author_email | 0 | SQL |
|
||||||
|
| wp_comments | comment_author_url | 0 | SQL |
|
||||||
|
| wp_comments | comment_author_IP | 0 | SQL |
|
||||||
|
| wp_comments | comment_content | 0 | SQL |
|
||||||
|
| wp_comments | comment_approved | 0 | SQL |
|
||||||
|
| wp_comments | comment_agent | 0 | SQL |
|
||||||
|
| wp_comments | comment_type | 0 | SQL |
|
||||||
|
| wp_links | link_url | 0 | SQL |
|
||||||
|
| wp_links | link_name | 0 | SQL |
|
||||||
|
| wp_links | link_image | 0 | SQL |
|
||||||
|
| wp_links | link_target | 0 | SQL |
|
||||||
|
| wp_links | link_description | 0 | SQL |
|
||||||
|
| wp_links | link_visible | 0 | SQL |
|
||||||
|
| wp_links | link_rel | 0 | SQL |
|
||||||
|
| wp_links | link_notes | 0 | SQL |
|
||||||
|
| wp_links | link_rss | 0 | SQL |
|
||||||
|
| wp_options | option_name | 0 | SQL |
|
||||||
|
| wp_options | option_value | 0 | PHP |
|
||||||
|
| wp_options | autoload | 0 | SQL |
|
||||||
|
| wp_postmeta | meta_key | 0 | SQL |
|
||||||
|
| wp_postmeta | meta_value | 0 | PHP |
|
||||||
|
| wp_posts | post_content | 0 | SQL |
|
||||||
|
| wp_posts | post_title | 0 | SQL |
|
||||||
|
| wp_posts | post_excerpt | 0 | SQL |
|
||||||
|
| wp_posts | post_status | 0 | SQL |
|
||||||
|
| wp_posts | comment_status | 0 | SQL |
|
||||||
|
| wp_posts | ping_status | 0 | SQL |
|
||||||
|
| wp_posts | post_password | 0 | SQL |
|
||||||
|
| wp_posts | post_name | 0 | SQL |
|
||||||
|
| wp_posts | to_ping | 0 | SQL |
|
||||||
|
| wp_posts | pinged | 0 | SQL |
|
||||||
|
| wp_posts | post_content_filtered | 0 | SQL |
|
||||||
|
| wp_posts | post_type | 0 | SQL |
|
||||||
|
| wp_posts | post_mime_type | 0 | SQL |
|
||||||
|
| wp_term_taxonomy | taxonomy | 0 | SQL |
|
||||||
|
| wp_term_taxonomy | description | 0 | SQL |
|
||||||
|
| wp_termmeta | meta_key | 0 | SQL |
|
||||||
|
| wp_termmeta | meta_value | 0 | SQL |
|
||||||
|
| wp_terms | name | 1 | SQL |
|
||||||
|
| wp_terms | slug | 2 | SQL |
|
||||||
|
| wp_usermeta | meta_key | 0 | SQL |
|
||||||
|
| wp_usermeta | meta_value | 0 | PHP |
|
||||||
|
| wp_users | user_login | 0 | SQL |
|
||||||
|
| wp_users | user_nicename | 0 | SQL |
|
||||||
|
| wp_users | user_email | 0 | SQL |
|
||||||
|
| wp_users | user_url | 0 | SQL |
|
||||||
|
| wp_users | user_activation_key | 0 | SQL |
|
||||||
|
| wp_users | display_name | 0 | SQL |
|
||||||
|
| wp_yoast_seo_links | url | 0 | SQL |
|
||||||
|
| wp_yoast_seo_links | type | 0 | SQL |
|
||||||
|
+--------------------+-----------------------+--------------+------+
|
||||||
|
Success: 3 replacements to be made.
|
||||||
|
```
|
||||||
|
|
||||||
|
Pour chercher dans toutes les tables (également celles des plug-ins): `--all-tables`
|
||||||
|
Pour simuler: `--dry-run`
|
||||||
|
Pour créer un dump des modfications: `--export=/tmp/staging.sql`
|
||||||
52
docs/Divers/wp-cli/wp_site.md
Normal file
52
docs/Divers/wp-cli/wp_site.md
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# wp site
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help site
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp site
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Creates, deletes, empties, moderates, and lists one or more sites on a multisite installation.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp site <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
activate Activates one or more sites.
|
||||||
|
archive Archives one or more sites.
|
||||||
|
create Creates a site in a multisite installation.
|
||||||
|
deactivate Deactivates one or more sites.
|
||||||
|
delete Deletes a site in a multisite installation.
|
||||||
|
empty Empties a site of its content (posts, comments, terms, and meta).
|
||||||
|
list Lists all sites in a multisite installation.
|
||||||
|
mature Sets one or more sites as mature.
|
||||||
|
meta Adds, updates, deletes, and lists site custom fields.
|
||||||
|
option Adds, updates, deletes, and lists site options in a multisite installation.
|
||||||
|
private Sets one or more sites as private.
|
||||||
|
public Sets one or more sites as public.
|
||||||
|
spam Marks one or more sites as spam.
|
||||||
|
switch-language Activates a given language.
|
||||||
|
unarchive Unarchives one or more sites.
|
||||||
|
unmature Sets one or more sites as immature.
|
||||||
|
unspam Removes one or more sites from spam.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Vider un site (posts, comments, terms, et meta):
|
||||||
|
```bash
|
||||||
|
$ wp site empty
|
||||||
|
|
||||||
|
# également le dossier /uploads
|
||||||
|
$ wp site empty --uploads
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
10
docs/Divers/wp-cli/wp_theme.md
Normal file
10
docs/Divers/wp-cli/wp_theme.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# wp theme
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help theme
|
||||||
|
```
|
||||||
|
|
||||||
78
docs/Divers/wp-cli/wp_user.md
Normal file
78
docs/Divers/wp-cli/wp_user.md
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# wp user
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help user
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp user
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Manages users, along with their roles, capabilities, and meta.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp user <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
add-cap Adds a capability to a user.
|
||||||
|
add-role Adds a role for a user.
|
||||||
|
check-password Checks if a user's password is valid or not.
|
||||||
|
create Creates a new user.
|
||||||
|
delete Deletes one or more users from the current site.
|
||||||
|
generate Generates some users.
|
||||||
|
get Gets details about a user.
|
||||||
|
import-csv Imports users from a CSV file.
|
||||||
|
list Lists users.
|
||||||
|
list-caps Lists all capabilities for a user.
|
||||||
|
meta Adds, updates, deletes, and lists user custom fields.
|
||||||
|
remove-cap Removes a user's capability.
|
||||||
|
remove-role Removes a user's role.
|
||||||
|
reset-password Resets the password for one or more users.
|
||||||
|
session Destroys and lists a user's sessions.
|
||||||
|
set-role Sets the user role.
|
||||||
|
spam Marks one or more users as spam.
|
||||||
|
term Adds, updates, removes, and lists user terms.
|
||||||
|
unspam Removes one or more users from spam.
|
||||||
|
update Updates an existing user.
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des utilisateurs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp user list
|
||||||
|
+----+-----------+-------------+--------------------+---------------------+--------------+
|
||||||
|
| ID | user_login| display_name| user_email | user_registered | roles
|
||||||
|
+----+-----------+-------------+--------------------+---------------------+--------------+
|
||||||
|
| 2 | bob | bob | bob@example.com | 2018-08-14 15:23:33 | author |
|
||||||
|
| 1 | bruno | bruno | bruno@clicclac.info| 2017-01-29 08:19:42 | administrator|
|
||||||
|
+----+-----------+-------------+--------------------+---------------------+--------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
Reset mot-de-passe utilisateur:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp user update adminuser@example.com --user_pass=new-password-example
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un nouvel utilisateur:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp user create bob bob@example.com --role=author
|
||||||
|
Success: Created user 2.
|
||||||
|
Password: 7*P%v1he5ogauZw8eyhxXU)d
|
||||||
|
```
|
||||||
|
|
||||||
|
Supprimer l'utilisateur ID2 (et réaffecter ses posts à un autre utilisateur ID1)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp user delete 2 --reassign=1
|
||||||
|
Success: Removed user 2 from http://silverbook.local/wordpress.
|
||||||
|
```
|
||||||
|
|
||||||
BIN
docs/Linux/.DS_Store
vendored
Normal file
BIN
docs/Linux/.DS_Store
vendored
Normal file
Binary file not shown.
8
docs/Linux/Editeurs/index.md
Normal file
8
docs/Linux/Editeurs/index.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Editeurs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[nano](nano.md)
|
||||||
|
|
||||||
|
[vi](vi.md)
|
||||||
|
|
||||||
161
docs/Linux/Editeurs/nano.md
Normal file
161
docs/Linux/Editeurs/nano.md
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
# Editeurs
|
||||||
|
|
||||||
|
[ss64.com](http://ss64.com/vi.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Nano ([https://www.nano-editor.org/](https://www.nano-editor.org/))
|
||||||
|
|
||||||
|
CTRL + A : Permet d'aller au début de la ligne
|
||||||
|
|
||||||
|
CTRL + E : Permet d'aller à la fin de la ligne
|
||||||
|
|
||||||
|
CTRL + Y : Permet de remonter de page en page
|
||||||
|
|
||||||
|
CTRL + V : Permet de descendre de page en page
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CTRL + _ : Permet de se rendre au n° de ligne indiqué
|
||||||
|
|
||||||
|
CTRL + C : Permet de savoir à quel n° de ligne / colonne / caractère se trouve votre curseur
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CTRL + W : Permet de faire une [recherche](https://korben.info/recherche-2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CTRL + D : Permet de supprimer le caractère sous le curseur
|
||||||
|
|
||||||
|
Meta - T : Coupe le texte depuis le curseur jusqu'à la fin du fichier
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CTRL + K : Permet de supprimer une ligne complète (comme la commande dd sous Vi)
|
||||||
|
|
||||||
|
CTRL + U : Coller
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CTRL + O : Permet de sauvegarder votre fichier
|
||||||
|
|
||||||
|
CTRL + X : Permet de quitter nano
|
||||||
|
|
||||||
|
CTRL + G : Affiche l'aide
|
||||||
|
|
||||||
|
Meta - X : Masquer / afficher l'aide-mémoire
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CTRL + P : déplace le curseur vers le haut
|
||||||
|
|
||||||
|
CTRL + N : déplace le curseur vers le bas
|
||||||
|
|
||||||
|
CTRL + F : déplace le curseur vers la droite
|
||||||
|
|
||||||
|
CTRL + B : déplace le curseur vers la gauche
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CTRL + Space : se déplace d'un mot en avant
|
||||||
|
|
||||||
|
Meta - Space : se déplace d'un mot en arrière
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Meta - ( : saute au début du paragraphe
|
||||||
|
|
||||||
|
Meta - ) : saute à la fin du paragraphe
|
||||||
|
|
||||||
|
Meta - \ : saute au début du fichier
|
||||||
|
|
||||||
|
Meta - / : saute à la fin du fichier
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Meta - U : annuler
|
||||||
|
|
||||||
|
Meta - E : redo
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Meta - A : marquer (début)
|
||||||
|
|
||||||
|
Meta - 6 (shift) : copier
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Meta - flèche haut : précédent
|
||||||
|
|
||||||
|
Meta - flèche bas : suivant
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CTRL + B : en arrière
|
||||||
|
|
||||||
|
CTRL + F : en avant
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CTRL + J : Justifier
|
||||||
|
|
||||||
|
CTRL + T : correcteur orthographique
|
||||||
|
|
||||||
|
CTRL + _ : aller à la ligne xx
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*CTRL + \ : Remplacer**
|
||||||
|
|
||||||
|
**Meta - ] : Parenthèse*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Meta sur macOS: ESC puis <touche>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Copier / couper / coller sous nano
|
||||||
|
|
||||||
|
Se placer devant la ligne:
|
||||||
|
|
||||||
|
CTRL + K pour couper la ligne courante
|
||||||
|
|
||||||
|
CTRL + U pour la recoller
|
||||||
|
|
||||||
|
puis
|
||||||
|
|
||||||
|
CTRL + U pour la coller ailleurs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Pour sélectionner plusieurs lignes:
|
||||||
|
|
||||||
|
Placer une marque:
|
||||||
|
|
||||||
|
CTRL + ^ (ou Meta - A)
|
||||||
|
|
||||||
|
et se déplacer avec les flèches pour surligner le texte.
|
||||||
|
|
||||||
|
puis
|
||||||
|
|
||||||
|
CTRL + K pour couper le bloc
|
||||||
|
|
||||||
|
Meta - ^ pour copier le bloc
|
||||||
|
|
||||||
|
puis
|
||||||
|
|
||||||
|
CTRL + U pour le coller
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Recherche
|
||||||
|
|
||||||
|
CTRL + W <recherche>
|
||||||
|
|
||||||
|
Occurence suivante:
|
||||||
|
|
||||||
|
CTRL + W puis Retour
|
||||||
|
|
||||||
|
CTRL + C pour sortir du mode recherche
|
||||||
48
docs/Linux/Editeurs/vi.md
Normal file
48
docs/Linux/Editeurs/vi.md
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# vi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://ss64.com/vi.html
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
(c) [ss64.com](https://ss64.com/vi.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Au lancement, vi est en **mode commande**.
|
||||||
|
|
||||||
|
- ***:w*** sauver les changements dans le buffer
|
||||||
|
- ***ZZ*** ou ***:wp*** sauver les changements et quitter vi
|
||||||
|
- ***:q!*** quitter sans sauver
|
||||||
|
- ***:w file*** sauver dans un nouveau fichier
|
||||||
|
- ***:10,15w* file** sauver les lignes dans un nouveau fichier
|
||||||
|
- ***:10,15w* file** sauver les lignes dans un nouveau fichier
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Pour passer en **mode insertion**, taper:
|
||||||
|
|
||||||
|
- i
|
||||||
|
- I
|
||||||
|
- o
|
||||||
|
- O
|
||||||
|
- a
|
||||||
|
- A
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Pour repasser en **mode commande**, taper *ESC*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BIN
docs/Linux/Editeurs/vimodes.png
Normal file
BIN
docs/Linux/Editeurs/vimodes.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
299
docs/Linux/archiver.md
Normal file
299
docs/Linux/archiver.md
Normal file
@@ -0,0 +1,299 @@
|
|||||||
|
# Archiver et compresser
|
||||||
|
|
||||||
|
#### tar
|
||||||
|
|
||||||
|
Créer une archive tar: **tar -cvf**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DiskStation:~ # tar -cvf archive.tar .profile .bashrc test-dossier/
|
||||||
|
```
|
||||||
|
|
||||||
|
Afficher le contenu de l'archive sans l'extraire: **tar -tf**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DiskStation:~ # tar -tf archive.tar
|
||||||
|
.profile
|
||||||
|
.bashrc
|
||||||
|
test-dossier/
|
||||||
|
test-dossier/test-copy-scp.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Ajouter un fichier à l'archive: **tar -rvf**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DiskStation:~ # tar -rvf archive.tar .bash_history
|
||||||
|
|
||||||
|
root@DiskStation:~ # tar -tf archive.tar
|
||||||
|
.profile
|
||||||
|
.bashrc
|
||||||
|
test-dossier/
|
||||||
|
test-dossier/test-copy-scp.txt
|
||||||
|
.bash_history
|
||||||
|
```
|
||||||
|
|
||||||
|
Extraire les fichiers de l'archive: **tar -xvf**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DiskStation:~ # tar -xvf archive.tar
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### gzip
|
||||||
|
|
||||||
|
Compresser avec gzip:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DiskStation:~ # gzip archive.tar
|
||||||
|
|
||||||
|
root@DiskStation:~ # ls
|
||||||
|
archive.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
Decompresser avec gunzip:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DiskStation:~ # gunzip archive.tar.gz
|
||||||
|
|
||||||
|
root@DiskStation:~ # ls
|
||||||
|
archive.tar
|
||||||
|
```
|
||||||
|
|
||||||
|
Voir le contenu de l'archive avec zcat:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### bzip2
|
||||||
|
|
||||||
|
Compresser avec bzip2:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DiskStation:~ # bzip2 archive.tar
|
||||||
|
|
||||||
|
root@DiskStation:~ # ls
|
||||||
|
archive.tar.bz2
|
||||||
|
```
|
||||||
|
|
||||||
|
Decompresser avec bunzip2:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DiskStation:~ # bunzip2 archive.tar.bz2
|
||||||
|
|
||||||
|
root@DiskStation:~ # ls archive.tar
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### zip
|
||||||
|
|
||||||
|
Compresser avec zip:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ zip -r scripts.zip scripts/
|
||||||
|
adding: scripts/ (stored 0%)
|
||||||
|
adding: scripts/@eaDir/ (stored 0%)
|
||||||
|
adding: scripts/@eaDir/ffmpeg@SynoResource (deflated 84%)
|
||||||
|
adding: scripts/@eaDir/ffmpeg@SynoEAStream (deflated 35%)
|
||||||
|
adding: scripts/ffmpeg (deflated 64%)
|
||||||
|
adding: scripts/ffmpeg-convertMP4v3.sh (deflated 50%)
|
||||||
|
adding: scripts/running3.sh (deflated 48%)
|
||||||
|
adding: scripts/ffmpeg-convertMP4v4.sh (deflated 49%)
|
||||||
|
adding: scripts/ffmpeg-convertMP4v5.sh (deflated 56%)
|
||||||
|
```
|
||||||
|
|
||||||
|
Exclure les fichiers ressources invisibles (“*MACOSX” “.*Filename” “.ds store”):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ zip -r -X scripts.zip scripts/
|
||||||
|
```
|
||||||
|
|
||||||
|
Décompresser avec zip:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~/test $ unzip scripts.zip
|
||||||
|
Archive: scripts.zip
|
||||||
|
creating: scripts/
|
||||||
|
creating: scripts/@eaDir/
|
||||||
|
inflating: scripts/@eaDir/ffmpeg@SynoResource
|
||||||
|
inflating: scripts/@eaDir/ffmpeg@SynoEAStream
|
||||||
|
inflating: scripts/ffmpeg
|
||||||
|
inflating: scripts/ffmpeg-convertMP4v3.sh
|
||||||
|
inflating: scripts/running3.sh
|
||||||
|
inflating: scripts/ffmpeg-convertMP4v4.sh
|
||||||
|
inflating: scripts/ffmpeg-convertMP4v5.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### dmg (macOS)
|
||||||
|
|
||||||
|
Créer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~$ hdiutil create -format UDZO -srcfolder hubiC/ hubic.dmg
|
||||||
|
.........
|
||||||
|
created: /Users/bruno/hubic.dmg
|
||||||
|
```
|
||||||
|
|
||||||
|
Différents formats d'image:
|
||||||
|
|
||||||
|
- UDZO – Compressed image (default)
|
||||||
|
- UDRO – Read only image
|
||||||
|
- UDBZ – Better compressed image
|
||||||
|
- UDRW – Read/Write image
|
||||||
|
- UDTO – DVD disk image
|
||||||
|
|
||||||
|
Monter:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~$ hdiutil attach hubic.dmg
|
||||||
|
Calcul de la somme de contrôle de Protective Master Boot Record (MBR : 0)…
|
||||||
|
Protective Master Boot Record (MBR : : vérifiée CRC32 $DC586CEA
|
||||||
|
Calcul de la somme de contrôle de GPT Header (Primary GPT Header : 1)…
|
||||||
|
GPT Header (Primary GPT Header : 1) : vérifiée CRC32 $4EE88DC7
|
||||||
|
Calcul de la somme de contrôle de GPT Partition Data (Primary GPT Table : 2)…
|
||||||
|
GPT Partition Data (Primary GPT Tabl : vérifiée CRC32 $42D33ACB
|
||||||
|
Calcul de la somme de contrôle de (Apple_Free : 3)…
|
||||||
|
(Apple_Free : 3) : vérifiée CRC32 $00000000
|
||||||
|
Calcul de la somme de contrôle de disk image (Apple_HFS : 4)…
|
||||||
|
.........................................................................................................................
|
||||||
|
disk image (Apple_HFS : 4) : vérifiée CRC32 $D4406A43
|
||||||
|
Calcul de la somme de contrôle de (Apple_Free : 5)…
|
||||||
|
(Apple_Free : 5) : vérifiée CRC32 $00000000
|
||||||
|
Calcul de la somme de contrôle de GPT Partition Data (Backup GPT Table : 6)…
|
||||||
|
GPT Partition Data (Backup GPT Table : vérifiée CRC32 $42D33ACB
|
||||||
|
Calcul de la somme de contrôle de GPT Header (Backup GPT Header : 7)…
|
||||||
|
GPT Header (Backup GPT Header : 7) : vérifiée CRC32 $16D559B6
|
||||||
|
vérifiée CRC32 $BE421D06
|
||||||
|
/dev/disk3 GUID_partition_scheme
|
||||||
|
/dev/disk3s1 Apple_HFS /Volumes/hubiC
|
||||||
|
```
|
||||||
|
|
||||||
|
Voir:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~$ ls -lah /Volumes/hubiC/
|
||||||
|
total 8
|
||||||
|
drwxr-xr-x 11 bruno staff 442B 12 aoû 12:05 .
|
||||||
|
drwxr-xr-x@ 6 root wheel 204B 12 aoû 12:07 ..
|
||||||
|
drwxr-xr-x 2 bruno staff 68B 6 aoû 17:39 Documents
|
||||||
|
drwxr-xr-x 3 bruno staff 102B 6 aoû 17:39 HubiC
|
||||||
|
-rw-r--r-- 1 bruno staff 669B 6 aoû 17:39 HubiC readme.txt
|
||||||
|
drwxr-xr-x 2 bruno staff 68B 6 aoû 17:39 Images
|
||||||
|
drwxr-xr-x 2 bruno staff 68B 6 aoû 17:39 Videos
|
||||||
|
drwxr-xr-x 9 bruno staff 306B 6 aoû 17:39 scripts plex 0.9xx
|
||||||
|
drwxr-xr-x 9 bruno staff 306B 6 aoû 17:39 scripts plex 1.0xx
|
||||||
|
```
|
||||||
|
|
||||||
|
Ejecter:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~$ hdiutil eject /Volumes/hubiC/
|
||||||
|
"disk3" unmounted.
|
||||||
|
"disk3" ejected.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Archiver et compresser en même temps (gzip)
|
||||||
|
|
||||||
|
Archiver et compresser en gzip: **tar -zcvf**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DiskStation:~ # tar -zcvf archive.tar.gz .bashrc .profile test-dossier/
|
||||||
|
.bashrc
|
||||||
|
.profile
|
||||||
|
test-dossier/
|
||||||
|
test-dossier/test-copy-scp.txt
|
||||||
|
|
||||||
|
root@DiskStation:~ # ls
|
||||||
|
archive.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
Voir le contenu de l'archive gzip: **tar -ztf**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DiskStation:~ # tar -ztf archive.tar.bz2
|
||||||
|
```
|
||||||
|
|
||||||
|
Décompresser: **tar -xzvf**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DiskStation:~ # tar -xzvf archive.tar.gz
|
||||||
|
.bashrc
|
||||||
|
.profile
|
||||||
|
test-dossier/
|
||||||
|
test-dossier/test-copy-scp.txt
|
||||||
|
|
||||||
|
root@DiskStation:~ # ls -la
|
||||||
|
drwxr-xr-x 3 root root 4096 Aug 6 07:45 .
|
||||||
|
drwx—— 8 root root 4096 Aug 6 07:18 ..
|
||||||
|
-rw-r–r– 1 root root 953 Aug 5 11:04 .bashrc
|
||||||
|
-rw-r–r– 1 root root 497 Aug 5 10:15 .profile
|
||||||
|
-rw-r–r– 1 root root 925 Aug 6 07:42 archive.tar.gz
|
||||||
|
drwxr-xr-x 2 root root 4096 Aug 6 07:04 test-dossier
|
||||||
|
|
||||||
|
# décompresser dans un dossier cible
|
||||||
|
root@DiskStation:~ # tar -xzvf archive.tar.gz -C /tmp/
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Archiver et compresser en même temps (bz2)
|
||||||
|
|
||||||
|
Décompresser: **tar -xf (+ v pour mode verbose)**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DS916:/volume1/web/_archives# tar -xf nextcloud-11.0.2.tar.bz2
|
||||||
|
root@DS916:/volume1/web/_archives# ls -la
|
||||||
|
|
||||||
|
total 137156
|
||||||
|
|
||||||
|
d---------+ 1 root root 308 Apr 15 16:58 .
|
||||||
|
d---------+ 1 root root 306 Apr 15 16:57 ..
|
||||||
|
----------+ 1 bruno users 3045723 Oct 20 07:07 gitlist-0.5.0.tar.gz
|
||||||
|
drwxr-xr-x 1 nobody 65534 414 Feb 26 20:44 nextcloud
|
||||||
|
----------+ 1 bruno users 38598274 Apr 15 09:48 nextcloud-11.0.2.tar.bz2
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Extraire un seul fichier d'une archive tar.gz
|
||||||
|
|
||||||
|
Extrait le fichier README de l'archive automysqlbackup-v3.0_rc6.tar.gz
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~/Downloads$ tar --extract --file=automysqlbackup-v3.0_rc6.tar.gz README
|
||||||
|
```
|
||||||
|
|
||||||
|
Extrait le fichier book.enchant.html du dossier php-chunked-xhtml de l'archive php*manual*fr.tar.gz
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~/Downloads$ tar --extract --file=php_manual_fr.tar.gz php-chunked-xhtml/book.enchant.html
|
||||||
|
```
|
||||||
|
|
||||||
|
Extraire plusieurs fichiers d'archive:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~/Downloads$ tar xvf php_manual_fr.tar.gz php-chunked-xhtml/book.enchant.html php-chunked-xhtml/function.mysql-connect.html
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Extraire un seul fichier d'une archive zip
|
||||||
|
|
||||||
|
Connaitre la liste des fichiers de l'archive:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~/Downloads$ unzip -l zenphoto-zenphoto-1.4.14.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
Extraire des fichiers de l'archive:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~/Downloads$ unzip zenphoto-zenphoto-1.4.14.zip zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/zenpage/zenpage.css zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/tinymce4/skins/lightgray/img/anchor.gif
|
||||||
|
Archive: zenphoto-zenphoto-1.4.14.zip
|
||||||
|
4c21854e7a7950ec8d9644a959da019d9781d36c
|
||||||
|
inflating: zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/tinymce4/skins/lightgray/img/anchor.gif
|
||||||
|
inflating: zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/zenpage/zenpage.css
|
||||||
|
```
|
||||||
119
docs/Linux/commandes.md
Normal file
119
docs/Linux/commandes.md
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
# Commandes
|
||||||
|
|
||||||
|
### Supprimer le contenu d’un repertoire Linux:
|
||||||
|
|
||||||
|
On se place dans le répertoire puis:
|
||||||
|
|
||||||
|
`bruno@macbook-pro:~/Desktop/folder$ rm -rf *`
|
||||||
|
|
||||||
|
ou alors:
|
||||||
|
|
||||||
|
`bruno@macbook-pro:~/Desktop/folder$ rm -rf ton_repertoire/*`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Copier tous les fichiers .zip dans un autre dossier:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cp *.zip /volume1/Backup/
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Déplacer un fichier vers un dossier parent:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mv plex.zip ../../..
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Connaitre le SHELL utilisé:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ echo $SHELL
|
||||||
|
/opt/bin/bash
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Aller au répertoire utilisateur:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd $HOME
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Afficher les numéros de ligne avec cat:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cat --number foo.c | more
|
||||||
|
$ cat -n foo.c | less
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Commentaire multi-lignes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
echo "Say Something"
|
||||||
|
<<COMMENT1
|
||||||
|
your comment 1
|
||||||
|
comment 2
|
||||||
|
blah
|
||||||
|
COMMENT1
|
||||||
|
echo "Do something else"
|
||||||
|
|
||||||
|
: '
|
||||||
|
COMMENT2
|
||||||
|
your comments here
|
||||||
|
'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Connaitre la version installé:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cat /etc/linuxmint/info
|
||||||
|
|
||||||
|
$ cat /etc/lsb-release
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Liste des utilisateurs et groupes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cat /etc/passwd | awk -F: '{print $ 1}'
|
||||||
|
|
||||||
|
$ cat /etc/group | awk -F: '{print $ 1}'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Sudo:
|
||||||
|
|
||||||
|
Crée un nouvel utilisateur avec privilèges super-utilisateur (sudo):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ adduser <newuser>
|
||||||
|
$ usermod -aG sudo <newuser>
|
||||||
|
# ou
|
||||||
|
$ sudo gpasswd -a <newuser> sudo
|
||||||
|
Adding user <newuser> to group sudo
|
||||||
|
```
|
||||||
|
|
||||||
|
Retirer les privilèges super-utilisateur (sudo) à un utilisateur:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo deluser <username> sudo
|
||||||
|
$ sudo gpasswd -d <username> sudo
|
||||||
|
|
||||||
|
# retire <username> de tous les groups sauf de son groupe individuel
|
||||||
|
$ usermod -G "" <username>
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
402
docs/Linux/conditions.md
Normal file
402
docs/Linux/conditions.md
Normal file
@@ -0,0 +1,402 @@
|
|||||||
|
# Conditions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## IF
|
||||||
|
|
||||||
|
### if
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ $foo -ge 3 ]; then
|
||||||
|
... (si $foo >= 3)
|
||||||
|
elif [ $foo -lt 3 ]; then
|
||||||
|
... (si $foo < 3)
|
||||||
|
else
|
||||||
|
...
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $foo -ge 3 ]
|
||||||
|
then
|
||||||
|
... (si $foo >= 3)
|
||||||
|
elif [ $foo -lt 3 ]
|
||||||
|
then
|
||||||
|
... (si $foo < 3)
|
||||||
|
else
|
||||||
|
...
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### if imbriqué
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ $value -ge 1 ]
|
||||||
|
then
|
||||||
|
|
||||||
|
if [ $foo -eq 1 ]
|
||||||
|
then
|
||||||
|
echo "One"
|
||||||
|
elif [ $foo -eq 2 ]
|
||||||
|
then
|
||||||
|
echo "Two"
|
||||||
|
else
|
||||||
|
echo "Bigger than two"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### AND & OR
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [[ -n $1 ]] && [[ -r $1 ]]
|
||||||
|
then
|
||||||
|
echo "File exists and is readable"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [[ -z $1 ]] || [[ ! -r $1 ]]
|
||||||
|
then
|
||||||
|
echo "Either you didn't give me a value or file is unreadable"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Conditions:
|
||||||
|
|
||||||
|
#### -fichier
|
||||||
|
|
||||||
|
Si le fichier *<u>existingfile</u>* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -a existingfile ]; then
|
||||||
|
ou
|
||||||
|
if [ -e existingfile ]; then
|
||||||
|
|
||||||
|
if [ -a tmp.tmp ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>blockspecialfile</u> (/dev/fd0)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -b blockspecialfile ]; then
|
||||||
|
|
||||||
|
if [ -b /dev/fd0 ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>characterspecialfile</u> (/dev/null tty)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -c characterspecialfile ]; then
|
||||||
|
|
||||||
|
if [ -c /dev/dsp ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le répertoire *<u>directory</u>* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -d directory ]; then
|
||||||
|
|
||||||
|
if [ -d ~/.kde ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>regularfile</u> (ni un blockspecialfile, ni un characterspecialfile, ni un directory)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -f regularfile ]; then
|
||||||
|
|
||||||
|
if [ -f ~/.bashrc ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>sgidfile</u> (set-group-ID)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -g sgidfile ]; then
|
||||||
|
|
||||||
|
if [ -g . ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>fileownedbyeffectivegroup</u>* existe
|
||||||
|
|
||||||
|
```
|
||||||
|
if [ -G fileownedbyeffectivegroup ]; then
|
||||||
|
|
||||||
|
if [ ! -G file ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>symboliclink</u> (symbolic link)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -h symboliclink ]; then
|
||||||
|
ou
|
||||||
|
if [ -L symboliclink ]; then
|
||||||
|
|
||||||
|
if [ -h $pathtofile ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>stickyfile</u> (sticky bit set)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -k stickyfile ]; then
|
||||||
|
|
||||||
|
if [ ! -k /tmp ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>modifiedsincelastread</u>* *(a été modifié aprèès la dernière lecture)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -N modifiedsincelastread ]; then
|
||||||
|
|
||||||
|
if [ -N /etc/crontab ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>fileownedbyeffectiveuser</u>* *(si l'utilisateur exécutant le script le possède)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -O fileownedbyeffectiveuser ]; then
|
||||||
|
|
||||||
|
if [ -O file ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>namedpipe</u>* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -p namedpipe ]; then
|
||||||
|
|
||||||
|
if [ -p $file ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>readablefile</u> (droit lecture)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -r readablefile]; then
|
||||||
|
|
||||||
|
if [-r file ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>noemptyfile</u> (taille > 0 octet)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -s nonemptyfile ]; then
|
||||||
|
|
||||||
|
if [ -s logfile ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>socket</u>* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -S socket ]; then
|
||||||
|
|
||||||
|
if [ -S /var/lib/mysql/mysql.sock ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>openterminal</u>* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -t openterminal ]; then
|
||||||
|
|
||||||
|
if [ -t /dev/pts/3 ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>suidfile</u> (set-user-ID)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -u suidfile ]; then
|
||||||
|
|
||||||
|
if [ -u executable ];
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>writeablefile</u> (droit écriture)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -w writeablefile ]; then
|
||||||
|
|
||||||
|
if [ -w /dev/hda ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>executablefile</u> (droit exécutable)* existe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -x executablefile ]; then
|
||||||
|
|
||||||
|
if [ -x /root ];
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>newerfile a été modifié après olderfile</u>*, ou *<u>si newerfile existe et pas olderfile</u>.*
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ newerfile -nt olderfile ]; then
|
||||||
|
|
||||||
|
if [ story.txt1 -nt story.txt ];
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le fichier *<u>olderfile a été modifié avant newerfile</u>*, ou <u>*si newerfile existe et pas olderfile.*</u>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ olderfile -ot newerfile ]; then
|
||||||
|
|
||||||
|
if [ /mnt/remote/remotefile -ot localfile ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si les fichiers <u>*same et file font référence au même device / inode*</u>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ same -ef file ]; then
|
||||||
|
|
||||||
|
if [ /dev/cdrom -ef /dev/dvd ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### -chaine
|
||||||
|
|
||||||
|
Si les chaines sont <u>*identiques*</u> [ STRING1 == STRING2 ]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ “$1” == “moo” ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si les chaines sont <u>*différentes*</u> [ STRING1 != STRING2 ]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ “$userinput” != “$password” ];
|
||||||
|
```
|
||||||
|
|
||||||
|
Si la chaine 1 <u>*est triée après*</u> la chaine 2 [ STRING1 > STRING2 ]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ “$userinput” > “$password” ];
|
||||||
|
```
|
||||||
|
|
||||||
|
Si la chaine 1 <u>*est triée avant*</u> la chaine 2 [ STRING1 < STRING2 ]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ “$userinput” < “$password” ];
|
||||||
|
```
|
||||||
|
|
||||||
|
Si la chaine <u>*NONEMPTYSTRING a une longueur > 0*</u> (contient 1 ou plusieurs caractères)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -n NONEMPTYSTRING ]; then
|
||||||
|
|
||||||
|
if [ -n “$userinput” ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si la chaine <u>*EMPTYSTRING est vide*</u> (NULL)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -z EMPTYSTRING ]; then
|
||||||
|
|
||||||
|
if [ -z $uninitializedvar ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si la chaine réussie la REGEX [[ STRING1 =~ REGEXPATTERN ]]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [[ “$email” =~ “b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}b” ]]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### -nombre
|
||||||
|
|
||||||
|
Si deux nombres sont <u>égaux</u> (EQual) [ NUM1 -eq NUM2 ]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ $NUM1 -eq $NUM2 ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si deux nombres sont <u>différents</u> (Not Equal) [ NUM1 -ne NUM2 ]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ $NUM1 -ne $NUM2 ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si NUM 1 est <u>supérieur à</u> NUM 2 (Greater Than) [ NUM1 -gt NUM2 ]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ $NUM1 -gt $NUM2 ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si NUM 1 est <u>supérieur ou égal à</u> NUM 2 (Greater than or Equal) [ NUM1 -ge NUM2 ]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ $NUM1 -ge $NUM2 ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si NUM 1 est <u>inférieur à</u> NUM 2 (Less Than) [ NUM1 -lt NUM2 ]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ $NUM1 -lt $NUM2 ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si NUM 1 est <u>inférieur ou égal à</u> NUM 2 (Less than or Equal) [ NUM1 -le NUM2 ]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ $NUM1 -le $NUM2 ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
Exemples:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ $? -eq 0 ]; then # $? returns the exit status of the previous command
|
||||||
|
echo “Previous command ran succesfully.”
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $(ps -p $pid -o ni=) -ne $(nice) ]; then
|
||||||
|
echo “Process $pid is running with a non-default nice value”
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $num -lt 0 ]; then
|
||||||
|
echo “Negative numbers not allowed; exiting…”
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### -double parenthèses
|
||||||
|
|
||||||
|
Si deux nombres sont <u>égaux</u> (( NUM1 == NUM2 ))
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if (( NUM1 == NUM2 )); then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si deux nombres sont <u>différents</u> (( NUM1 != NUM2 ))
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if (( NUM1 != NUM2 )); then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si NUM 1 est <u>supérieur à</u> NUM 2 (( NUM1 > NUM2 ))
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if (( NUM1 > NUM2 )); then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si NUM 1 est <u>supérieur ou égal à</u> NUM 2 (( NUM1 >= NUM2 ))
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if (( NUM1 >= NUM2 )); then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si NUM 1 est <u>inférieur à</u> NUM 2 (( NUM1 < NUM2 ))
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if (( NUM1 < NUM2 )); then
|
||||||
|
```
|
||||||
|
|
||||||
|
Si NUM 1 est <u>inférieur ou égal à</u> (( NUM1 <= NUM2 ))
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if (( NUM1 <= NUM2 )); then
|
||||||
|
```
|
||||||
|
|
||||||
308
docs/Linux/executer.md
Normal file
308
docs/Linux/executer.md
Normal file
@@ -0,0 +1,308 @@
|
|||||||
|
# Excecuter une application en root
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### A) Sudo
|
||||||
|
|
||||||
|
Avec sudo, on prend les droits root pour exécuter une commande.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo opkg update
|
||||||
|
```
|
||||||
|
|
||||||
|
Le mot de passe est mémorisé pendant x minutes, pendant les lesquelles pour les commandes lancées avec sudo, le mot-de-passe n'est pas demandé.
|
||||||
|
|
||||||
|
On peut "oublier" le mot de passe mémorisé.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo -k
|
||||||
|
```
|
||||||
|
|
||||||
|
On peut ouvrir une "session root" avec sudo.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo -i
|
||||||
|
```
|
||||||
|
|
||||||
|
Avec **sudo -i**, le mot de passe **utilisateur** est demandé.
|
||||||
|
Avec **su -**, le mot de passe **root** est demandé.
|
||||||
|
|
||||||
|
Obtenir la listes des commandes dispos:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo -l
|
||||||
|
Password:
|
||||||
|
Matching Defaults entries for bruno on DS916:
|
||||||
|
syslog=authpriv
|
||||||
|
|
||||||
|
User bruno may run the following commands on DS916:
|
||||||
|
(ALL) ALL
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### B) sudoers
|
||||||
|
|
||||||
|
Plutot que d'éditer `sudoers`, on peut créer des fichiers de personnalisation dans `/etc/sudoer.d/`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/etc/sudoers.d$ ls -la
|
||||||
|
total 28
|
||||||
|
drwxr-xr-x 2 root root 4096 sept. 11 20:02 .
|
||||||
|
drwxr-xr-x 144 root root 12288 sept. 11 19:52 ..
|
||||||
|
-r--r----- 1 root root 180 mars 22 2017 mintupdate
|
||||||
|
-r--r----- 1 root root 958 janv. 18 2018 README
|
||||||
|
-r--r----- 1 root root 51 août 26 10:20 vagrant
|
||||||
|
```
|
||||||
|
|
||||||
|
`chmod 440` sur ces fichier.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### options
|
||||||
|
|
||||||
|
<u>Reduire le temps de grâce:</u>
|
||||||
|
|
||||||
|
Ajouter `timestamp_timeout=X` à la ligne `Defaults`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Defaults env_reset,timestamp_timeout=X
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Cmnd alias
|
||||||
|
|
||||||
|
Il faut éditer `/etc/sudoers` avec visudo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo visudo -s
|
||||||
|
```
|
||||||
|
|
||||||
|
ou avec nano:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo nano /etc/sudoers
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# /etc/sudoers
|
||||||
|
#
|
||||||
|
# This file MUST be edited with the 'visudo' command as root.
|
||||||
|
#
|
||||||
|
# See the man page for details on how to write a sudoers file.
|
||||||
|
# Host alias specification
|
||||||
|
|
||||||
|
# User alias specification
|
||||||
|
|
||||||
|
# Cmnd alias specification
|
||||||
|
Cmnd_Alias NETWORK=/sbin/ifconfig, /sbin/iwconfig, /sbin/dhclient
|
||||||
|
|
||||||
|
# Defaults
|
||||||
|
|
||||||
|
Defaults !lecture,tty_tickets,!fqdn,insults
|
||||||
|
|
||||||
|
# User privilege specification
|
||||||
|
root ALL=(ALL) ALL
|
||||||
|
|
||||||
|
# Members of the admin group may gain root privileges
|
||||||
|
%admin ALL=(ALL) ALL, NOPASSWD:NETWORK
|
||||||
|
```
|
||||||
|
|
||||||
|
root a tous les droits.
|
||||||
|
|
||||||
|
le groupe (%) admin peut lancer `ifconfig` avec un sudo mais SANS mot-de-passe, et tout le reste avec sudo Et mot-de-passe.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo ifconfig
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
username n'a le droit d'exécuter sudo que pour le seul script.sh (et sans mot-de-passe)
|
||||||
|
|
||||||
|
```
|
||||||
|
username ALL=NOPASSWD: /mon/script.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo /mon/script.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
autres exemples:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nano vagrant
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# add vagrant user
|
||||||
|
vagrant ALL=(ALL) NOPASSWD:ALL
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nano mintupdate
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Allow any user to check for new system updates without
|
||||||
|
# requiring user autentification
|
||||||
|
|
||||||
|
Cmnd_Alias UPDATE = /usr/lib/linuxmint/mintUpdate/checkAPT.py
|
||||||
|
|
||||||
|
ALL ALL = NOPASSWD:UPDATE
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[https://doc.ubuntu-fr.org/sudoers](https://doc.ubuntu-fr.org/sudoers)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### C) Setuid
|
||||||
|
|
||||||
|
### suid
|
||||||
|
|
||||||
|
Lorsque l’on place un suid sur un fichier, n’importe quel utilisateur peut l’exécuter en héritant des permissions du propriétaire, comme s’il était lui-même le propriétaire.
|
||||||
|
|
||||||
|
Exemple: quand un fichier exécutable est propriété de l'[utilisateur root](https://fr.wikipedia.org/wiki/Utilisateur_root), et est rendu *setuid*, tout processus exécutant ce fichier peut effectuer ses tâches avec les permissions associées à root
|
||||||
|
|
||||||
|
Le *suid* ne s’active que sur des fichiers. La valeur de *suid* est 4 sur le chiffre octal de poids fort, son flag est s ou S (s si le droit d'exécution est présent, S sinon).
|
||||||
|
|
||||||
|
Pour activer le *suid* :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chmod u+s fichier
|
||||||
|
|
||||||
|
$ chmod 4755 fichier
|
||||||
|
```
|
||||||
|
|
||||||
|
Pour supprimer le *suid*:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo chmod u-s fichier
|
||||||
|
|
||||||
|
$ chmod 0755 fichier
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ ls -la
|
||||||
|
-rwxr-xr-x 1 bruno users 2264 Sep 11 17:02 _npm.sh
|
||||||
|
|
||||||
|
# on met le suid (exécutable + suid -> s)
|
||||||
|
$ chmod u+s _npm.sh
|
||||||
|
$ ls -la
|
||||||
|
-rwsr-xr-x 1 bruno users 2264 Sep 11 17:02 _npm.sh
|
||||||
|
|
||||||
|
# on retire le suid
|
||||||
|
$ chmod u-s _npm.sh
|
||||||
|
$ ls -la
|
||||||
|
-rwxr-xr-x 1 bruno users 2264 Sep 11 17:02 _npm.sh
|
||||||
|
|
||||||
|
# le script n'est pas exécutable
|
||||||
|
$ chmod 644 _npm.sh
|
||||||
|
$ ls -la
|
||||||
|
$ -rw-r--r-- 1 bruno users 2264 Sep 11 17:02 _npm.sh
|
||||||
|
|
||||||
|
#on met le suid (non exécutable + suid -> S)
|
||||||
|
$ chmod u+s _npm.sh
|
||||||
|
$ ls -la
|
||||||
|
-rwSr--r-- 1 bruno users 2264 Sep 11 17:02 _npm.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
~~Un script ne peut pas être set-uid.~~
|
||||||
|
|
||||||
|
~~c'est pas au niveau du script mais du binaire appelé qu'il faut le faire~~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Rendre root possesseur du script.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chown root:root /path/to/root-script.sh`
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### sgid
|
||||||
|
|
||||||
|
**Sur un fichier**: ce droit fonctionne comme le droit *suid*, mais appliqué aux groupes.
|
||||||
|
|
||||||
|
Il donne à un utilisateur les droits du groupe auquel appartient le propriétaire de l’exécutable et non plus les droits du propriétaire.
|
||||||
|
|
||||||
|
La valeur de *sgid* est 2 sur le chiffre octal de poids fort, son flag est s ou S (s si le droit d'exécution est présent, S sinon).
|
||||||
|
|
||||||
|
Pour activer le *sgid*:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chmod g+s fichier
|
||||||
|
|
||||||
|
$ chmod 2755 fichier
|
||||||
|
```
|
||||||
|
|
||||||
|
Pour activer le *suid* et le *sgid*:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chmod ug+s fichier
|
||||||
|
|
||||||
|
# le poids fort vaut 6 (4+2)
|
||||||
|
$ chmod 6755 fichier
|
||||||
|
```
|
||||||
|
|
||||||
|
Pour supprimer le *sgid*:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chmod u-s fichier
|
||||||
|
|
||||||
|
$ chmod 0755 fichier
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Sur un répertoire**: ce droit a une tout autre utilisation s’il est appliqué à un répertoire.
|
||||||
|
|
||||||
|
Normalement, lorsqu’un fichier est créé par un utilisateur, il en est propriétaire, et un groupe par défaut lui est appliqué (généralement *users* si le fichier a été créé par un utilisateur, et *root* ou *wheel* s’il a été créé par *root*).
|
||||||
|
Cependant, lorsqu’un fichier est créé dans un répertoire portant le droit SGID, alors ce fichier se verra attribuer par défaut le groupe du répertoire. De plus, si c’est un autre répertoire qui est créé dans le répertoire portant le droit *sgid*, ce sous-répertoire portera également ce droit. En revanche, si des sous-répertoires existent déjà au moment de l'ajout du *Setgid*, ils ne sont pas affectés par celui-ci.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chmod g+s repertoire
|
||||||
|
|
||||||
|
$ chmod 2755 repertoire
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### sticky bit
|
||||||
|
|
||||||
|
Le droit d’écriture signifie que l’on peut créer et supprimer les fichiers de ce répertoire. Le sticky bit permet de faire la différence entre les deux droits.
|
||||||
|
|
||||||
|
**Sur un fichier,** Gnu/Linux n’en tient pas compte contrairement aux vieux systèmes Unix. Ainsi le sticky bit activé indique à l’OS que le fichier sera utilisé fréquemment et sera ainsi stocké dans un fichier d’échange pour avoir la main dessus rapidement.
|
||||||
|
|
||||||
|
La valeur du *sticky bit* est 1 sur le chiffre octal de poids fort, son flag est t ou T.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo chmod +t fichier*
|
||||||
|
$chmod 1750 /path/to/root-script.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
**Sur un répertoire** le sticky bit aura pour effet d’interdire à quiconque n’étant pas le propriétaire du fichier sa suppression. Cependant, il sera toujours possible de modifier le fichier d’un autre si l’on possède les droits nécessaires. La création de nouveaux fichiers est toujours possible pour tous les utilisateurs possédant le droit d'écriture sur ce répertoire
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo chmod +t repertoire*
|
||||||
|
```
|
||||||
|
|
||||||
|
Sur certains systèmes UNIX, le sticky bit est utilisé pour le répertoire /tmp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### D) gksu & gksudo
|
||||||
|
|
||||||
|
Ce sont simplement des front-end graphiques pour *su* et *sudo*.
|
||||||
45
docs/Linux/filtres.md
Normal file
45
docs/Linux/filtres.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Filtres
|
||||||
|
|
||||||
|
#### sort
|
||||||
|
|
||||||
|
Sorts standard input then outputs the sorted result on standard output.
|
||||||
|
|
||||||
|
#### uniq
|
||||||
|
|
||||||
|
Given a sorted stream of data from standard input, it removes duplicate lines of data (i.e., it makes sure that every line is unique).
|
||||||
|
|
||||||
|
#### grep
|
||||||
|
|
||||||
|
Examines each line of data it receives from standard input and outputs every line that contains a specified pattern of characters.
|
||||||
|
|
||||||
|
#### fmt
|
||||||
|
|
||||||
|
Reads text from standard input, then outputs formatted text on standard output.
|
||||||
|
|
||||||
|
#### pr
|
||||||
|
|
||||||
|
Takes text input from standard input and splits the data into pages with page breaks, headers and footers in preparation for printing.
|
||||||
|
|
||||||
|
#### head
|
||||||
|
|
||||||
|
Outputs the first few lines of its input. Useful for getting the header of a file.
|
||||||
|
|
||||||
|
#### tail
|
||||||
|
|
||||||
|
Outputs the last few lines of its input. Useful for things like getting the most recent entries from a log file.
|
||||||
|
|
||||||
|
#### tr
|
||||||
|
|
||||||
|
Translates characters. Can be used to perform tasks such as upper/lowercase conversions or changing line termination characters from one type to another (for example, converting DOS text files into Unix style text files).
|
||||||
|
|
||||||
|
#### sed
|
||||||
|
|
||||||
|
Stream editor. Can perform more sophisticated text translations than tr.
|
||||||
|
|
||||||
|
#### awk
|
||||||
|
|
||||||
|
An entire programming language designed for constructing filters. Extremely powerful.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`-rw-r–r– 1 root root 0 avril 24 22:49 security.ubuntu.com*ubuntu*dists*xenial-security*restricted*binary-i386*Packages`
|
||||||
118
docs/Linux/find.md
Normal file
118
docs/Linux/find.md
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
# find
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
La commande **find** permet de retrouver des fichiers à partir de certains critères. Elle doit être utilisé avec l'option **-print**
|
||||||
|
|
||||||
|
Les <u>critères de recherche</u> sont les suivants :
|
||||||
|
|
||||||
|
- **-name** recherche sur le nom du fichier,
|
||||||
|
- **-perm** recherche sur les droits d'accès du fichier,
|
||||||
|
- **-links** recherche sur le nombre de liens du fichier,
|
||||||
|
- **-user** recherche sur le propriétaire du fichier,
|
||||||
|
- **-group** recherche sur le groupe auquel appartient le fichier,
|
||||||
|
- **-type** recherche sur le type (d=répertoire, c=caractère, f=fichier normal),
|
||||||
|
- **-size** recherche sur la taille du fichier en nombre de blocs (1 bloc=512octets),
|
||||||
|
- **-atime** recherche par date de dernier accès en lecture du fichier,
|
||||||
|
- **-mtime** recherche par date de dernière modification du fichier,
|
||||||
|
- **-ctime** recherche par date de création du fichier.
|
||||||
|
|
||||||
|
<u>Options:</u>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Recherche par <u>nom de fichier</u>:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find /usr -name toto -print
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
find . -name '[aA]*[3-6]' -print
|
||||||
|
```
|
||||||
|
|
||||||
|
Recherche suivant la <u>date de dernière modification</u>:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# modifiés il y a 30 jours
|
||||||
|
|
||||||
|
find / -mtime 30 -print
|
||||||
|
|
||||||
|
# modifiés il y a 30 jours ou plus
|
||||||
|
|
||||||
|
find / -mtime +30 -print
|
||||||
|
|
||||||
|
# modifiés il y a 30 jours ou moins
|
||||||
|
|
||||||
|
find / -mtime 30 -print
|
||||||
|
```
|
||||||
|
|
||||||
|
Recherche suivant la <u>taille</u>:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# fichiers dont la taille dépasse 30ko
|
||||||
|
|
||||||
|
find / -size +30k -print
|
||||||
|
```
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
find . ! -user olivier -print
|
||||||
|
|
||||||
|
# Recherche les fichiers dont le nom est a.out ou les fichiers se terminant par *.c (une condition OU l'autre).
|
||||||
|
|
||||||
|
find . \ ( -name a.out -o -name " *.c " \ ) -print
|
||||||
|
|
||||||
|
# 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
|
||||||
|
```
|
||||||
|
|
||||||
|
Recherche <u>combinée</u>:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# les fichiers de l'utilisateur bruno dont les permissions sont 755
|
||||||
|
|
||||||
|
find / -type f -user bruno -perm 755 -print
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Commandes en option:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Recherche les fichiers toto et les efface.
|
||||||
|
|
||||||
|
find . -name toto -exec rm {}\ ;
|
||||||
|
|
||||||
|
# Pour avoir une demande de confirmation avant l'exécution de rm
|
||||||
|
|
||||||
|
find . -name toto -ok rm {}\ ;
|
||||||
|
```
|
||||||
|
|
||||||
|
Utilisation avec d'autres commandes:'
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Recherche les fichiers normaux dans le répertoire courant, puis chercher le chaine toto dans ces fichiers.
|
||||||
|
|
||||||
|
find . -type f -print | xargs grep toto
|
||||||
|
|
||||||
|
# Recherche les fichiers toto et les efface après confimation (-p).
|
||||||
|
# idem -exec, " | xargs " ne crée qu'un seim processus.
|
||||||
|
|
||||||
|
find . -name toto | xargs -p rm
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Redirection des messages d'erreur:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find / -name toto -print 2>/dev/null
|
||||||
|
```
|
||||||
|
|
||||||
88
docs/Linux/grep.md
Normal file
88
docs/Linux/grep.md
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
# grep
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
La commande **grep** permet de rechercher une chaîne de caractères dans un fichier.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
-i (ignore case) insensible à la casse
|
||||||
|
-v affiche les lignes ne contenant pas la chaîne
|
||||||
|
-c (count) compte le nombre de lignes contenant la chaîne
|
||||||
|
-n (number) chaque ligne contenant la chaîne est numérotée
|
||||||
|
-x ligne correspondant exactement à la chaîne
|
||||||
|
-l affiche le nom des fichiers qui contiennent la chaîne
|
||||||
|
-C (context) fait figurer les deux lignes qui précèdent et suivent la ligne où figure le mot recherché
|
||||||
|
-Ax (after) affiche les x lignes qui suivent la ligne où figure le mot recherché
|
||||||
|
-Bx (before) affiche les x lignes qui précèdent la ligne où figure le mot recherché
|
||||||
|
-r (recursif)
|
||||||
|
-w mot exact
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<u>Chercher dans un dossier (récursif)</u>:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grep -r "brew" ./docs/
|
||||||
|
./docs//Divers/plex.md: $ brew install mono
|
||||||
|
|
||||||
|
# N'affiche que les fichiers (-l):
|
||||||
|
grep -l -r "brew" ./docs/
|
||||||
|
./docs//Divers/plex.md
|
||||||
|
./docs//macos/node-js.md
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<u>Regex:</u>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grep -E ^a toto.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
L'option -E est optionnelle (compatibilité).
|
||||||
|
|
||||||
|
| Caractère spécial | Signification |
|
||||||
|
| ----------------- | ------------------------------------------------------------ |
|
||||||
|
| `.` | Caractère quelconque |
|
||||||
|
| `^` | Début de ligne |
|
||||||
|
| `$` | Fin de ligne |
|
||||||
|
| `[]` | Un des caractères entre les crochets |
|
||||||
|
| `?` | L'élément précédent est optionnel (peut être présent 0 ou 1 fois) |
|
||||||
|
| `*` | L'élément précédent peut être présent 0, 1 ou plusieurs fois |
|
||||||
|
| `+` | L'élément précédent doit être présent 1 ou plusieurs fois |
|
||||||
|
| `|` | Ou |
|
||||||
|
| `()` | Groupement d'expressions |
|
||||||
|
|
||||||
|
Lignes commençant par les caractères compris entre a et d:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grep ^[a-d] fichier.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Rechercher plusieurs chaines:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grep -E 'tata|toto' fichier.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
ou passer un fichier de motifs à grep:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat motif.txt
|
||||||
|
|
||||||
|
grep -f "motif.txt" fichier.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Afficher les 5 lignes qui suivent le motif recherché:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grep 'toto' -A5 fichier.txt
|
||||||
|
```
|
||||||
|
|
||||||
31
docs/Linux/index.md
Normal file
31
docs/Linux/index.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Linux
|
||||||
|
|
||||||
|
[Authentification automatique par SSH sans mot de passe](../macos/ssh/ssh-passwordless.md)
|
||||||
|
|
||||||
|
[Archiver / compresser](archiver.md)
|
||||||
|
|
||||||
|
[Commande scp](scp.md)
|
||||||
|
|
||||||
|
[Commande sftp](sftp.md)
|
||||||
|
|
||||||
|
[Commande ssh](ssh.md)
|
||||||
|
|
||||||
|
[Commandes tail/head](tail-head.md)
|
||||||
|
|
||||||
|
[Commandes apt-get & apt-cache](../Raspberry/apt-get.md)
|
||||||
|
|
||||||
|
[Editeurs](index.md) (vi, nano…)
|
||||||
|
|
||||||
|
[Shells](shell.md)
|
||||||
|
|
||||||
|
[Permissions](permissions.md)
|
||||||
|
|
||||||
|
[I/O Redirections](redirections.md)
|
||||||
|
|
||||||
|
[Pipelines](pipeline.md)
|
||||||
|
|
||||||
|
[Filtres](filtres.md)
|
||||||
|
|
||||||
|
[Mises-à-jour sans connection internet](maj.md)
|
||||||
|
|
||||||
|
[Quelques commandes sympas](commandes.md)
|
||||||
39
docs/Linux/maj.md
Normal file
39
docs/Linux/maj.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# Faire les mises-à-jour sans connection internet
|
||||||
|
|
||||||
|
[apt-offline (ubuntu.fr)](https://doc.ubuntu-fr.org/apt-offline)
|
||||||
|
|
||||||
|
[Scripts (ubuntu.fr)](https://doc.ubuntu-fr.org/tutoriel/scripts_de_mise_a_jour_sans_internet)
|
||||||
|
|
||||||
|
[LinuxMint](https://community.linuxmint.com/tutorial/view/1059)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 1ere méthode (exemple pour Wine):
|
||||||
|
|
||||||
|
Sur **la machine reliée à internet,** ajouter le dépôt et mettre à jour:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo add-apt-repository ppa:wine/wine-builds
|
||||||
|
$ sudo apt-get update
|
||||||
|
```
|
||||||
|
|
||||||
|
Mettre en cache les paquets sans les extraire:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get clean
|
||||||
|
$ sudo apt-get --download-only install winehq-devel
|
||||||
|
$ sudo apt-get --download-only dist-upgrade
|
||||||
|
```
|
||||||
|
|
||||||
|
Copier tous les fichiers .deb contenus dans le dossier /var/cache/apt/archive sur une clé USB:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cp -R /var/cache/apt/archives/ /media/usb-drive/deb-pkgs/
|
||||||
|
```
|
||||||
|
|
||||||
|
Sur **la machine sans internet**, installer les paquets depuis la clé USB:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd /media/usb-drive/deb-pkgs
|
||||||
|
$ sudo dpkg -i *.deb
|
||||||
|
```
|
||||||
135
docs/Linux/permissions.md
Normal file
135
docs/Linux/permissions.md
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
# Permissions
|
||||||
|
|
||||||
|
#### Quelques commandes:
|
||||||
|
|
||||||
|
- su - temporarily become the superuser
|
||||||
|
- sudo - temporarily become the superuser
|
||||||
|
- chmod - modify file access rights
|
||||||
|
- chown - change file ownership
|
||||||
|
- chgrp - change a file's group ownership
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
-rwxrwxrwx
|
||||||
|
|
||||||
|
[- (fichier) ou d (dossier)] [rwx (possesseur) - rwx (groupe) - rwx (autres)]
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### chmod: change les permissions pour un fichier ou un dossier
|
||||||
|
|
||||||
|
```
|
||||||
|
rwx rwx rwx = 111 111 111
|
||||||
|
rw- rw- rw- = 110 110 110
|
||||||
|
rwx —–- -–— = 111 000 000
|
||||||
|
```
|
||||||
|
|
||||||
|
et
|
||||||
|
|
||||||
|
```
|
||||||
|
rwx = 111 in binary = 7
|
||||||
|
rw- = 110 in binary = 6
|
||||||
|
r-x = 101 in binary = 5
|
||||||
|
r–- = 100 in binary = 4
|
||||||
|
```
|
||||||
|
|
||||||
|
**Les réglages les plus courants:**
|
||||||
|
|
||||||
|
*-applications:*
|
||||||
|
|
||||||
|
```
|
||||||
|
777 (rwxrwxrwx)
|
||||||
|
755 (rwxr-xr-x)
|
||||||
|
700 (rwx——)
|
||||||
|
```
|
||||||
|
|
||||||
|
*-fichiers:*
|
||||||
|
|
||||||
|
```
|
||||||
|
666 (rw-rw-rw-)
|
||||||
|
644 (rw-r–r–)
|
||||||
|
600 (rw——-)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Permissions pour les dossiers:**
|
||||||
|
|
||||||
|
- r: permet de lister le contenu d'un répertoire si l'attribut x est mis
|
||||||
|
|
||||||
|
- w: les fichiers à l'intérieur du répertoire peuvent être crées, effacés ou renommer si l'attribut x est mis
|
||||||
|
- x: permet d'entrer dans le répertoire (cd dir)
|
||||||
|
|
||||||
|
```
|
||||||
|
777 (rwxrwxrwx)
|
||||||
|
755 (rwxr-xr-x)
|
||||||
|
700 (rwx——)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ ls -la
|
||||||
|
-rw-r--r--@ 1 bruno staff 848 6 aoû 09:20 backup-syno.tar.gz
|
||||||
|
bruno@macbook-pro:~/test-dossier-2$ chmod 777 backup-syno.tar.gz
|
||||||
|
bruno@macbook-pro:~$ ls -la
|
||||||
|
-rwxrwxrwx@ 1 bruno staff 848 6 aoû 09:20 backup-syno.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### chown: change le possesseur d'un fichier ou dossier (superuser)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ ls -la
|
||||||
|
-rwxrwxrwx@ 1 bruno staff 848 6 aoû 09:20 backup-syno.tar.gz
|
||||||
|
bruno@macbook-pro:~$ sudo chown root backup-syno.tar.gz
|
||||||
|
Password:
|
||||||
|
bruno@macbook-pro:~$ ls -la
|
||||||
|
-rwxrwxrwx@ 1 root staff 848 6 aoû 09:20 backup-syno.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### chgrp: change le groupe d'un fichier ou dossier (superuser)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ ls -la
|
||||||
|
-rwxrwxrwx@ 1 root staff 848 6 aoû 09:20 backup-syno.tar.gz
|
||||||
|
bruno@macbook-pro:~$ sudo chgrp admin backup-syno.tar.gz
|
||||||
|
bruno@macbook-pro:~$ ls -la
|
||||||
|
-rwxrwxrwx@ 1 root admin 848 6 aoû 09:20 backup-syno.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### setuid:
|
||||||
|
|
||||||
|
```
|
||||||
|
# chown root:root monshell.sh
|
||||||
|
# chmod 4755 monshell.sh
|
||||||
|
# exit
|
||||||
|
$ ./monshell.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Voir les autorisations au format octal:
|
||||||
|
|
||||||
|
**-Linux:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
stat -c '%n %a' *
|
||||||
|
```
|
||||||
|
|
||||||
|
**-OSX**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@Parallels-VM ~ $ stat -c '%n %a' *
|
||||||
|
apt-off.sh 755
|
||||||
|
Bureau 755
|
||||||
|
Documents 755
|
||||||
|
Images 755
|
||||||
|
```
|
||||||
37
docs/Linux/pipeline.md
Normal file
37
docs/Linux/pipeline.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# Pipelines
|
||||||
|
|
||||||
|
Connecte plusieurs commandes ensembles (la sortie standart d'une commande est l'entrée standart
|
||||||
|
de la suivante)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Affiche les fichiers du répertoire par page:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ ls -l | less
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Affiche les 10 plus récents fichiers du répertoire:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ ls -lt | head
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Affiche une liste de répertoires et leur taille, triée du plus grand au plus petit:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ du | sort -nr
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Affiche le nombre total de fichiers du répertoire courant et dans tous ses sous-répertoire:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find . -type f -print | wc -l
|
||||||
|
```
|
||||||
|
|
||||||
35
docs/Linux/redirections.md
Normal file
35
docs/Linux/redirections.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# I/O Redirections
|
||||||
|
|
||||||
|
#### Standard Output
|
||||||
|
|
||||||
|
Redirige la sortie standart vers un nouveau fichier:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ ls > liste.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Redirige la sortie standart vers un fichier (ajoute à la suite):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ ls >> liste.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Standard Input
|
||||||
|
|
||||||
|
Considère liste.txt comme entrée standart (au lieu du clavier):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ sort < liste.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### On peut combiner les 2
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ sort < liste.txt > liste_triee.txt
|
||||||
|
```
|
||||||
103
docs/Linux/scp.md
Normal file
103
docs/Linux/scp.md
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
# Commande scp (copie sécurisée)
|
||||||
|
|
||||||
|
#### Serveur 1 -> Serveur 2
|
||||||
|
|
||||||
|
Copie d'un fichier d'une machine serveur1 vers une autre machine serveur2:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ scp Login1@Serveur1:Chemin1/NomFichier1 Login2@Serveur2:Chemin2/NomFichier2
|
||||||
|
|
||||||
|
macbook-pro:~ bruno $ scp root@192.168.1.8:/root/test-copy-scp.txt
|
||||||
|
funnymac@ssh funnymac@ftp.cluster011.ovh.net:/www/backup/
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Client -> Serveur
|
||||||
|
|
||||||
|
Copie d'un fichier depuis le répertoire courant vers un répertoire du serveur:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~ scp Fichier login@serveur:Chemin
|
||||||
|
~ scp /home/mickael/data/Ficher2 root@192.168.10.131:/var/www/
|
||||||
|
~ scp /Users/bruno/test-copy-scp-2.txt root@192.168.1.8:/root/
|
||||||
|
root@DiskStation:~ # scp /root/.profile funnymac@ftp.cluster011.ovh.net:www/backup/.profile_syno_root
|
||||||
|
.profile 100% 497 0.5KB/s 0.5KB/s 00:00
|
||||||
|
```
|
||||||
|
|
||||||
|
Copie d'un répertoire, avec éventuellement ses sous-répertoires, vers un répertoire du serveur:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~ scp -r Repertoire login@serveur:Chemin
|
||||||
|
~ scp -r /home/mickael/data/ root@192.168.10.131:/var/www/
|
||||||
|
```
|
||||||
|
|
||||||
|
Si pas port 22
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~ scp -r -P 7256 /home/mickael/data/ root@192.168.10.131:/var/www/
|
||||||
|
~ scp -r -P 7256 /Users/bruno/test-dossier-2/ root@192.168.1.8:/root/
|
||||||
|
|
||||||
|
bruno@SilverBook:~/Downloads$ scp -P 7256 IPTV.bundle-master.zip bruno@clicclac.synology.me:/volume1/web
|
||||||
|
bruno@clicclac.synology.me's password:
|
||||||
|
IPTV.bundle-master.zip 100% 673KB 84.0KB/s 00:08
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Serveur -> Client
|
||||||
|
|
||||||
|
Copie d'un fichier du serveur vers le répertoire courant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~ scp login@serveur:Chemin/Fichier .
|
||||||
|
~ scp root@192.168.10.131:/var/www/Fichier2 /home/mickael/data/
|
||||||
|
~ macbook-pro:~ bruno$ scp root@192.168.1.8:/root/test-copy-scp.txt /Users/bruno/Documents
|
||||||
|
```
|
||||||
|
|
||||||
|
Copie d'un répertoire du serveur vers le répertoire courant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~ scp -r login@serveur:Chemin/Repertoire .
|
||||||
|
~ macbook-pro:~ bruno$ scp -r root@192.168.1.8:/root/test /Users/bruno/Documents
|
||||||
|
~ macbook-pro:~ bruno$ scp -r root@192.168.1.8:/root/test-dossier . (home)
|
||||||
|
```
|
||||||
|
|
||||||
|
<http://www.it-connect.fr/chapitres/transfert-de-fichier-via-ssh/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Autres exemples
|
||||||
|
|
||||||
|
Archive et compresse une liste de fichiers, puis envoie l'archive sur le ftp OVH.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DiskStation:~ # tar -zcvf backup-syno.tar.gz -T .liste-backup.txt | scp backup-syno.tar.gz funnymac@ftp.cluster011.ovh.net:www/backup
|
||||||
|
```
|
||||||
|
|
||||||
|
Envoie un fichier du Macbook sur le ftp OVH.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
macbook-pro:~ bruno$ scp .bash_profile funnymac@ftp.cluster011.ovh.net:www/backup
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Éditer un fichier à distance en SSH
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nano scp://root@192.168.240.132//etc/fichier.cnf
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<http://www.it-connect.fr/chapitres/transfert-de-fichier-via-ssh/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Envoyer un fichier sur le NAS:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ scp -P 72566 vendor.zip bruno@clicclac.synology.me:/volume1/web/gitlist/
|
||||||
|
```
|
||||||
|
|
||||||
68
docs/Linux/sftp.md
Normal file
68
docs/Linux/sftp.md
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
# Commande sftp (ftp sécurisée)
|
||||||
|
|
||||||
|
#### Se connecter au serveur:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
admin@DiskStation:~ $ sftp funnymac@ftp.cluster011.ovh.net:www
|
||||||
|
Connected to ftp.cluster011.ovh.net.
|
||||||
|
Changing to: /home/funnymac/www
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Changer de dossier:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sftp> cd backup
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Connaitre le chemin distant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sftp> pwd
|
||||||
|
Remote working directory: /home/funnymac/www/backup
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Lire le répertoire courant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sftp> ls
|
||||||
|
backup-syno.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Connaitre le chemin sur le client:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sftp> !pwd
|
||||||
|
/volume1/homes/admin
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Télécharger un fichier:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sftp> get backup-syno.tar.gz
|
||||||
|
Fetching /home/funnymac/www/backup/backup-syno.tar.gz to backup-syno.tar.gz
|
||||||
|
/home/funnymac/www/backup/backup-syno.tar.gz 100% 933 0.9KB/s 0.9KB/s 00:00
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Envoyer un fichier:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sftp> put .liste-backup.txt
|
||||||
|
Uploading .liste-backup.txt to /home/funnymac/www/backup/.liste-backup.txt
|
||||||
|
.liste-backup.txt 100% 119 0.1KB/s 0.1KB/s 00:00
|
||||||
|
|
||||||
|
sftp> ls
|
||||||
|
backup-syno.tar.gz
|
||||||
|
|
||||||
|
sftp> ls -la
|
||||||
|
drwx---r-x 2 funnymac users 6 Aug 6 13:13 .
|
||||||
|
drwx---r-x 18 funnymac users 34 Jul 27 06:54 ..
|
||||||
|
-rw-r--r-- 1 funnymac users 119 Aug 6 13:13 .liste-backup.txt
|
||||||
|
-rw-r--r-- 1 funnymac users 933 Aug 6 10:21 backup-syno.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Se déconnecter:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sftp> quit
|
||||||
|
```
|
||||||
|
|
||||||
41
docs/Linux/shell.md
Normal file
41
docs/Linux/shell.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Shells
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### ASH
|
||||||
|
|
||||||
|
#### Préférences:
|
||||||
|
|
||||||
|
- System: `/etc/profile`
|
||||||
|
- User: `~/.profile`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### BASH:
|
||||||
|
|
||||||
|
#### Préférences:
|
||||||
|
|
||||||
|
Il cherche les fichiers dans l'ordre suivant:
|
||||||
|
|
||||||
|
1. BASH comme login SHELL (une session où on se loggue dans le système, une connexion ssh):
|
||||||
|
1. `/etc/profile`
|
||||||
|
2. `~/.bash_profile`
|
||||||
|
3. `~/.bash_login`
|
||||||
|
4. `~/.profile`
|
||||||
|
2. BASH comme application (après s'être loggué avec un autre SHELL)
|
||||||
|
1. `/etc/bash.bashrc`
|
||||||
|
2. `~/.bashrc`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Recharger la configuration:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ source ~/.profile
|
||||||
|
|
||||||
|
ou
|
||||||
|
|
||||||
|
$ . ~/.profile
|
||||||
|
```
|
||||||
|
|
||||||
|
On peut aussi créer un alias: `alias rload=". ~/.profile"`
|
||||||
101
docs/Linux/ssh.md
Normal file
101
docs/Linux/ssh.md
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
# Commande ssh
|
||||||
|
|
||||||
|
#### Se connecter à un serveur par un autre port que 22:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ ssh bruno@192.168.1.7 -p 42666
|
||||||
|
bruno@192.168.1.7's password:
|
||||||
|
bruno@DS916:/var/services/homes/bruno $
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Fixer le message WARNING: UNPROTECTED PRIVATE KEY FILE!
|
||||||
|
|
||||||
|
On réinitilalise les permissions des clés:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ sudo chmod 600 ~/.ssh/id_rsa
|
||||||
|
bruno@macbook-pro:~$ sudo chmod 600 ~/.ssh/id_rsa
|
||||||
|
```
|
||||||
|
|
||||||
|
Si cela ne suffit pas:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ sudo chmod 600 ~/.ssh/known_hosts
|
||||||
|
bruno@macbook-pro:~$ sudo chmod 755 ~/.ssh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Copier un fichier:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
macbook-pro:~ bruno$ ssh root@192.168.1.8 "cat prefs.tar.gz"> prefs.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Exécuter une (ou plusieurs) commande sur un serveur distant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
macbook-pro:~ bruno$ ssh root@192.168.1.8 hostname
|
||||||
|
DiskStation
|
||||||
|
|
||||||
|
bruno@SilverBook:~$ ssh -p34987 bruno@xxxxxxx.synology.me 'hostname ; uptime'
|
||||||
|
bruno@xxxxxxx.synology.me's password:
|
||||||
|
DS916
|
||||||
|
07:56:40 up 2 days, 19:50, 0 users, load average: 1.13, 1.15, 1.14
|
||||||
|
|
||||||
|
bruno@SilverBook:~$ ssh -p34987 bruno@xxxxxxx.synology.me << EOF
|
||||||
|
> uname -a
|
||||||
|
> lscpu | grep "^CPU(s)"
|
||||||
|
> grep -i memtotal /proc/meminfo
|
||||||
|
> EOF
|
||||||
|
Pseudo-terminal will not be allocated because stdin is not a terminal.
|
||||||
|
bruno@clicclac.synology.me's password:
|
||||||
|
Linux DS916 3.10.102 #15266 SMP Mon Mar 26 15:12:32 CST 2018 x86_64 GNU/Linux synology_braswell_916+
|
||||||
|
/bin/bash: line 2: lscpu: command not found
|
||||||
|
MemTotal: 1963472 kB
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Exécuter un script distant sur un serveur distant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~$ 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
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Exécuter un script local sur un serveur distant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~$ ssh -p34987 bruno@xxxxxxx.synology.me 'bash -s' < test.sh
|
||||||
|
bruno@xxxxxxx.synology.me's password:
|
||||||
|
toto
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Mode verbose
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@macbook-pro:~$ ssh -vvv dsm916
|
||||||
|
OpenSSH_6.9p1, LibreSSL 2.1.8
|
||||||
|
debug1: Reading configuration data /Users/bruno/.ssh/config
|
||||||
|
debug1: /Users/bruno/.ssh/config line 3: Applying options for dsm916
|
||||||
|
debug1: Reading configuration data /etc/ssh/ssh_config
|
||||||
|
debug1: /etc/ssh/ssh_config line 20: Applying options for *
|
||||||
|
debug1: /etc/ssh/ssh_config line 102: Applying options for *
|
||||||
|
debug2: ssh_connect: needpriv 0
|
||||||
|
debug1: Connecting to 192.168.1.7 [192.168.1.7] port 22.
|
||||||
|
debug1: Connection established.
|
||||||
|
debug1: identity file /Users/bruno/.ssh/id_dsa type 2
|
||||||
|
.../...
|
||||||
|
bruno@DS916:/var/services/homes/bruno $
|
||||||
|
```
|
||||||
91
docs/Linux/tail-head.md
Normal file
91
docs/Linux/tail-head.md
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
# Commandes tail - head
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Tail
|
||||||
|
|
||||||
|
#### Par défaut, tail affiche les 10 dernières lignes du fichier.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ tail /var/log/messages
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Afficher les 15 dernières lignes du fichier.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ tail -n15 /var/log/messages
|
||||||
|
$ tail -15 /var/log/messages
|
||||||
|
$ tail -n 15 /var/log/messages
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### L'option -f affiche le fichier au fil de l'eau
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ tail -f /var/log/messages
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### MultiTail
|
||||||
|
|
||||||
|
Permet d'afficher plusieurs fichiers en meme temps:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ multitail error_log access_log
|
||||||
|
```
|
||||||
|
|
||||||
|
Permet d'afficher 2 fichiers côte à côte:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ multitail -s 2 error_log access_log
|
||||||
|
```
|
||||||
|
|
||||||
|
ou 'v' en cours d'exécution
|
||||||
|
|
||||||
|
Faire défiler (sur 100 lignes): 'b' ('q' pour quitter le mode défilement')
|
||||||
|
|
||||||
|
Pour changer le nb de lignes:
|
||||||
|
-m <valeur> pour le prochain fichier
|
||||||
|
-M <valeur> pour tous les fichiers
|
||||||
|
|
||||||
|
Fusionner 2 fichiers (ils s'affichent ensemble dans une seul fenêtre):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ multitail error_log -I access_log
|
||||||
|
```
|
||||||
|
|
||||||
|
Visualiser la sortie de programmes externes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ multitail -l "ping localhost"
|
||||||
|
```
|
||||||
|
|
||||||
|
Filtrer à l'aide de regexp (grep):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ multitail -e '200' access_log
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ multitail -v -e "ssh" -v -e "gnu-pop3d" -e "localhost" /var/log/messages
|
||||||
|
```
|
||||||
|
|
||||||
|
-e 'test': n'affiche que les lignes qui contiennent 'test'
|
||||||
|
-v -e 'test': n'affiche que les autres lignes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Head
|
||||||
|
|
||||||
|
#### Afficher les 5 premères lignes du fichier.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ head -5 /var/log/messages
|
||||||
|
$ head -n5 /var/log/messages
|
||||||
|
$ head -n 5 /var/log/messages
|
||||||
|
```
|
||||||
|
|
||||||
22
docs/Linux/variables.md
Normal file
22
docs/Linux/variables.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
48
docs/MySQL/Backup.md
Normal file
48
docs/MySQL/Backup.md
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# Backup
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Sauvegarder une base:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mysqldump -u root a_database> a_file.sql
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mysqldump -u root -p wordpress4 | pv | gzip> wordpress4.sql.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Restaurer une base depuis un backup:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mysql -u root -p a_database <a_file.sql
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Changer le mot de passe utilisateur:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mysql> UPDATE USER.master SET PASSWORD = AES_ENCRYPT('a_password','a_passkey') WHERE username = 'a_username'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Migration de bases:
|
||||||
|
|
||||||
|
- Arrêt de MySQL
|
||||||
|
- 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
|
||||||
|
```
|
||||||
|
|
||||||
|
- 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/
|
||||||
|
```
|
||||||
|
|
||||||
|
- Redémarrer MySQL
|
||||||
31
docs/MySQL/Expired-root-Password.md
Normal file
31
docs/MySQL/Expired-root-Password.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Reset Expired root Password for MySQL 5.7 on Mac OS X
|
||||||
|
|
||||||
|
1. Arrêter MySQL (PrefPane)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo su
|
||||||
|
$ sudo mysqld_safe –skip-grant-tables
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Dans un autre terminal: (MySQL 5.7)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sh-3.2# mysql -u root
|
||||||
|
mysql> UPDATE mysql.user SET authentication_string=PASSWORD('password') WHERE user='root';
|
||||||
|
mysql> FLUSH PRIVILEGES;
|
||||||
|
```
|
||||||
|
|
||||||
|
ou (MySQL 5.6)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sh-3.2# mysql -u root
|
||||||
|
mysql> FLUSH PRIVILEGES;
|
||||||
|
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Se connecter avec le nouveau password:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mysql -u root -p Enter password:
|
||||||
|
```
|
||||||
|
|
||||||
8
docs/MySQL/Socket-error.md
Normal file
8
docs/MySQL/Socket-error.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Fix the 2002 MySQL Socket error (OSX)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo mkdir /var/mysql
|
||||||
|
|
||||||
|
$ sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
|
||||||
|
```
|
||||||
|
|
||||||
21
docs/MySQL/diverses.md
Normal file
21
docs/MySQL/diverses.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Commandes diverses
|
||||||
|
|
||||||
|
#### Arrêter MySQL:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo /usr/local/mysql/support-files/mysql.server stop
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Démarrer MySQL:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo /usr/local/mysql/support-files/mysql.server start
|
||||||
|
```
|
||||||
|
|
||||||
|
*Sous OSX, utiliser le PrefPane et pas les commandes (package MySQL officiel).*
|
||||||
|
|
||||||
|
#### Version de MySQL:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mysql -v
|
||||||
|
```
|
||||||
24
docs/MySQL/index.md
Normal file
24
docs/MySQL/index.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# MySQL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[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/)
|
||||||
|
|
||||||
|
[:fa-link: https://coolestguidesontheplanet.com/how-to-change-the-mysql-root-password/](https://coolestguidesontheplanet.com/how-to-change-the-mysql-root-password/)
|
||||||
|
|
||||||
|
[: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)
|
||||||
|
|
||||||
68
docs/MySQL/mysqlcheck.md
Normal file
68
docs/MySQL/mysqlcheck.md
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
# mysqlcheck
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Vérification d'une table:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mysqlcheck -c funnymac download -u root -p
|
||||||
|
Enter password:
|
||||||
|
funnymac.download OK
|
||||||
|
```
|
||||||
|
|
||||||
|
### Vérification de toutes les tables d'une base:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mysqlcheck -c funnymac -u root -p
|
||||||
|
Enter password:
|
||||||
|
funnymac.download OK
|
||||||
|
funnymac.downloads OK
|
||||||
|
funnymac.eggs OK
|
||||||
|
funnymac.ipod OK
|
||||||
|
funnymac.ipod_news OK
|
||||||
|
funnymac.ipod_vers OK
|
||||||
|
funnymac.liens OK
|
||||||
|
funnymac.livre OK
|
||||||
|
funnymac.note OK
|
||||||
|
funnymac.numeric_info OK
|
||||||
|
funnymac.numeric_log OK
|
||||||
|
funnymac.numeric_vers OK
|
||||||
|
funnymac.tips OK
|
||||||
|
funnymac.truc OK
|
||||||
|
funnymac.vote OK
|
||||||
|
```
|
||||||
|
|
||||||
|
### Vérification de toutes les bases:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mysqlcheck -c -u root -p –all-databases
|
||||||
|
```
|
||||||
|
|
||||||
|
### Vérification de certaines bases:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mysqlcheck -c -u root -p –databases funnymac zenphoto
|
||||||
|
```
|
||||||
|
|
||||||
|
### Optimiser une table:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mysqlcheck -o funnymac download -u root -p
|
||||||
|
Enter password:
|
||||||
|
funnymac.download OK
|
||||||
|
```
|
||||||
|
|
||||||
|
### Réparer une table:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mysqlcheck -r funnymac download -u root -p
|
||||||
|
Enter password:
|
||||||
|
funnymac.download OK
|
||||||
|
```
|
||||||
|
|
||||||
|
### Combiner Vérifier, Optimiser et Réparer:
|
||||||
|
|
||||||
|
!!! attention
|
||||||
|
Ne semble pas fonctionner sous OSX
|
||||||
|
|
||||||
|
|
||||||
92
docs/Plesk/Ghost.md
Normal file
92
docs/Plesk/Ghost.md
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
# Installer Ghost
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer ghost-cli:
|
||||||
|
|
||||||
|
Se connecter au serveur comme root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh root@mon_vps
|
||||||
|
```
|
||||||
|
|
||||||
|
Ghost [requiert](https://docs.ghost.org/docs/supported-node-versions) l'installation de [node.js](https://nodejs.org/)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@localhost:~# /opt/plesk/node/8/bin/npm install -g ghost-cli
|
||||||
|
|
||||||
|
/opt/plesk/node/8/bin/ghost -> /opt/plesk/node/8/lib/node_modules/ghost-cli/bin/ghost
|
||||||
|
+ ghost-cli@1.9.3
|
||||||
|
added 387 packages in 18.168s
|
||||||
|
```
|
||||||
|
|
||||||
|
Se connecter au serveur comme utilisateur
|
||||||
|
|
||||||
|
```bash
|
||||||
|
httpuser@localhost:~$ echo 'PATH=$PATH:/opt/plesk/node/8/bin/' >> .profile
|
||||||
|
httpuser@localhost:~$ echo 'export PATH' >> .profile
|
||||||
|
httpuser@localhost:~$ source .profile
|
||||||
|
```
|
||||||
|
|
||||||
|
Vérifier que ghost-cli est bien installé:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
httpuser@localhost:~$ ghost version
|
||||||
|
|
||||||
|
Ghost-CLI version: 1.9.3:
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer ghost:
|
||||||
|
|
||||||
|
Créer un dossier **ghost** sur le serveur:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@localhost:~$ cd httpdocs/
|
||||||
|
bruno@localhost:~/httpdocs$ mkdir ghost
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer Ghost:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@localhost:~/httpdocs/ghost$ ghost install local
|
||||||
|
|
||||||
|
✔ Checking system Node.js version
|
||||||
|
✔ Checking current folder permissions
|
||||||
|
✔ Checking memory availability
|
||||||
|
✔ Checking for latest Ghost version
|
||||||
|
✔ Setting up install directory
|
||||||
|
✔ Downloading and installing Ghost v2.1.1
|
||||||
|
✔ Finishing install process
|
||||||
|
✔ Configuring Ghost
|
||||||
|
✔ Setting up instance
|
||||||
|
ℹ Ensuring user is not logged in as ghost user [skipped]
|
||||||
|
ℹ Checking if logged in user is directory owner [skipped]
|
||||||
|
✔ Checking current folder permissions
|
||||||
|
✔ Validating config
|
||||||
|
✔ Checking memory availability
|
||||||
|
✔ Starting Ghost
|
||||||
|
|
||||||
|
You can access your publication at http://localhost:2368/
|
||||||
|
Next, go to to your admin interface at http://localhost:2368/ghost/ to complete the setup of your publication
|
||||||
|
|
||||||
|
Ghost uses direct mail by default
|
||||||
|
To set up an alternative email method read our docs at https://docs.ghost.org/docs/mail-config
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://docs.ghost.org/docs/install
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer ghost (avec Docker):
|
||||||
|
|
||||||
|
Cliquer sur Docker
|
||||||
|
|
||||||
|
Rechercher ghost dans le catalogue d'images Docker
|
||||||
|
|
||||||
|
Sur l'image ghost (officiel), cliquer sur exécuter
|
||||||
|
|
||||||
|
Cocher Démarrage automatique après redémarrage du système
|
||||||
64
docs/Plesk/index.md
Normal file
64
docs/Plesk/index.md
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
# Plesk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~# plesk
|
||||||
|
Usage: plesk [command]
|
||||||
|
|
||||||
|
Commands:
|
||||||
|
bin - Run the specified Plesk command-line utility (e.g., domain, client)
|
||||||
|
conf - Open the specified Plesk configuration file in the editor
|
||||||
|
daily - Run daily maintenance script
|
||||||
|
db - Database related commands. Open MySQL console by default.
|
||||||
|
ext - Call a command-line interface of the specified Plesk extension
|
||||||
|
help - Show help and exit
|
||||||
|
installer - Parallels Installer shortcuts and command completion
|
||||||
|
log - Open the specified Plesk configuration file in the editor
|
||||||
|
login - generate login link for specified user
|
||||||
|
php - Run a PHP script using the Plesk PHP interpreter
|
||||||
|
repair - Check and repair Plesk
|
||||||
|
sbin - Run the specified Plesk internal utility
|
||||||
|
version - Show product version information
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
plesk installer --select-release-current --install-component php7.2
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Réparer Plesk:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ plesk installer --select-release-current --reinstall-patch --upgrade-installed-components
|
||||||
|
|
||||||
|
$ plesk repair installation
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Tester la zone DNS:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# plesk bin dns --info maboiteverte.fr
|
||||||
|
|
||||||
|
www.maboiteverte.fr. CNAME maboiteverte.fr.
|
||||||
|
_dmarc.maboiteverte.fr. TXT v=DMARC1; p=none
|
||||||
|
maboiteverte.fr. TXT v=spf1 +a +mx +a:localhost.localdomain -all
|
||||||
|
ftp.maboiteverte.fr. CNAME maboiteverte.fr.
|
||||||
|
ipv4.maboiteverte.fr. A 212.227.191.167
|
||||||
|
mail.maboiteverte.fr. A 212.227.191.167
|
||||||
|
maboiteverte.fr. MX 10 mail.maboiteverte.fr.
|
||||||
|
webmail.maboiteverte.fr. A 212.227.191.167
|
||||||
|
maboiteverte.fr. A 212.227.191.167
|
||||||
|
ns2.maboiteverte.fr. A 212.227.191.167
|
||||||
|
maboiteverte.fr. NS ns2.maboiteverte.fr.
|
||||||
|
ns1.maboiteverte.fr. A 212.227.191.167
|
||||||
|
maboiteverte.fr. NS ns1.maboiteverte.fr.
|
||||||
|
|
||||||
|
SUCCESS: Getting information for Domain 'maboiteverte.fr' complete.
|
||||||
|
```
|
||||||
|
|
||||||
BIN
docs/Raspberry/.DS_Store
vendored
Normal file
BIN
docs/Raspberry/.DS_Store
vendored
Normal file
Binary file not shown.
104
docs/Raspberry/apt-get.md
Normal file
104
docs/Raspberry/apt-get.md
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
# apt-get & apt-cache
|
||||||
|
|
||||||
|
#### Mettre à jour met à jour la liste des fichiers disponibles dans les dépôts APT:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get update
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Mettre à jour tous les paquets installés sur le système:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get upgrade
|
||||||
|
```
|
||||||
|
|
||||||
|
**Si après sudo apt-get upgrade, on a le message « Les paquets suivants ont été conservés : »:**
|
||||||
|
|
||||||
|
il faut faire un apt-get dist-upgrade, c’est parce que la mise a jour de ces paquets nécessite la mise a jour d’autres paquets plus importants”.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get dist-upgrade
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Supprimer les paquets inutiles et fichiers config:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get remove -y --purge wolfram-engine minecraft-pi sonic-pi
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Désinstalle les paquets indiqués et leurs fichiers de configuration :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Les fichiers de préférences et les logs sont conservés.
|
||||||
|
|
||||||
|
$ sudo apt-get purge <paquets>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Désinstalle les paquets indiqués, les dépendances logicielles et leurs fichiers de configuration:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Les fichiers de préférences et les logs sont conservés.
|
||||||
|
|
||||||
|
$ sudo apt-get autoremove --purge <paquets(s)>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Nettoyer et effacer les dépendances avec les packages que vous avez dés-installées:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get autoremove --purge
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Suppression du cache des paquets de apt:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Supprimer la totalité des paquets présents dans /var/cache/apt/archives
|
||||||
|
|
||||||
|
$ sudo apt-get clean
|
||||||
|
|
||||||
|
# Supprimer les paquets présents dans /var/cache/apt/archives , mais en conservant ceux qui ont un équivalent dans les dépôts.
|
||||||
|
|
||||||
|
$ sudo apt-get autoclean
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Mise à jour générale:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get update && sudo apt-get upgrade -y
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Liste des m-à-j disponibles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get update && sudo apt-get -u upgrade --assume-no
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Chercher un package:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ apt-cache search vim
|
||||||
|
|
||||||
|
$ apt-cache search vim | more
|
||||||
|
|
||||||
|
$ apt-cache search vim | grep 'word'
|
||||||
|
|
||||||
|
$ apt-cache search ^vim
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Afficher les dépendances d’un package:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ apt-cache depends package
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Afficher les infos sur un package:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ apt-cache show< package>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Affiche le nom de chaque paquet connu par APT:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ apt-cache pkgnames —generate
|
||||||
|
```
|
||||||
|
|
||||||
98
docs/Raspberry/aptitude.md
Normal file
98
docs/Raspberry/aptitude.md
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
# aptitude
|
||||||
|
|
||||||
|
https://debian-facile.org/doc:systeme:apt:aptitude
|
||||||
|
|
||||||
|
#### Mettre à jour met à jour la liste des paquets:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo aptitude update
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Mettre à jour tous les paquets installés sur le système:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo aptitude safe-upgrade
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Pour les mises à jour nécessitant d'installer ou de désinstaller les dépendances nécessaires : ( message « Les paquets suivants ont été conservés : »)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo aptitude full-upgrade
|
||||||
|
|
||||||
|
# idem à $ sudo aptitude dist-upgrade
|
||||||
|
```
|
||||||
|
|
||||||
|
#### **Installer un paquet :**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo aptitude install <paquet>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Supprimer un paquet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Les fichiers de préférences et les logs sont conservés.
|
||||||
|
|
||||||
|
$ sudo aptitude remove <paquets>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Supprimer les paquets indiqués et leurs fichiers de configuration :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Les fichiers de préférences et les logs sont conservés.
|
||||||
|
|
||||||
|
$ sudo aptitude purge <paquets>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### **Supprimer un paquet en le mettant "automatique"**
|
||||||
|
|
||||||
|
(celui-ci sera soit désinstallé tout de suite, soit automatiquement désinstallé dès que plus aucun autre paquet n'aura besoin de lui) :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo aptitude markauto <paquet-a-liberer>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Chercher un paquet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo aptitude search wge
|
||||||
|
```
|
||||||
|
|
||||||
|
**Indicateurs de réponse**
|
||||||
|
|
||||||
|
i le paquet est installé et toutes ses dépendances sont satisfaites
|
||||||
|
|
||||||
|
c le paquet a été supprimé mais ses fichiers de configuration sont toujours présents sur le système
|
||||||
|
|
||||||
|
p le paquet et tous ses fichiers de configuration ont été supprimés, ou le paquet n'a jamais été installé
|
||||||
|
|
||||||
|
v le paquet est virtuel
|
||||||
|
|
||||||
|
B le paquet a des dépendances cassées
|
||||||
|
|
||||||
|
A le paquet a été automatiquement installé
|
||||||
|
|
||||||
|
#### **Vérifier si un paquet est installé** :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo aptitude show wget
|
||||||
|
```
|
||||||
|
|
||||||
|
#### **Liste des packages non à jour:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo aptitude search '~U'
|
||||||
|
```
|
||||||
|
|
||||||
|
#### **Dépendances du paquet** :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo aptitude search ~R wget
|
||||||
|
```
|
||||||
|
|
||||||
|
#### **Dépendances inverses du paquet** :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo aptitude search ~D wget
|
||||||
|
```
|
||||||
|
|
||||||
98
docs/Raspberry/backup.md
Normal file
98
docs/Raspberry/backup.md
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
# Backup
|
||||||
|
|
||||||
|
### Avec sshpass (MdP en clair)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get install sshpass
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
\#!/bin/bash
|
||||||
|
|
||||||
|
sudo sshpass -p "password" rsync -avzO --exclude='@eaDir' -e ssh bruno@192.168.1.7:/var/services/homes/bruno/CloudStation/Drive/Raspberry :/var/services/homes/bruno/CloudStation/Drive/Unix /home/pi/Documents
|
||||||
|
```
|
||||||
|
|
||||||
|
Sauver avec CTRL-O (Return) et quitter avec CTRL-X (Return)
|
||||||
|
|
||||||
|
### Par clé
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ ssh-keygen -t rsa -C pi@framboise
|
||||||
|
|
||||||
|
$ cat ~/.ssh/id_rsa.pub | ssh bruno@192.168.1.7 -p42666 'cat >> .ssh/authorized_keys'
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
\#!/bin/bash
|
||||||
|
|
||||||
|
rsync -avzO --exclude='@eaDir' -e ssh bruno@192.168.1.7:/var/services/homes/bruno/CloudStation/Drive/Raspberry :/var/services/homes/bruno/CloudStation/Drive/Unix /home/pi/Documents
|
||||||
|
|
||||||
|
\# option -O pour éviter l’erreur:
|
||||||
|
|
||||||
|
\# rsync: failed to set times on "/home/pi/Documents/Unix": Operation not permitted (1)
|
||||||
|
```
|
||||||
|
|
||||||
|
Sauver avec CTRL-O (Return) et quitter avec CTRL-X (Return)
|
||||||
|
|
||||||
|
Rendre le script exécutable
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo chmod +x /home/pi/sync.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Ajouter le script à cron:
|
||||||
|
|
||||||
|
Créer une crontab pour l'utilisateur pi
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pi@framboise:~ $ crontab -u pi -e
|
||||||
|
|
||||||
|
no crontab for pi - using an empty one
|
||||||
|
|
||||||
|
Select an editor. To change later, run 'select-editor'.
|
||||||
|
|
||||||
|
1. /bin/ed
|
||||||
|
2. /bin/nano <---- easiest
|
||||||
|
3. /usr/bin/vim.tiny
|
||||||
|
|
||||||
|
Choose 1-3 [2]: 2
|
||||||
|
|
||||||
|
crontab: installing new crontab
|
||||||
|
```
|
||||||
|
|
||||||
|
Editer la crontab utilisateur (pi)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pi@framboise:~ $ crontab -e
|
||||||
|
```
|
||||||
|
|
||||||
|
Ajouter la ligne
|
||||||
|
|
||||||
|
`*/5 * * * * /home/pi/Documents/sync.sh >> /home/pi/sync.log 2>&1`
|
||||||
|
|
||||||
|
Le script sync.sh est exécuté toutes les 5mn.
|
||||||
|
|
||||||
|
STDOUT est redirigé sur sync.log et STDERR aussi.
|
||||||
|
|
||||||
|
Redirection du flux de sortie (STDOUT): >/dev/null
|
||||||
|
|
||||||
|
Rediriger uniquement STDERR: 2>/dev/null
|
||||||
|
|
||||||
|
Rediriger STDERR là où est redirigé STDOUT: 2>&1
|
||||||
|
|
||||||
|
Si les sorties ne sont redirigées, erreur dans /var/syslog
|
||||||
|
|
||||||
|
```bash
|
||||||
|
CRON[8380]: (CRON) info (No MTA installed, discarding output)
|
||||||
|
|
||||||
|
(pas de Mail Transfer Agent, ie Postfix, Mutt…)
|
||||||
|
```
|
||||||
|
|
||||||
|
Lire la crontab utilisateur (pi)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pi@framboise:~ $ crontab -l
|
||||||
|
```
|
||||||
|
|
||||||
56
docs/Raspberry/boot.md
Normal file
56
docs/Raspberry/boot.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Boot et clone
|
||||||
|
|
||||||
|
#### Mise à jour du Raspberry:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#version du firmware
|
||||||
|
$ uname -a
|
||||||
|
|
||||||
|
#mise à jour du dépot
|
||||||
|
$ sudo apt-get update
|
||||||
|
|
||||||
|
#mise à jour du système
|
||||||
|
$ sudo apt-get upgrade
|
||||||
|
|
||||||
|
#mise à jour firmware
|
||||||
|
$ sudo apt-get install raspberrypi-bootloader
|
||||||
|
|
||||||
|
$ sudo reboot
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Backup de la SD card:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh pi@raspberrypi.local sudo dd if=/dev/mmcblk0 | pv | gzip -c> raspberry.img.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### cmdline.txt original de la SD:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### boot sur le mSSD:
|
||||||
|
|
||||||
|
Modifier la cmdline.txt avec root=/dev/sda2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Cloner la SD sur le mSSD:
|
||||||
|
|
||||||
|
[:fa-link: https://github.com/billw2/rpi-clone](https://github.com/billw2/rpi-clone)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#1er clone
|
||||||
|
$ sudo rpi-clone sda -f -s framboise
|
||||||
|
|
||||||
|
#Clones suivants
|
||||||
|
$ sudo rpi-clone sda -s framboise
|
||||||
|
```
|
||||||
|
|
||||||
154
docs/Raspberry/divers.md
Normal file
154
docs/Raspberry/divers.md
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
# Raspberry (divers)
|
||||||
|
|
||||||
|
#### Installer le correcteur orthographique français:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get install myspell-fr
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Installer LibreOffice français:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get install libreoffice-l10n-fr
|
||||||
|
|
||||||
|
$ sudo apt-get install myspell-fr
|
||||||
|
|
||||||
|
$ sudo apt-get install hyphen-fr
|
||||||
|
|
||||||
|
$ sudo apt-get install mythes-fr
|
||||||
|
|
||||||
|
$ sudo apt-get install libreoffice-help-fr
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Installer avec Git:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /SourceCache
|
||||||
|
git clone https://github.com/gerard/ext4fuse.git
|
||||||
|
cd ext4fuse
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Installer une appli depuis un .deb:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pi@framboise:~/Downloads $ wget http://www.bristolwatch.com/rpi/dl/beaver_0.4.1-1_armhf.deb
|
||||||
|
|
||||||
|
pi@framboise:~/Downloads $ sudo dpkg -i beaver_0.4.1-1_armhf.deb
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Editer un fichier de config:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo leafpad /etc/samba/smb.conf &
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Virer les fichiers .DS_Store:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ find /my/data/to/move -name '*.DS_Store' -type f -delete
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Installer clé bluetooth (pas utile avec Raspian):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ lsusb
|
||||||
|
$ update-rc.d -f dbus defaults
|
||||||
|
$ apt-get install bluetooth bluez-utils blueman
|
||||||
|
$ hcitool scan
|
||||||
|
```
|
||||||
|
|
||||||
|
[:fa-link: http://blog.petrilopia.net/linux/raspberry-pi-bluetooth-keyboard-work/](http://blog.petrilopia.net/linux/raspberry-pi-bluetooth-keyboard-work/)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Installer clé wifi (pas utile avec Raspian):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get install wicd
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Permissions:
|
||||||
|
|
||||||
|
Donner les permissions exécutable
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chmod +x ./subfolder/anexecutablefile.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Retirer er les permissions exécutable
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chmod -x ./subfolder/anexecutablefile.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Donner les permissions lecture/écriture
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chmod +rw .anexecutablefile.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### blkid
|
||||||
|
|
||||||
|
locate/print block device attributes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pi@framboise:/media/pi/boot $ blkid
|
||||||
|
|
||||||
|
/dev/mmcblk0p1: LABEL="boot" UUID="E5B7-FEA1" TYPE="vfat" PARTUUID="1b38a7cf-01"
|
||||||
|
|
||||||
|
/dev/mmcblk0p2: UUID="b4ea8e46-fe87-4ddd-9e94-506c37005ac5" TYPE="ext4" PARTUUID="1b38a7cf-02"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### lsblk
|
||||||
|
|
||||||
|
list block devices
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pi@framboise:~/Downloads/Ted-2.23 $ lsblk
|
||||||
|
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||||
|
sda 8:0 0 29,8G 0 disk
|
||||||
|
|-sda1 8:1 0 41,8M 0 part /boot
|
||||||
|
`-sda2 8:2 0 29,8G 0 part /
|
||||||
|
mmcblk0 179:0 0 29,7G 0 disk
|
||||||
|
|-mmcblk0p1 179:1 0 41,8M 0 part /media/pi/boot
|
||||||
|
`-mmcblk0p2 179:2 0 29,7G 0 part /media/pi/b4ea8e46-fe87-4ddd-9e94-506c37005ac5
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### df -h
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pi@framboise:~ $ df -h
|
||||||
|
|
||||||
|
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
|
||||||
|
/dev/root 30G 3,4G 25G 13% /
|
||||||
|
devtmpfs 460M 0 460M 0% /dev
|
||||||
|
tmpfs 464M 80M 385M 18% /dev/shm
|
||||||
|
tmpfs 464M 13M 452M 3% /run
|
||||||
|
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
|
||||||
|
tmpfs 464M 0 464M 0% /sys/fs/cgroup
|
||||||
|
/dev/sda1 42M 21M 21M 51% /boot
|
||||||
|
tmpfs 93M 8,0K 93M 1% /run/user/1000
|
||||||
|
/dev/mmcblk0p2 30G 3,3G 25G 12% /media/pi/b4ea8e46-fe87-4ddd-9e94-506c37005ac5
|
||||||
|
/dev/mmcblk0p1 42M 21M 21M 51% /media/pi/boot
|
||||||
|
```
|
||||||
|
|
||||||
13
docs/Raspberry/index.md
Normal file
13
docs/Raspberry/index.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Raspberry
|
||||||
|
|
||||||
|
[Backup](backup.md)
|
||||||
|
|
||||||
|
[Commandes apt-get & apt-cache](apt-get.md)
|
||||||
|
|
||||||
|
[Réseau](reseau.md)
|
||||||
|
|
||||||
|
[Boot et clone](boot.md)
|
||||||
|
|
||||||
|
[Bouton du Pi Desktop](pi-desktop.md)
|
||||||
|
|
||||||
|
[Divers](divers.md)
|
||||||
23
docs/Raspberry/pi-desktop.md
Normal file
23
docs/Raspberry/pi-desktop.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Pi Desktop
|
||||||
|
|
||||||
|
### Télécharger le paquet Pi Desktop:
|
||||||
|
|
||||||
|
https://github.com/pi-desktop/deb-make/releases
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer Pi Desktop:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo dpkg -i pidesktop-base-1.1.0.deb
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Bouton du Pi Desktop:
|
||||||
|
|
||||||
|
- Lorsque vous appuyez **une fois rapidement (plus de 150mS)** sur le bouton A/M, le Raspberry Pi **démarre**
|
||||||
|
- Lorsque vous appuyez **plus longuement (plus de 2 secondes)** sur le bouton A/M, le programme de gestion **arrête proprement le Raspberry Pi** (le système s’arrête normalement) puis **coupe l’alimentation**.
|
||||||
|
- Lorsque vous appuyez **très longuement (plus de 5 secondes)** sur le bouton A/M, le programme de gestion **arrête le Raspberry Pi à « la sauvage »** en coupant l’alimentation.
|
||||||
|
|
||||||
|
|
||||||
105
docs/Raspberry/reseau.md
Normal file
105
docs/Raspberry/reseau.md
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
# Réseau et partage
|
||||||
|
|
||||||
|
#### Mettre en IP fixe:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo nano /etc/dhcpcd.conf
|
||||||
|
|
||||||
|
à rajouter à la fin du fichier:
|
||||||
|
|
||||||
|
interface eth0
|
||||||
|
|
||||||
|
static ip_address=192.168.1.254/24
|
||||||
|
|
||||||
|
static routers=192.168.1.1
|
||||||
|
|
||||||
|
static domain_name_servers=8.8.8.8
|
||||||
|
|
||||||
|
interface wlan0
|
||||||
|
|
||||||
|
static ip_address=192.168.1.253/24
|
||||||
|
|
||||||
|
static routers=192.168.1.1
|
||||||
|
|
||||||
|
static domain_name_servers=8.8.8.8
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### VNC:
|
||||||
|
|
||||||
|
*VNC Server (Pi):*
|
||||||
|
|
||||||
|
Menu → Options:
|
||||||
|
|
||||||
|
- Sécurité:
|
||||||
|
|
||||||
|
- Chiffrement: De préférence actif
|
||||||
|
- Authentification: Mot de passe VNC
|
||||||
|
|
||||||
|
- Utilisateurs et autorisations:
|
||||||
|
|
||||||
|
- Utilisateur standart: Mot de passe
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*VNC Viewer (Mac):*
|
||||||
|
|
||||||
|
Port 5900
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Installer Samba:
|
||||||
|
|
||||||
|
Installer et créer un répertoire partagé:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get install apt-transport-https samba samba-common-bin
|
||||||
|
$ sudo mkdir -p /home/pi/share
|
||||||
|
$ sudo chown -hR pi:pi /home/pi/share
|
||||||
|
$ sudo chmod 777 /home/pi/share
|
||||||
|
```
|
||||||
|
|
||||||
|
Editer le fichier smb.conf:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo nano /etc/samba/smb.conf
|
||||||
|
|
||||||
|
## Browsing/Identification ###
|
||||||
|
# Change this to the workgroup/NT-domain name your Samba server will part of
|
||||||
|
workgroup = WORKGROUP
|
||||||
|
wins support = yes
|
||||||
|
|
||||||
|
####### Authentication #######
|
||||||
|
security = user
|
||||||
|
|
||||||
|
[Share]
|
||||||
|
comment = Partage Samba sur Raspberry
|
||||||
|
path=/home/pi/share
|
||||||
|
browseable=Yes
|
||||||
|
writeable=Yes
|
||||||
|
only guest=no
|
||||||
|
create mask=0777
|
||||||
|
directory mask=0777
|
||||||
|
public=no
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un utilisateur Samba:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo smbpasswd –a pi
|
||||||
|
|
||||||
|
$ testparm
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Liens:
|
||||||
|
|
||||||
|
[:fa-link: http://nagashur.com/blog/2016/07/21/partage-de-fichiers-samba-avec-le-raspberry-pi/](http://nagashur.com/blog/2016/07/21/partage-de-fichiers-samba-avec-le-raspberry-pi/)
|
||||||
|
|
||||||
|
[:fa-link: https://gist.github.com/masterT/407a6d9e30ba4169bb39](https://gist.github.com/masterT/407a6d9e30ba4169bb39)
|
||||||
|
|
||||||
|
[:fa-link: http://www.framboise314.fr/partager-un-repertoire-sous-jessie-avec-samba/](http://www.framboise314.fr/partager-un-repertoire-sous-jessie-avec-samba/)
|
||||||
BIN
docs/Synology/.DS_Store
vendored
Normal file
BIN
docs/Synology/.DS_Store
vendored
Normal file
Binary file not shown.
81
docs/Synology/bash.md
Normal file
81
docs/Synology/bash.md
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
# Bash
|
||||||
|
|
||||||
|
### Installer le shell Bash:
|
||||||
|
|
||||||
|
Se connecter sous root
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh root@192.168.0.8
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer le package **Bash** avec **ipkg**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation$> ipkg install -A bash
|
||||||
|
```
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
Pour avoir bash au log-in, il faut éditer le fichier **/etc/passwd**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation$> nano /etc/passwd
|
||||||
|
```
|
||||||
|
|
||||||
|
et remplacer la ligne
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root:x:0:0:root:/root:/bin/ash
|
||||||
|
```
|
||||||
|
|
||||||
|
par
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root:x:0:0:root:/root:/bin/bash
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! attention "Attention, une m-à-j Synology peut supprimer /opt/bin/bash."
|
||||||
|
Aussi, il est préférable de garder ash pour se logger et de démarrer bash ensuite.
|
||||||
|
|
||||||
|
On va éditer le fichier .profile
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation$> nano .profile
|
||||||
|
```
|
||||||
|
|
||||||
|
et y ajouter les lignes suivantes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [[ -x /opt/bin/bash ]]; then
|
||||||
|
exec /opt/bin/bash
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
Pour configurer bash, on va créer un fichier .bashrc
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation$> nano .bashrc
|
||||||
|
```
|
||||||
|
|
||||||
|
et y ajouter
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#prompt
|
||||||
|
|
||||||
|
PS1='\u@\h:\w \$ '
|
||||||
|
|
||||||
|
#renseigne la variable SHELL
|
||||||
|
|
||||||
|
export SHELL=/opt/bin/bash
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! attention "Il est préférable de se logger une première fois avec en root avec ash et de faire la manip dans une 2nde fenêtre."
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[http://tldp.org/LDP/abs/html/index.html](http://tldp.org/LDP/abs/html/index.html)
|
||||||
|
|
||||||
440
docs/Synology/dsm6.md
Normal file
440
docs/Synology/dsm6.md
Normal file
@@ -0,0 +1,440 @@
|
|||||||
|
# DSM 6
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Dossiers utilisateurs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ pwd
|
||||||
|
/var/services/homes/bruno
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DS916:~# pwd
|
||||||
|
/root
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Se connecter en root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo -su root
|
||||||
|
Password:
|
||||||
|
sh-4.3#
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo -i
|
||||||
|
root@DS916:~#
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Services:
|
||||||
|
|
||||||
|
#### Afficher la liste des services
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DS916:~# synoservicecfg --list
|
||||||
|
DSM
|
||||||
|
apparmor
|
||||||
|
atalk
|
||||||
|
avahi
|
||||||
|
bluetoothd
|
||||||
|
bonjour
|
||||||
|
btacd
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Gérer les services de DSM
|
||||||
|
|
||||||
|
```bash
|
||||||
|
synoservicecfg --list
|
||||||
|
|
||||||
|
synoservice --status
|
||||||
|
|
||||||
|
synoservicecfg --stop <service>
|
||||||
|
|
||||||
|
synoservicecfg --hard-stop <service>
|
||||||
|
|
||||||
|
synoservicecfg --start <service>
|
||||||
|
|
||||||
|
synoservicecfg --hard-start <service>
|
||||||
|
|
||||||
|
synoservice --restart <service>
|
||||||
|
|
||||||
|
synoservicectl --restart <service>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Redémarrer un service
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/usr/syno/sbin/synoservicecfg -restart syslog-acc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Afficher les logs de connection ssh dans /var/log/message:
|
||||||
|
|
||||||
|
- Créer en tant que root le fichier /usr/local/etc/syslog-ng/patterndb.d/sshd.conf comme suit :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
filter f_messages {
|
||||||
|
level(info..emerg)
|
||||||
|
and not facility( mail, news, cron)
|
||||||
|
and not program(syslog-ng)
|
||||||
|
and not filter(f_local)
|
||||||
|
and not filter(f_synology);
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
- Faire un chmod 644 sur le fichier /usr/local/etc/syslog-ng/patterndb.d/sshd.conf créé.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DS414> cd /usr/local/etc/syslog-ng/patterndb.d/
|
||||||
|
-rw-rw-rw- 1 root root 454 Jul 16 19:15 sshd.conf
|
||||||
|
-rw-r--r-- 1 root root 454 Jul 11 15:15 VideoStation.conf
|
||||||
|
DS414> chmod 644 sshd.conf
|
||||||
|
-rw-r--r-- 1 root root 454 Jul 16 19:15 sshd.conf
|
||||||
|
-rw-r--r-- 1 root root 454 Jul 11 15:15 VideoStation.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
- Relancer le syslog pour prise en compte du fichier (sinon un reboot du NAS) :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DS414> synoservicecfg --restart syslog-acc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer un paquet .deb
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# echec pour un problème de signature
|
||||||
|
$ sudo dpkg -i nano_2.7.4-1_i386.deb
|
||||||
|
Password:
|
||||||
|
Authenticating nano_2.7.4-1_i386.deb ...
|
||||||
|
debsig: Origin Signature check failed. This deb might not be signed.
|
||||||
|
|
||||||
|
dpkg: error processing nano_2.7.4-1_i386.deb (--install):
|
||||||
|
verification on package nano_2.7.4-1_i386.deb failed!
|
||||||
|
Errors were encountered while processing:
|
||||||
|
nano_2.7.4-1_i386.deb
|
||||||
|
|
||||||
|
# option --force-bad-verify
|
||||||
|
$ sudo dpkg -i --force-bad-verify nano_2.7.4-1_amd64.deb
|
||||||
|
Authenticating nano_2.7.4-1_amd64.deb ...
|
||||||
|
debsig: Origin Signature check failed. This deb might not be signed.
|
||||||
|
|
||||||
|
dpkg: verification on package nano_2.7.4-1_amd64.deb failed; but installing anyway as you requested
|
||||||
|
Selecting previously unselected package nano.
|
||||||
|
(Reading database ... 118 files and directories currently installed.)
|
||||||
|
Unpacking nano (from nano_2.7.4-1_amd64.deb) ...
|
||||||
|
|
||||||
|
# supprimer le paquet debsig-verify
|
||||||
|
$ dpkg --purge dpkg-verify
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Apache:
|
||||||
|
|
||||||
|
#### Configuration:
|
||||||
|
|
||||||
|
Les fichiers .conf se trouvent dans `/usr/local/etc/apache22 `ou `/usr/local/etc/apache24`
|
||||||
|
|
||||||
|
Il est conseillé de faire les modifications dans `/usr/local/etc/apache22/sites-enabled`
|
||||||
|
|
||||||
|
#### Logs:
|
||||||
|
|
||||||
|
Ils sont dans `/var/log/httpd`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/var/log/httpd $ ls -la
|
||||||
|
total 540
|
||||||
|
drwxr-xr-x 2 root root 4096 Nov 16 03:07 .
|
||||||
|
drwxr-xr-x 17 root root 4096 Mar 9 01:15 ..
|
||||||
|
-rw-r--r-- 1 root root 176 Oct 9 10:10 access_log
|
||||||
|
-rw-rw---- 1 system log 146142 Mar 13 09:50 apache22-error_log
|
||||||
|
-rw-rw---- 1 system log 58824 Nov 16 02:05 apache22-error_log.1.xz
|
||||||
|
-rw-rw---- 1 system log 25992 Dec 11 2016 apache22-error_log.2.xz
|
||||||
|
-rw-rw---- 1 system log 2106 Jan 9 2017 apache24-error_log
|
||||||
|
-rw-r--r-- 1 root root 363 Oct 9 10:09 error_log
|
||||||
|
-rw-rw---- 1 system log 283282 Nov 2 2016 user-error_log
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Redémarrer Apache:
|
||||||
|
|
||||||
|
`synoservice --restart pkgctl-WebStation`
|
||||||
|
|
||||||
|
`synoservice --restart pkgctl-Apache2.2`
|
||||||
|
|
||||||
|
service [pkgctl-Apache2.2] restart failed, synoerr=[0x2000]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### php7.0
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ php70 --ini
|
||||||
|
Configuration File (php.ini) Path: /usr/local/etc/php70
|
||||||
|
Loaded Configuration File: /usr/local/etc/php70/php.ini
|
||||||
|
Scan for additional .ini files in: /usr/local/etc/php70/conf.d
|
||||||
|
Additional .ini files parsed: /usr/local/etc/php70/conf.d/SYNO.SDS.PhotoStation.ini
|
||||||
|
```
|
||||||
|
|
||||||
|
#### open_basedir
|
||||||
|
|
||||||
|
`/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/dev/urandom:/volume1/dokuwiki:/volume1/Repositories:/volume1/nextcloud`
|
||||||
|
|
||||||
|
#### php.ini
|
||||||
|
|
||||||
|
`extension_dir = "/usr/local/lib/php70/modules"`
|
||||||
|
|
||||||
|
#### logs
|
||||||
|
|
||||||
|
Web Station -> Paramètres PHP-> Paramètres Avancés -> Coeur -> error_log
|
||||||
|
|
||||||
|
#### Connaitre les extensions chargées par PHP CLI:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ php -m
|
||||||
|
[PHP Modules]
|
||||||
|
apcu
|
||||||
|
bz2
|
||||||
|
calendar
|
||||||
|
Core
|
||||||
|
ctype
|
||||||
|
curl
|
||||||
|
date
|
||||||
|
dom
|
||||||
|
exif
|
||||||
|
fileinfo
|
||||||
|
filter
|
||||||
|
gd
|
||||||
|
hash
|
||||||
|
iconv
|
||||||
|
json
|
||||||
|
libxml
|
||||||
|
mbstring
|
||||||
|
mysqlnd
|
||||||
|
openssl
|
||||||
|
pcntl
|
||||||
|
pcre
|
||||||
|
PDO
|
||||||
|
pdo_mysql
|
||||||
|
pdo_pgsql
|
||||||
|
pdo_sqlite
|
||||||
|
pgsql
|
||||||
|
readline
|
||||||
|
Reflection
|
||||||
|
session
|
||||||
|
SimpleXML
|
||||||
|
SPL
|
||||||
|
sqlite3
|
||||||
|
standard
|
||||||
|
tokenizer
|
||||||
|
xml
|
||||||
|
xmlreader
|
||||||
|
xmlwriter
|
||||||
|
Zend OPcache
|
||||||
|
zip
|
||||||
|
zlib
|
||||||
|
|
||||||
|
[Zend Modules]
|
||||||
|
Zend OPcache
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### PHP 7.0.13: curl n'est pas activé:
|
||||||
|
|
||||||
|
- Ouvrir /volume1/@appstore/PHP7.0/misc/extension_list.json
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DS916:/volume1/@appstore/PHP7.0/misc# ls -la
|
||||||
|
total 24
|
||||||
|
drwxr-xr-x 1 root root 134 Jan 7 09:08 .
|
||||||
|
drwxrwxrwx 1 root root 46 Jan 5 17:22 ..
|
||||||
|
-rw-r--r-- 1 root root 5082 Dec 19 12:20 extension_list.json
|
||||||
|
-rw-r--r-- 1 root root 5082 Jan 7 09:08 extension_list.json.bak
|
||||||
|
-rw-r--r-- 1 root root 147 Dec 19 12:20 logrotate.conf
|
||||||
|
-rw-r--r-- 1 root root 174 Dec 19 12:20 syslog.conf
|
||||||
|
root@DS916:/volume1/@appstore/PHP7.0/misc# nano extension_list.json
|
||||||
|
```
|
||||||
|
|
||||||
|
- Ajouter
|
||||||
|
|
||||||
|
```bash
|
||||||
|
"curl": {
|
||||||
|
"enable_default": true,
|
||||||
|
"desc": "The curl extension allows you to connect and communicate to many different types of servers wih many different types of protocols."
|
||||||
|
},
|
||||||
|
```
|
||||||
|
|
||||||
|
- Aller dans Web Station → Paramètres PHP → version 7.0
|
||||||
|
- Cocher, décocher et recocher pour activer l'extension (en appliquant à chaque fois)
|
||||||
|
|
||||||
|
[:fa-link: Source](https://forum.synology.com/enu/viewtopic.php?f=20&t=104368&p=464772#p464534)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Les 3 versions de PHP:
|
||||||
|
|
||||||
|
- PHP 5.6 (BusyBox)
|
||||||
|
/bin/php
|
||||||
|
- PHP 5.6 (Package PHP 5)
|
||||||
|
/usr/local/bin/php56
|
||||||
|
- PHP 7.0 (Package PHP 7)
|
||||||
|
/usr/local/bin/php70
|
||||||
|
|
||||||
|
Pour Apache, c'est la version choisie dans WebStation qui est active.
|
||||||
|
|
||||||
|
<u>En ligne de commande, par défaut, c'est la version Busybox qui est active:</u>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ which php
|
||||||
|
/bin/php
|
||||||
|
|
||||||
|
$ php -v
|
||||||
|
PHP 5.6.11 (cli) (built: Jun 8 2018 15:13:30)
|
||||||
|
Copyright (c) 1997-2015 The PHP Group
|
||||||
|
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
|
||||||
|
|
||||||
|
$ php --ini
|
||||||
|
Configuration File (php.ini) Path: /etc/php
|
||||||
|
Loaded Configuration File: /etc/php/php.ini
|
||||||
|
Scan for additional .ini files in: (none)
|
||||||
|
Additional .ini files parsed: (none)
|
||||||
|
```
|
||||||
|
|
||||||
|
Les 2 autres versions sont néanmoins disponibles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ which php56
|
||||||
|
/usr/local/bin/php56
|
||||||
|
|
||||||
|
$ php56 -v
|
||||||
|
PHP 5.6.36 (cli) (built: May 2 2018 16:13:10)
|
||||||
|
Copyright (c) 1997-2016 The PHP Group
|
||||||
|
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
|
||||||
|
|
||||||
|
$ php56 --ini
|
||||||
|
Configuration File (php.ini) Path: /usr/local/etc/php56
|
||||||
|
Loaded Configuration File: /usr/local/etc/php56/php.ini
|
||||||
|
Scan for additional .ini files in: /usr/local/etc/php56/conf.d
|
||||||
|
Additional .ini files parsed: /usr/local/etc/php56/conf.d/phpMyAdmin.ini,
|
||||||
|
/usr/local/etc/php56/conf.d/webstation-extensions.ini
|
||||||
|
|
||||||
|
|
||||||
|
$ which php70
|
||||||
|
/usr/local/bin/php70
|
||||||
|
|
||||||
|
$ php70 -v
|
||||||
|
PHP 7.0.30 (cli) (built: May 2 2018 16:29:25) ( NTS )
|
||||||
|
Copyright (c) 1997-2017 The PHP Group
|
||||||
|
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
|
||||||
|
with Zend OPcache v7.0.30, Copyright (c) 1999-2017, by Zend Technologies
|
||||||
|
|
||||||
|
$ php70 --ini
|
||||||
|
Configuration File (php.ini) Path: /usr/local/etc/php70
|
||||||
|
Loaded Configuration File: /usr/local/etc/php70/php.ini
|
||||||
|
Scan for additional .ini files in: /usr/local/etc/php70/conf.d
|
||||||
|
Additional .ini files parsed: /usr/local/etc/php70/conf.d/SYNO.SDS.PhotoStation.ini
|
||||||
|
```
|
||||||
|
|
||||||
|
Mettre PHP70 par défaut en CLI:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# On renomme PHP Busybox
|
||||||
|
$ cd /bin
|
||||||
|
$ mv php php_5.6.11
|
||||||
|
$ ls -la
|
||||||
|
-rwxr-xr-x 1 root root 6600840 Jun 8 10:31 php_5.6.11
|
||||||
|
|
||||||
|
# On crée un lien symbolique
|
||||||
|
$ cd /usr/local/bin
|
||||||
|
$ ln -s /var/packages/PHP7.0/target/usr/local/bin/php70 php
|
||||||
|
|
||||||
|
$ which php
|
||||||
|
/usr/local/bin/php
|
||||||
|
|
||||||
|
$ php --ini
|
||||||
|
Configuration File (php.ini) Path: /usr/local/etc/php70
|
||||||
|
Loaded Configuration File: /usr/local/etc/php70/php.ini
|
||||||
|
Scan for additional .ini files in: /usr/local/etc/php70/conf.d
|
||||||
|
Additional .ini files parsed: /usr/local/etc/php70/conf.d/SYNO.SDS.PhotoStation.ini
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Composer:
|
||||||
|
|
||||||
|
<u>Installation:</u>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DS916:/usr/local/bin# curl -s http://getcomposer.org/installer | php70
|
||||||
|
All settings correct for using Composer
|
||||||
|
Downloading...
|
||||||
|
|
||||||
|
Composer (version 1.6.3) successfully installed to: /usr/local/bin/composer.phar
|
||||||
|
Use it: php composer.phar
|
||||||
|
```
|
||||||
|
|
||||||
|
<u>Installation des dépendances de l'application (ici Gitlist):</u>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:/volume1/web/gitlist $ php70 /usr/local/bin/composer.phar install
|
||||||
|
Loading composer repositories with package information
|
||||||
|
Updating dependencies (including require-dev)
|
||||||
|
Package operations: 62 installs, 0 updates, 0 removals
|
||||||
|
|
||||||
|
- Installing symfony/process (v3.4.6): Downloading (100%)
|
||||||
|
```
|
||||||
|
|
||||||
|
<u>Pour simplifier l'utilisation:</u>
|
||||||
|
|
||||||
|
- Créer un script **composer.sh** dans `/usr/local/bin`
|
||||||
|
- Ajouter le contenu suivant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
php70 -d extension=phar.so /usr/local/bin/composer.phar $*
|
||||||
|
```
|
||||||
|
|
||||||
|
- Rendre le script exécutable et le renommer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chmod +X composer.sh
|
||||||
|
|
||||||
|
$ mv composer.sh composer
|
||||||
|
```
|
||||||
|
|
||||||
|
- Utilisation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ composer about
|
||||||
|
Composer - Package Management for PHP
|
||||||
|
Composer is a dependency manager tracking local dependencies of your projects and libraries.
|
||||||
|
See https://getcomposer.org/ for more information.
|
||||||
|
```
|
||||||
|
|
||||||
|
- Mise à jour:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo composer self-update
|
||||||
|
You are already using composer version 1.7.1 (stable channel).
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Erreurs:
|
||||||
|
|
||||||
|
/bin/nano
|
||||||
|
|
||||||
|
nano: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo ln -s /lib/libncurses.so.5.9 /lib/libtinfo.so.5
|
||||||
|
```
|
||||||
|
|
||||||
17
docs/Synology/eadir.md
Normal file
17
docs/Synology/eadir.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Trouver et supprimer les répertoires @eaDir
|
||||||
|
|
||||||
|
### Désactiver les services qui créent ces dossiers:
|
||||||
|
|
||||||
|
Se connecter sous root en ssh, puis:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chmod 000 S66fileindexd.sh S66synoindexd.sh S77synomkthumbd.sh S88synomkflvd.sh S99iTunes.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Supprimer les répertoires @eaDir existants:
|
||||||
|
|
||||||
|
Toujours en ssh, se placer dans le répertoire racine, puis:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find . -type d -name "@eaDir" -print0 | xargs -0 rm -rf
|
||||||
|
```
|
||||||
31
docs/Synology/index.md
Normal file
31
docs/Synology/index.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Synology
|
||||||
|
|
||||||
|
[Installer ipkg et ses packages (DSM5)](opkg/iPKG5.md)
|
||||||
|
|
||||||
|
[Installer ipkg et ses packages (DSM6)](opkg/iPKG6.md)
|
||||||
|
|
||||||
|
[Installer oPKG](opkg/oPKG.md) (Entware)
|
||||||
|
|
||||||
|
[Installer le shell bash](bash.md)
|
||||||
|
|
||||||
|
Installer ownCloud (depuis paquet)
|
||||||
|
|
||||||
|
[Installer ownCloud (depuis archive) (DSM6)](owncloud.md)
|
||||||
|
|
||||||
|
[Dossiers @eaDir](eadir.md)
|
||||||
|
|
||||||
|
[DSM 6](dsm6.md)
|
||||||
|
|
||||||
|
[Scripts](scripts.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Liens:
|
||||||
|
|
||||||
|
[DS916+ Guide d'installation rapide](syno_qig_ds916_fra.pdf)
|
||||||
|
|
||||||
|
[DS414 Guide d'installation rapide](syno_qig_4bay_fra.pdf)
|
||||||
|
|
||||||
|
[DSM 6.1 Guide de l'utilisateur](syno_usersguide_naserver_fra.pdf)
|
||||||
|
|
||||||
|
[:fa-link: Support Synology](https://www.synology.com/fr-fr/support)
|
||||||
83
docs/Synology/opkg/iPKG5.md
Normal file
83
docs/Synology/opkg/iPKG5.md
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
# iPKG (DSM 5)
|
||||||
|
|
||||||
|
### Installer iPKG:
|
||||||
|
|
||||||
|
Se connecter sous root
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh root@192.168.0.8
|
||||||
|
```
|
||||||
|
|
||||||
|
Télécharger et installer le bootstrap
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/syno-mvkw-bootstrap_1.2-7_arm.xsh
|
||||||
|
DiskStation> chmod 700 syno-mvkw-bootstrap_1.2-7_arm.xsh
|
||||||
|
DiskStation> sh syno-mvkw-bootstrap_1.2-7_arm.xsh
|
||||||
|
DiskStation> vi bootstrap.sh #https://github.com/basmussen/ds414-boostrap-dsm5
|
||||||
|
DiskStation> sh bootstrap.sh
|
||||||
|
DiskStation> reboot
|
||||||
|
DiskStation> /opt/bin/ipkg update
|
||||||
|
DiskStation> /opt/bin/ipkg list
|
||||||
|
DiskStation> /opt/bin/ipkg install pkg
|
||||||
|
```
|
||||||
|
|
||||||
|
Nettoyer le dossier /root/ ([:fa-link:http://objnux.1s.fr/index.php?post/2009/11/25/IPKG-sur-SYNOLOGY-ds107](http://objnux.1s.fr/index.php?post/2009/11/25/IPKG-sur-SYNOLOGY-ds107))
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> rm syno*.*
|
||||||
|
DiskStation> rm -Rf bootstrap
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mettre à jour iPKG:
|
||||||
|
|
||||||
|
Se connecter sous root
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh root@192.168.0.8
|
||||||
|
```
|
||||||
|
|
||||||
|
Mettre à jour les paquets installés
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> /opt/bin/ipkg update
|
||||||
|
DiskStation> /opt/bin/ipkg upgrade
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Désinstaller iPKG:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm -rf /volume1/@optware
|
||||||
|
rm -rf /usr/lib/ipkg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Rajouter /opt/bin dans le PATH
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> cd /root
|
||||||
|
DiskStation> /opt/bin/nano .profile
|
||||||
|
|
||||||
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin:/opt/bin
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Configuration de nail:
|
||||||
|
|
||||||
|
Editer le fichier /opt/etc/nail.rc:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
set from="bruno@funnymac.com"
|
||||||
|
set smtp=smtp://smtp.funnymac.com
|
||||||
|
#set smtp-use-starttls
|
||||||
|
set smtp-auth=login
|
||||||
|
set smtp-auth-user=postmaster%funnymac.com
|
||||||
|
set smtp-auth-password=dt7ek7wA
|
||||||
|
set ssl-verify=ignore
|
||||||
|
```
|
||||||
145
docs/Synology/opkg/iPKG6.md
Normal file
145
docs/Synology/opkg/iPKG6.md
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
# iPKG (DSM 6)
|
||||||
|
|
||||||
|
### Installer iPKG:
|
||||||
|
|
||||||
|
Se connecter en root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh bruno@192.168.1.7
|
||||||
|
#puis
|
||||||
|
bruno@DS916:~ $ sudo -i
|
||||||
|
root@DS916:~#
|
||||||
|
```
|
||||||
|
|
||||||
|
Télécharger et installer le bootstrap correspondant au processeur du NAS.
|
||||||
|
|
||||||
|
Pour le DS414 → MARVELL Armada XP MV78230 → processeur ARM v7 avec FPU → ARMv7 EABI hardfloat
|
||||||
|
|
||||||
|
Pour le DS916 → INTEL Pentium N3710
|
||||||
|
|
||||||
|
[Optware-ng](https://github.com/Optware/Optware-ng)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> cd /volume1/@tmp
|
||||||
|
|
||||||
|
# DS414
|
||||||
|
DiskStation> wget -O - http://ipkg.nslu2-linux.org/optware-ng/bootstrap/buildroot-armeabihf-bootstrap.sh | sh
|
||||||
|
# DS916
|
||||||
|
DiskStation> wget -O - http://ipkg.nslu2-linux.org/optware-ng/bootstrap/buildroot-i686-bootstrap.sh | sh
|
||||||
|
|
||||||
|
DiskStation> chmod +x buildroot-armeabihf-bootstrap.sh
|
||||||
|
DiskStation> sh buildroot-armeabihf-bootstrap.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./data.tar.gz
|
||||||
|
./
|
||||||
|
./opt/
|
||||||
|
./opt/bin/
|
||||||
|
./opt/bin/ipkg-static
|
||||||
|
./opt/bin/ipkg
|
||||||
|
./opt/bin/update-alternatives
|
||||||
|
./opt/var/
|
||||||
|
./opt/var/lock/
|
||||||
|
./opt/share/
|
||||||
|
./opt/share/man/
|
||||||
|
./opt/share/man/man1/
|
||||||
|
./opt/share/man/man1/opkg-cl.1
|
||||||
|
./opt/share/opkg/
|
||||||
|
./opt/share/opkg/intercept/
|
||||||
|
./opt/share/opkg/intercept/update-modules
|
||||||
|
./opt/share/opkg/intercept/depmod
|
||||||
|
./opt/share/opkg/intercept/ldconfig
|
||||||
|
./opt/etc/
|
||||||
|
./opt/etc/ipkg/
|
||||||
|
./opt/etc/ipkg/ipkg.conf
|
||||||
|
./opt/etc/ipkg.conf
|
||||||
|
Bootstraping done
|
||||||
|
Installing glibc-locale package to generate needed /opt/lib/locale/locale-archive
|
||||||
|
```
|
||||||
|
|
||||||
|
Une fois l'installation terminée, mettre à jour la liste des packages
|
||||||
|
|
||||||
|
```
|
||||||
|
DiskStation> /opt/bin/ipkg update
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Nettoyer le dossier d'installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> cd /volume1/@tmp
|
||||||
|
DiskStation> rm buildroot-armeabihf-bootstrap.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Principales commandes
|
||||||
|
|
||||||
|
Afficher la liste des packages
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> /opt/bin/ipkg list
|
||||||
|
```
|
||||||
|
|
||||||
|
Afficher la liste des packages installés
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> /opt/bin/ipkg list-installed
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer une application
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> /opt/bin/ipkg install pkg
|
||||||
|
```
|
||||||
|
|
||||||
|
Mettre à jour les packages
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> /opt/bin/ipkg upgrade
|
||||||
|
```
|
||||||
|
|
||||||
|
Supprimer un package
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> /opt/bin/ipkg remove pkg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mettre à jour iPKG:
|
||||||
|
|
||||||
|
Se connecter sous un compte admin
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh bruno@192.168.0.8
|
||||||
|
```
|
||||||
|
|
||||||
|
Mettre à jour les paquets installés
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> /opt/bin/ipkg update
|
||||||
|
DiskStation> /opt/bin/ipkg upgrade
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Désinstaller iPKG:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm -rf /volume1/@optware
|
||||||
|
rm -rf /usr/lib/ipkg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Rajouter /opt/bin dans le PATH:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DiskStation> cd /root
|
||||||
|
DiskStation> /opt/bin/nano .profile
|
||||||
|
|
||||||
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin:/opt/bin
|
||||||
|
```
|
||||||
273
docs/Synology/opkg/oPKG.md
Normal file
273
docs/Synology/opkg/oPKG.md
Normal file
@@ -0,0 +1,273 @@
|
|||||||
|
# opkg (Entware)
|
||||||
|
|
||||||
|
https://github.com/Entware/Entware/wiki
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer oPKG:
|
||||||
|
|
||||||
|
Se connecter en root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh bruno@192.168.1.7
|
||||||
|
#puis
|
||||||
|
bruno@DS916:~ $ sudo -i
|
||||||
|
root@DS916:~#
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un dossier sur le disque:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p /volume1/@Entware/opt
|
||||||
|
```
|
||||||
|
|
||||||
|
Supprimer le dossier /opt et monter le dossier optware
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm -rf /opt
|
||||||
|
mkdir /opt
|
||||||
|
mount -o bind "/volume1/@Entware/opt" /opt
|
||||||
|
```
|
||||||
|
|
||||||
|
Lancer le script d'installation:
|
||||||
|
|
||||||
|
- for armv7 (DS414)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wget -O - http://bin.entware.net/armv7sf-k3.2/installer/generic.sh | /bin/sh
|
||||||
|
```
|
||||||
|
|
||||||
|
- for x64 (DS916)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wget -O - http://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer une tâche de démarrage:
|
||||||
|
|
||||||
|
DSM -> Panneau de configuration -> Planificateur de tâche -> Créer une tâche déclenchée
|
||||||
|
|
||||||
|
- Tâche: Entware
|
||||||
|
- Utilisateur: root
|
||||||
|
- Evènement: Démarrage
|
||||||
|
- Paramètres de tâche -> Exécuter la commande:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Mount/Start Entware
|
||||||
|
mkdir -p /opt
|
||||||
|
mount -o bind "/volume1/@Entware/opt" /opt
|
||||||
|
/opt/etc/init.d/rc.unslung start
|
||||||
|
|
||||||
|
# Add Entware Profile in Global Profile
|
||||||
|
if grep -qF '/opt/etc/profile' /etc/profile; then
|
||||||
|
echo "Confirmed: Entware Profile in Global Profile"
|
||||||
|
else
|
||||||
|
echo "Adding: Entware Profile in Global Profile"
|
||||||
|
cat >> /etc/profile <<"EOF"
|
||||||
|
|
||||||
|
# Load Entware Profile
|
||||||
|
. /opt/etc/profile
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update Entware List
|
||||||
|
/opt/bin/opkg update
|
||||||
|
```
|
||||||
|
|
||||||
|
Redémarrer le NAS
|
||||||
|
|
||||||
|
Ajouter `/opt/bin & /opt/sbin` à la variable $PATH
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Utiliser oPKG
|
||||||
|
|
||||||
|
Se connecter sous un compte admin:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh bruno@192.168.0.8
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Mettre à jour la liste des paquets:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo opkg update
|
||||||
|
Password:
|
||||||
|
Downloading http://bin.entware.net/x64-k3.2/Packages.gz
|
||||||
|
Updated list of available packages in /opt/var/opkg-lists/entware
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Mettre à jour tous les paquets:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo opkg upgrade
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Installer un paquet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo opkg install ffmpeg
|
||||||
|
Password:
|
||||||
|
Installing ffmpeg (3.2.10-3) to root...
|
||||||
|
Downloading http://bin.entware.net/x64-k3.2/ffmpeg_3.2.10-3_x64-3.2.ipk
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Supprimer un paquet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo opkg remove <paquet>
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Marquer un paquet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo opkg flag <flag><paquet>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Liste des paquets disponibles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo opkg list [paquet]
|
||||||
|
```
|
||||||
|
|
||||||
|
http://bin.entware.net/armv7sf-k3.2/Packages.html
|
||||||
|
|
||||||
|
##### Liste des paquets installés:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo opkg list-installed
|
||||||
|
alsa-lib - 1.1.5-1
|
||||||
|
entware-opt - 227000-3
|
||||||
|
entware-release - 1.0-2
|
||||||
|
entware-upgrade - 1.0-1
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Liste des mises-à-jour de paquets disponibles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo opkg list-upgradable
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Liste des fichiers d'un paquet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo opkg files nano
|
||||||
|
Package nano (2.9.6-1) is installed on root and has the following files:
|
||||||
|
/opt/share/nano/texinfo.nanorc
|
||||||
|
/opt/share/nano/po.nanorc
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Chercher un paquet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo opkg search <paquet> ???
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Afficher les infos sur un paquet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo opkg info vim
|
||||||
|
Package: vim
|
||||||
|
Version: 8.0.586-2
|
||||||
|
Depends: libc, libssp, librt, libpthread, libncurses
|
||||||
|
Status: unknown ok not-installed
|
||||||
|
Section: utils
|
||||||
|
Architecture: x64-3.2
|
||||||
|
MD5Sum: 49db8c4294e7edd8236eb2609dfd4527
|
||||||
|
Size: 350167
|
||||||
|
Filename: vim_8.0.586-2_x64-3.2.ipk
|
||||||
|
Description: Vim is an almost compatible version of the UNIX editor Vi.
|
||||||
|
(Tiny build)
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Status d'un paquet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ sudo opkg status nano
|
||||||
|
Package: nano
|
||||||
|
Version: 2.9.6-1
|
||||||
|
Depends: libc, libssp, librt, libpthread, libncursesw, zlib, file
|
||||||
|
Status: install user installed
|
||||||
|
Architecture: x64-3.2
|
||||||
|
Conffiles:
|
||||||
|
/opt/etc/nanorc ff3c86182093564e3313eeaa0eb367cb092c4bd838128bda02a91dd5e3017e63
|
||||||
|
Installed-Time: 1536489744
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Options:
|
||||||
|
|
||||||
|
-V --verbosity <niveau> mode bavard
|
||||||
|
|
||||||
|
-A tous les paquets (pas seulement ceux installés)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://wiki.openwrt.org/doc/techref/opkg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Ne plus rentrer de mot-de-passe pour opkg:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~ $ cd kymsu/
|
||||||
|
-rwx------ 1 bruno users 1078 Sep 11 18:45 kymsu2.sh
|
||||||
|
-drwxr-xr-x 1 bruno users 30 Sep 12 16:39 plugins.d
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Créer un fichier de config sudo pour l'utilisateur dans `sudoers.d` (apparemment, pas la peine de décommenter la ligne `#includedir /etc/sudoers.d` dans `sudoers`)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DS916:/etc/sudoers.d# ls -la
|
||||||
|
total 12
|
||||||
|
drwxr-x--- 2 root root 4096 Sep 12 20:08 .
|
||||||
|
drwxr-xr-x 48 root root 4096 Sep 10 17:07 ..
|
||||||
|
-r--r----- 1 root root 68 Sep 12 20:34 bruno
|
||||||
|
root@DS916:/etc/sudoers.d# nano bruno
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno ALL=(ALL) NOPASSWD:/var/services/homes/bruno/kymsu/kymsu2.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Permet à l'utilisateur bruno de lancer le script kymsu2.sh avec sudo mais sans mot de passe.
|
||||||
|
|
||||||
|
Pas besoin de redémarrer.
|
||||||
|
|
||||||
|
Au prochain lancement du script par la commande sudo, le mot-de-passe n'est plus demandé:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~/kymsu $ sudo ./kymsu2.sh
|
||||||
|
|
||||||
|
📦 oPKG
|
||||||
|
|
||||||
|
Downloading http://bin.entware.net/x64-k3.2/Packages.gz
|
||||||
|
Updated list of available packages in /opt/var/opkg-lists/entware
|
||||||
|
|
||||||
|
No availables updates.
|
||||||
|
```
|
||||||
|
|
||||||
|
Pour cette commande (passage à root), le mot-de-pass est bien demandé pour la commande sudo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:~/kymsu $ sudo -i
|
||||||
|
Password:
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Exécuter kymsu2.sh à distance:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@silverbook:~$ ssh dsm916 ./kymsu/kymsu2.sh
|
||||||
|
```
|
||||||
|
|
||||||
149
docs/Synology/owncloud.md
Normal file
149
docs/Synology/owncloud.md
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
### Installation:
|
||||||
|
|
||||||
|
#### Télécharger ownCloud Server
|
||||||
|
|
||||||
|
[:fa-link:https://owncloud.org/install/#edition](https://owncloud.org/install/#edition)
|
||||||
|
|
||||||
|
#### Installer ownCloud Server
|
||||||
|
|
||||||
|
[:fa-link:https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#installation-wizard](https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#installation-wizard)
|
||||||
|
|
||||||
|
#### Lancer /volume1/web/perm_owc.sh pour corriger toutes les autorisations.
|
||||||
|
|
||||||
|
[:fa-link:https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions](https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions)
|
||||||
|
|
||||||
|
#### Aller à l'adresse http://192.168.1.7/owncloud/ pour démarrer l'installation.
|
||||||
|
|
||||||
|
*Créer un compte administrateur:* bruno / <password>
|
||||||
|
*Répertoire des données:* /volume1/owncloud/data
|
||||||
|
*Configurer la base de donnée MySQL/MariaDB:*
|
||||||
|
|
||||||
|
- User: root
|
||||||
|
- Mot de passe de la base: <password>
|
||||||
|
- Nom de la base de donnée: owncloud
|
||||||
|
- Hôte: localhost
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Autorisations:
|
||||||
|
|
||||||
|
**Dossier owncloud:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:/volume1/web $
|
||||||
|
drwxr-x— 1 root http 450 Dec 11 10:01 owncloud
|
||||||
|
```
|
||||||
|
|
||||||
|
**et son contenu:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DS916:/volume1/web/owncloud# ls -la
|
||||||
|
total 144
|
||||||
|
drwxr-x--- 1 root http 450 Dec 11 10:01 .
|
||||||
|
d---------+ 1 root root 408 Dec 11 10:01 ..
|
||||||
|
drwxr-x--- 1 root http 588 Dec 11 09:58 3rdparty
|
||||||
|
drwxr-x--- 1 http http 608 Dec 11 09:58 apps
|
||||||
|
drwxr-x--- 1 http http 0 Dec 11 10:01 assets
|
||||||
|
-rw-r----- 1 root http 8301 Nov 8 11:53 AUTHORS
|
||||||
|
drwxr-x--- 1 http http 72 Dec 11 10:02 config
|
||||||
|
-rw-r----- 1 root http 4134 Nov 8 11:53 console.php
|
||||||
|
-rw-r----- 1 root http 34520 Nov 8 11:53 COPYING-AGPL
|
||||||
|
drwxr-x--- 1 root http 332 Dec 11 09:59 core
|
||||||
|
-rw-r----- 1 root http 5141 Nov 8 11:53 cron.php
|
||||||
|
-rw-r----- 1 root http 35830 Nov 8 11:53 db_structure.xml
|
||||||
|
-rw-r--r-- 1 root http 2496 Nov 8 11:53 .htaccess
|
||||||
|
-rw-r----- 1 root http 179 Nov 8 11:53 index.html
|
||||||
|
-rw-r----- 1 root http 3062 Nov 8 11:53 index.php
|
||||||
|
drwxr-x--- 1 root http 58 Dec 11 09:58 l10n
|
||||||
|
drwxr-x--- 1 root http 94 Dec 11 09:59 lib
|
||||||
|
-rwxr-x--x 1 root http 283 Nov 8 11:53 occ
|
||||||
|
drwxr-x--- 1 root http 70 Dec 11 09:58 ocs
|
||||||
|
drwxr-x--- 1 root http 18 Dec 11 09:59 ocs-provider
|
||||||
|
-rw-r----- 1 root http 3086 Nov 8 11:53 public.php
|
||||||
|
-rw-r----- 1 root http 5428 Nov 8 11:53 remote.php
|
||||||
|
drwxr-x--- 1 root http 34 Dec 11 09:59 resources
|
||||||
|
-rw-r----- 1 root http 26 Nov 8 11:53 robots.txt
|
||||||
|
drwxr-x--- 1 root http 288 Dec 11 09:59 settings
|
||||||
|
-rw-r----- 1 root http 1893 Nov 8 11:53 status.php
|
||||||
|
drwxr-x--- 1 http http 26 Dec 11 09:58 themes
|
||||||
|
drwxr-x--- 1 http http 310 Dec 11 09:59 updater
|
||||||
|
-rw-r----- 1 root http 163 Nov 8 11:53 .user.ini
|
||||||
|
-rw-r----- 1 root http 233 Nov 8 11:54 version.php
|
||||||
|
```
|
||||||
|
|
||||||
|
**Le dossier config:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DS916:/volume1/web/owncloud/config# ls -la
|
||||||
|
total 52
|
||||||
|
drwxr-x--- 1 http http 100 Dec 11 10:39 .
|
||||||
|
drwxr-x--- 1 root http 450 Dec 11 10:01 ..
|
||||||
|
-rw-r----- 1 http http 604 Dec 11 10:18 config.php
|
||||||
|
-rw-r----- 1 http http 604 Dec 11 10:39 config.php.bak
|
||||||
|
-rw-r----- 1 http http 40557 Nov 8 11:53 config.sample.php
|
||||||
|
-rw-r----- 1 http http 225 Nov 8 11:53 .htaccess
|
||||||
|
```
|
||||||
|
|
||||||
|
**Dossier data:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:/volume1 $
|
||||||
|
drwxrwxrwx+ 1 http http 20 Aug 28 14:28 owncloud
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@DS916:/volume1/owncloud $
|
||||||
|
drwxrwx— 1 http http 146 Dec 11 10:19 data
|
||||||
|
```
|
||||||
|
|
||||||
|
[:fa-link:Setting Strong Directory Permissions](https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Apps:
|
||||||
|
|
||||||
|
[:fa-link:https://apps.owncloud.com/](https://apps.owncloud.com/)
|
||||||
|
|
||||||
|
- files*mv\* direct*menu
|
||||||
|
- OwnNote
|
||||||
|
- OwnBackup
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Redirection http vers https:
|
||||||
|
|
||||||
|
Rajouter les 2 lignes suivantes au .htaccess
|
||||||
|
|
||||||
|
```bash
|
||||||
|
RewriteCond %{HTTPS} off
|
||||||
|
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@DS916:/volume1/web/owncloud# ls -la
|
||||||
|
-rw-r--r-- 1 root http 2587 Dec 11 18:52 .htaccess
|
||||||
|
-rw-r--r-- 1 root http 2496 Dec 11 18:45 .htaccess-bak
|
||||||
|
|
||||||
|
root@DS916:/volume1/web/owncloud# nano .htaccess
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine on
|
||||||
|
RewriteCond %{HTTPS} off
|
||||||
|
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
||||||
|
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||||
|
RewriteRule ^.well-known/host-meta /public.php?service=host-meta [QSA,L]
|
||||||
|
RewriteRule ^.well-known/host-meta.json /public.php?service=host-meta-json [QSA,L]
|
||||||
|
RewriteRule ^.well-known/carddav /remote.php/dav/ [R=301,L]
|
||||||
|
RewriteRule ^.well-known/caldav /remote.php/dav/ [R=301,L]
|
||||||
|
RewriteRule ^remote/(.*) remote.php [QSA,L]
|
||||||
|
RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
|
||||||
|
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
|
||||||
|
RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
|
||||||
|
</IfModule>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Liens
|
||||||
|
|
||||||
|
[:fa-link:http://www.iholken.com/index.php/2016/03/15/guide-for-installing-owncloud-9-to-synology-nas-running-dsm-6/](http://www.iholken.com/index.php/2016/03/15/guide-for-installing-owncloud-9-to-synology-nas-running-dsm-6/)
|
||||||
64
docs/Synology/python.md
Normal file
64
docs/Synology/python.md
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
# Installer pip et python 3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DSM 6 fournit Python 2 (2.7.12) dans `/bin/python`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer Python 3:
|
||||||
|
|
||||||
|
Il faut installer **python 3** et **pip** depuis <u>iPKGui</u>, soit les paquets:
|
||||||
|
|
||||||
|
- python3
|
||||||
|
- py3-pip
|
||||||
|
- py3-setuptools
|
||||||
|
|
||||||
|
L'installation se fait dans `/opt/bin/`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ which python3
|
||||||
|
/opt/bin/python3
|
||||||
|
|
||||||
|
$ which pip3
|
||||||
|
/opt/bin/pip3
|
||||||
|
```
|
||||||
|
|
||||||
|
Les modules sont ici:
|
||||||
|
|
||||||
|
`/volume1/@optware/local/lib/python3.5/site-packages` (pip, setuptools)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer un module (mkdocs):
|
||||||
|
|
||||||
|
!!! Pour des problèmes de droit, l'installation se fait avec —user
|
||||||
|
PermissionError: [Errno 13] Permission denied: '/opt/local/lib/python3.5/site-packages/click-6.7.dist-info'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pip3 install --user mkdocs
|
||||||
|
$ pip3 install --user klaus
|
||||||
|
```
|
||||||
|
|
||||||
|
Les modules sont installés ici:
|
||||||
|
|
||||||
|
`/volume1/homes/bruno/.local/lib/python3.5/site-packages`
|
||||||
|
|
||||||
|
L'applicatif est installé ici:
|
||||||
|
|
||||||
|
`/volume1/homes/bruno/.local/bin/klaus`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
~/.local/lib/python3.5/site-packages/klaus/wsgi.py
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mettre à jour un module:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pip3 install --user --upgrade setuptools
|
||||||
|
```
|
||||||
|
|
||||||
24
docs/Synology/scripts.md
Normal file
24
docs/Synology/scripts.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# FFmpeg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[:fa-link: Doc](http://ffmpeg.org/ffmpeg.html#Options)
|
||||||
|
|
||||||
|
[:fa-link: Encode AAC](https://trac.ffmpeg.org/wiki/Encode/AAC)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Copier un fichier sur le NAS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ scp -P42666 wsgi.py bruno@192.168.1.7:/var/services/homes/bruno/scripts/
|
||||||
|
|
||||||
|
$ scp -P42666 httpd_vhost.conf bruno@clicclac.synology.me:/var/services/homes/bruno/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Réception d'un fichier depuis le NAS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ scp -P42666 bruno@clicclac.synology.me:/var/services/homes/bruno/httpd-vhost.conf /Users/bruno/Desktop
|
||||||
|
```
|
||||||
|
|
||||||
BIN
docs/Synology/syno_qig_4bay_fra.pdf
Normal file
BIN
docs/Synology/syno_qig_4bay_fra.pdf
Normal file
Binary file not shown.
BIN
docs/Synology/syno_qig_ds916_fra.pdf
Normal file
BIN
docs/Synology/syno_qig_ds916_fra.pdf
Normal file
Binary file not shown.
BIN
docs/Synology/syno_usersguide_naserver_fra.pdf
Normal file
BIN
docs/Synology/syno_usersguide_naserver_fra.pdf
Normal file
Binary file not shown.
16
docs/index.md
Normal file
16
docs/index.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Accueil
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[macos](macos/index.md)
|
||||||
|
|
||||||
|
[Linux](Linux/index.md)
|
||||||
|
|
||||||
|
[MySQL](MySQL/index.md)
|
||||||
|
|
||||||
|
[Raspberry](Raspberry/index.md)
|
||||||
|
|
||||||
|
[Synology](Synology/index.md)
|
||||||
|
|
||||||
|
[Divers](Divers/index.md)
|
||||||
|
|
||||||
BIN
docs/macos/.DS_Store
vendored
Normal file
BIN
docs/macos/.DS_Store
vendored
Normal file
Binary file not shown.
72
docs/macos/Divers.md
Normal file
72
docs/macos/Divers.md
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
# Divers
|
||||||
|
|
||||||
|
#### Convertir une page man en fichier txt:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~$ man tmutil | col -b > tmutil.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
( -bx)
|
||||||
|
|
||||||
|
#### Convertir une page man en fichier pdf:
|
||||||
|
|
||||||
|
(installer Ghostscript pour avoir ps2pdf)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~$ man -t tmutil | ps2pdf - tmutil.pdf
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Installer LaTeX:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask install basictex
|
||||||
|
```
|
||||||
|
|
||||||
|
ou
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask install mactex
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rsync
|
||||||
|
|
||||||
|
`—delete` (efface de la destination ce qui n’est plus dans la source)
|
||||||
|
|
||||||
|
#### Créer une image disque:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~$ hdiutil create -srcfolder /Users/bruno/Downloads/PC archive.dmg
|
||||||
|
|
||||||
|
.......................................................................................................................................................................................
|
||||||
|
|
||||||
|
created: /Users/bruno/archive.dmg
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Rapport système:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~$ system_profiler -detailLevel basic > report.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Comparer fichiers et répertoires:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ opendiff Contract1.rtf Contract2.rtf
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Chercher les m-à-j sur l'App Store:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ softwareupdate -l
|
||||||
|
Software Update Tool
|
||||||
|
|
||||||
|
Finding available software
|
||||||
|
No new software available.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Installer les m-à-j:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo softwareupdate -i -a
|
||||||
|
```
|
||||||
|
|
||||||
32
docs/macos/TouchID.md
Normal file
32
docs/macos/TouchID.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Comment utiliser Touch ID dans le Terminal (commande sudo):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo cp /etc/pam.d/sudo /etc/pam.d/sudo.bak
|
||||||
|
|
||||||
|
$ sudo nano /etc/pam.d/sudo
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Ajoutez la ligne suivante au début du fichier, et enregistrez :
|
||||||
|
|
||||||
|
`auth sufficient pam_tid.so`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# sudo: auth account password session
|
||||||
|
auth sufficient pam_tid.so
|
||||||
|
auth sufficient pam_smartcard.so
|
||||||
|
auth required pam_opendirectory.so
|
||||||
|
account required pam_permit.so
|
||||||
|
password required pam_deny.so
|
||||||
|
session required pam_permit.so
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
!!! attention
|
||||||
|
Les connections ssh sans mot-de-passe ne fonctionnent plus.
|
||||||
|
|
||||||
|
|
||||||
77
docs/macos/bash_exemples.md
Normal file
77
docs/macos/bash_exemples.md
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
# Bash (exemples)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Ajouter un préfixe à la ligne d'un fichier texte:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew list | sed -e 's/^/brew install /' > brew-list.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Pour un suffixe:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sed -e 's/$/suffix/'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Cherche tous les .jpg d'un répertoire et les effacer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find . -name '*jpg' -exec rm {} +
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Concaténer tous les .csv:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find . -type f -iname "*.csv" -exec cat {} \; > toutes.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Couleurs dans le terminal:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export UNDERLINE=$(tput sgr 0 1)
|
||||||
|
export BOLD=$(tput bold)
|
||||||
|
export BLACK=$(tput setaf 0)
|
||||||
|
export RED=$(tput setaf 1)
|
||||||
|
export GREEN=$(tput setaf 2)
|
||||||
|
export YELLOW=$(tput setaf 3)
|
||||||
|
export BLUE=$(tput setaf 4)
|
||||||
|
export PURPLE=$(tput setaf 5)
|
||||||
|
export CYAN=$(tput setaf 6)
|
||||||
|
export WHITE=$(tput setaf 7)
|
||||||
|
export GRAY=$(tput setaf 8)
|
||||||
|
export LIGHTRED=$(tput setaf 9)
|
||||||
|
export LIGHTGREEN=$(tput setaf 10)
|
||||||
|
export LIGHTYELLOW=$(tput setaf 11)
|
||||||
|
export LIGHTBLUE=$(tput setaf 12)
|
||||||
|
export LIGHTPURPLE=$(tput setaf 11)
|
||||||
|
export LIGHTCYAN=$(tput setaf 11)
|
||||||
|
export RESET=$(tput sgr0)
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "${BLUE}blue${RESET} ${RED}red${RESET}"
|
||||||
|
blue red
|
||||||
|
for i in {0..255}; do echo "$(tput setaf $i)test"; done
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Supprimer récursivement tous les fichiers .DS_ST0RE:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo find / -name ".DS_Store" -depth -exec rm {} \;
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find . -name '*.DS_Store' -type f -delete
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find . -name '.DS_Store' -type f -print -exec rm -f {} +
|
||||||
|
```
|
||||||
|
|
||||||
30
docs/macos/executer_shell_script.md
Normal file
30
docs/macos/executer_shell_script.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Exécuter un shell script depuis le Finder
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- Renommer le script avec l'extension .command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cp mkdocs.sh mkdocs.command
|
||||||
|
```
|
||||||
|
|
||||||
|
- Le rendre exécutable
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chmod +x mkdocs.command
|
||||||
|
```
|
||||||
|
|
||||||
|
- Le script doit commencer par `!/bin/bash`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Pour le lancer depuis LaunchBar: Info Fichier -> Ouvrir avec -> iTem
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Connaître le répertoire courant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DIRNAME=`dirname "$0"`
|
||||||
|
```
|
||||||
|
|
||||||
191
docs/macos/homebrew/brew-cask.md
Normal file
191
docs/macos/homebrew/brew-cask.md
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
# Homebrew-Cask
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**[:fa-link: Homebrew-Cask](https://github.com/caskroom/homebrew-cask)**
|
||||||
|
|
||||||
|
**[:fa-link: https://caskroom.github.io](https://caskroom.github.io)**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer un plug-in QuickLook ([:fa-link: QLVideo](https://github.com/Marginal/QLVideo)):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask install qlvideo
|
||||||
|
|
||||||
|
# --force réinstalle le Cask (si déjà présent)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Desinstaller:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask uninstall qlvideo
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Liste de tous les Casks disponibles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask search
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Liste de tous les Casks disponibles à propos de Chrome:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask search chrome
|
||||||
|
==> Partial Matches
|
||||||
|
chrome-devtools dmm-player-for-chrome google-chrome
|
||||||
|
chrome-remote-desktop-host epichrome mkchromecast
|
||||||
|
==> Remote Matches
|
||||||
|
caskroom/versions/google-chrome-canary caskroom/versions/google-chrome-dev
|
||||||
|
caskroom/versions/google-chrome-beta
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Information au sujet d'un Cask:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask info google-chrome
|
||||||
|
google-chrome: 63.0.3239.132
|
||||||
|
https://www.google.com/chrome/
|
||||||
|
Not installed
|
||||||
|
From: https://github.com/caskroom/homebrew-cask/blob/master/Casks/google-chrome.rb
|
||||||
|
==> Name
|
||||||
|
Google Chrome
|
||||||
|
==> Artifacts
|
||||||
|
Google Chrome.app (App)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Liste des Casks installés:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask list
|
||||||
|
basictex qlcolorcode suspicious-package
|
||||||
|
betterzipql qlstephen
|
||||||
|
|
||||||
|
# -1 sortie sur une seule colonne
|
||||||
|
# --versions montre toutes les versions installés
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Aller à la page du project Homebrew-Cask:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask home
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Aller à la page du Cask:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask home qlstephen
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Liste des Casks mis-à-jour disponibles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask outdated
|
||||||
|
|
||||||
|
# --greedy inclus les Casks avec auto_updates true et version :latest
|
||||||
|
# --verbose
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer les mises-à-jour:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask reinstall `brew cask outdated`
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask outdated --greedy --verbose | grep -v '(latest)' | awk '{print $1}' | xargs brew cask reinstall
|
||||||
|
|
||||||
|
# mets à jour les auto_updates true mais pas les version :latest
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mettre à jour tous les Casks:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask upgrade
|
||||||
|
|
||||||
|
# --greedy met à jour les Casks avec auto_updates true et version :latest
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Script d'installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# !/bin/sh
|
||||||
|
|
||||||
|
# Brew packages that I use alot.
|
||||||
|
|
||||||
|
brew install wget
|
||||||
|
brew install ffmpeg
|
||||||
|
brew install node
|
||||||
|
brew install imagemagick
|
||||||
|
|
||||||
|
# Some cask packages that I like.
|
||||||
|
|
||||||
|
brew cask install google-chrome
|
||||||
|
brew cask install xquartz
|
||||||
|
brew cask install virtualbox
|
||||||
|
```
|
||||||
|
|
||||||
|
Sauver le script sous le fichier **installConfig.sh** et le rendre exécutable:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ chmod +x installConfig.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cache:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd ~/Library/Caches/Homebrew/Cask
|
||||||
|
total 480296
|
||||||
|
drwxr-xr-x 11 bruno staff 352 18 jan 18:54 .
|
||||||
|
drwxr-xr-x 92 bruno staff 2944 17 jan 17:19 ..
|
||||||
|
-rw-r--r--@ 1 bruno staff 19529710 14 déc 12:30 airy--3.3.179.dmg
|
||||||
|
-rw-r--r-- 1 bruno staff 135495923 10 jan 01:59 atom--1.23.3.zip
|
||||||
|
-rw-r--r-- 1 bruno staff 74574230 7 jui 2017 basictex--2017.0607.pkg
|
||||||
|
-rw-r--r--@ 1 bruno staff 2158705 22 oct 05:23 cakebrew--1.2.5.dmg
|
||||||
|
-rw-r--r-- 1 bruno staff 28404 26 oct 14:01 qlcolorcode--2.0.9.zip
|
||||||
|
-rw-r--r-- 1 bruno staff 55479 21 mai 2017 qlmarkdown--1.3.5.zip
|
||||||
|
-rw-r--r-- 1 bruno staff 30945 24 mai 2017 qlstephen--1.4.4.zip
|
||||||
|
-rw-r--r--@ 1 bruno staff 5078603 22 mai 2017 transmission--2.92.dmg
|
||||||
|
-rw-r--r--@ 1 bruno staff 2825054 13 nov 11:03 vnc-viewer--6.17.1113.dmg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Vider le cache:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Supprimer tous les téléchargements
|
||||||
|
$ brew cask cleanup
|
||||||
|
|
||||||
|
# Supprimer les téléchargements vieux de + de 10 jours.
|
||||||
|
$ brew cask cleanup --outdated
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://github.com/Homebrew/homebrew-cask/blob/master/doc/development/adding_a_cask.md
|
||||||
|
|
||||||
457
docs/macos/homebrew/brew.md
Normal file
457
docs/macos/homebrew/brew.md
Normal file
@@ -0,0 +1,457 @@
|
|||||||
|
# Homebrew
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**[:fa-link: https://docs.brew.sh](https://docs.brew.sh)**
|
||||||
|
|
||||||
|
[:fa-link: formulae.brew.sh](http://braumeister.org)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Update Homebrew et les formules:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew update
|
||||||
|
```
|
||||||
|
|
||||||
|
### Chercher les M-à-J:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew outdated
|
||||||
|
|
||||||
|
# --verbose
|
||||||
|
```
|
||||||
|
|
||||||
|
### Mettre tout à jour:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew upgrade
|
||||||
|
|
||||||
|
# --cleanup Met à jour et supprime les anciennes versions installées.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Formules:
|
||||||
|
|
||||||
|
#### Mettre à jour une formule:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew upgrade <formula>
|
||||||
|
|
||||||
|
# --cleanup Met à jour et supprime les anciennes versions installées.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Installer une formule:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install <formula>
|
||||||
|
|
||||||
|
$ brew install --verbose --debug <formula>
|
||||||
|
|
||||||
|
# --build-from-source Compile la formule depuis la source même si une bottle est disponible. Les dépendances sont installées depuis les bottles.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Installer une formule d’ailleurs la branche:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install https://raw.github.com/user/repo/branch/formula.rb
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Reinstaller une formule depuis les sources:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew reinstall -s <formula>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Desinstaller une formule:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew uninstall <formula>
|
||||||
|
|
||||||
|
# --force toutes les versions de la formule seront effacées
|
||||||
|
# --ignore-dependencies desinstallera même si des dépendances restent installées
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Desinstaller les anciennes versions d’une formule:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cleanup <formula>
|
||||||
|
|
||||||
|
# Supprime toutes les anciennes dans la Cellar et dans le Cache.
|
||||||
|
|
||||||
|
# --dry-run (ou -n) montre ce qui va être supprimer mais n'enlève rien.
|
||||||
|
# --prune=days supprime les fichiers du Cache plus vieux que <days> jours.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Desinstaller toutes les anciennes versions:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cleanup
|
||||||
|
|
||||||
|
# (-n ou --dry-run) voir tout ce qui sera désinstaller
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Empecher la m-à-j d’un package:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew pin <formula>
|
||||||
|
```
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:/usr/local/Cellar/terminal-notifier/1.8.0$ brew pin terminal-notifier
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Re-permettre la m-à-j:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew unpin <formula>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Liste des formules installées:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew list
|
||||||
|
|
||||||
|
# --versions affiche la verion en plus.
|
||||||
|
# --pinned affiche les formules pinned
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Afficher des infos sur une formule installée:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew info <formula>
|
||||||
|
```
|
||||||
|
```bash
|
||||||
|
$ brew info terminal-notifier
|
||||||
|
|
||||||
|
terminal-notifier: stable 1.8.0 (bottled), HEAD
|
||||||
|
|
||||||
|
Send macOS User Notifications from the command-line
|
||||||
|
|
||||||
|
https://github.com/julienXX/terminal-notifier
|
||||||
|
|
||||||
|
/usr/local/Cellar/terminal-notifier/1.7.1 (14 files, 2MB)
|
||||||
|
|
||||||
|
Poured from bottle on 2016-10-19 at 07:24:46
|
||||||
|
|
||||||
|
/usr/local/Cellar/terminal-notifier/1.8.0 (5 files, 99.8KB) *
|
||||||
|
|
||||||
|
Poured from bottle on 2017-08-12 at 20:20:48
|
||||||
|
|
||||||
|
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/terminal-notifier.rb
|
||||||
|
|
||||||
|
==> Requirements
|
||||||
|
|
||||||
|
Build: xcode ✔
|
||||||
|
|
||||||
|
Required: macOS >= 10.8 ✔
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Description d'une formule:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew desc <formula>
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew desc httpd
|
||||||
|
httpd: Apache HTTP server
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Afficher les options d'une formule:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew options <formula>
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew options php72
|
||||||
|
--with-argon2
|
||||||
|
Include libargon2 password hashing support
|
||||||
|
--with-cgi
|
||||||
|
Enable building of the CGI executable (implies --without-fpm)
|
||||||
|
--with-debug
|
||||||
|
Compile with debugging symbols
|
||||||
|
|
||||||
|
# --compact sur une seule ligne
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Chercher une formule (avec description):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew search --desc <formula>
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew search --desc pdf
|
||||||
|
|
||||||
|
briss: Crop PDF files
|
||||||
|
|
||||||
|
diff-pdf: Visually compare two PDF files
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Activer une autre version:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew switch <formula>
|
||||||
|
```
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:/usr/local/Cellar/terminal-notifier/1.8.0$ brew switch terminal-notifier 1.7.1
|
||||||
|
|
||||||
|
Cleaning /usr/local/Cellar/terminal-notifier/1.7.1
|
||||||
|
|
||||||
|
Cleaning /usr/local/Cellar/terminal-notifier/1.8.0
|
||||||
|
|
||||||
|
1 links created for /usr/local/Cellar/terminal-notifier/1.7.1
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Configurer (arguments) une formule:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew edit <formula>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Afficher la homepage de Homebrew:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew home
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Afficher la homepage de la formule:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew home <formula>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Log:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew log <formula>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### « keg-only »
|
||||||
|
|
||||||
|
La formule est installée dans Cellar. Elle n’est pas linkée dans /usr/local
|
||||||
|
|
||||||
|
<u>Pour la linker:</u>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew link
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Changer de version de PHP:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew unlink php54 && brew link php53
|
||||||
|
```
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
### Dépendances:
|
||||||
|
|
||||||
|
#### Voir les dépendances:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew deps <formula>
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew deps httpd
|
||||||
|
apr
|
||||||
|
apr-util
|
||||||
|
boost
|
||||||
|
c-ares
|
||||||
|
jansson
|
||||||
|
jemalloc
|
||||||
|
libev
|
||||||
|
libevent
|
||||||
|
nghttp2
|
||||||
|
openssl
|
||||||
|
pcre
|
||||||
|
|
||||||
|
# --tree Présentation comme arbre
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Montrer les formules installées qui ne sont pas des dépendances d'autres formules installées:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew leaves
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Montrer les dépendances manquantes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew missing
|
||||||
|
$ brew missing <formula>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Dépendances inverses:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew uses x264 --installed
|
||||||
|
ffmpeg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Outils:
|
||||||
|
|
||||||
|
#### Vérifier le système:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew doctor
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Prune (supprimer les liens symboliques morts):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew prune
|
||||||
|
|
||||||
|
# --dry-run
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Où va tout ce que télécharge Homebrew (cache):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew --cache
|
||||||
|
|
||||||
|
/Users/bruno/Library/Caches/Homebrew
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd /Users/bruno/Library/Caches/Homebrew
|
||||||
|
total 2616544
|
||||||
|
drwxr-xr-x 92 bruno staff 2944 17 jan 17:19 .
|
||||||
|
drwx------+ 194 bruno staff 6208 18 jan 18:57 ..
|
||||||
|
drwxr-xr-x 11 bruno staff 352 18 jan 18:54 Cask
|
||||||
|
-rw-r--r-- 1 bruno staff 400053 28 oct 08:20 apr-1.6.3.high_sierra.bottle.tar.gz
|
||||||
|
-rw-r--r-- 1 bruno staff 242481 3 nov 02:01 apr-util-1.6.1_1.high_sierra.bottle.tar.gz
|
||||||
|
-rw-r--r-- 1 bruno staff 88679443 19 déc 10:23 boost-1.66.0.high_sierra.bottle.tar.gz
|
||||||
|
-rw-r--r-- 1 bruno staff 3434 16 déc 20:15 brew-pip-0.4.1.tar.gz
|
||||||
|
-rw-r--r-- 1 bruno staff 12310915 21 nov 13:01 cmake-3.10.0.high_sierra.bottle.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Affiche le chemin de Cellar:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew --Cellar
|
||||||
|
/usr/local/Cellar
|
||||||
|
|
||||||
|
$ brew --Cellar httpd
|
||||||
|
/usr/local/Cellar/httpd
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Sauvegarder sa configuration Homebrew:
|
||||||
|
|
||||||
|
Liste des packages, taps et casks installés:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew tap Homebrew/bundle
|
||||||
|
$ brew bundle dump
|
||||||
|
```
|
||||||
|
|
||||||
|
Ceci crée un fichier <u>Brewfile</u> que l'on peut éditer.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
tap 'homebrew/php'
|
||||||
|
brew 'homebrew/php/php71', args: ['with-imap']
|
||||||
|
brew 'shpotify'
|
||||||
|
cask 'spotify'
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Restaurer sa configuration:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Se positionner dans le répertoire contenant le fichier Brewfile
|
||||||
|
|
||||||
|
$ brew bundle
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Services:
|
||||||
|
|
||||||
|
#### Liste des services gérés par brew services:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~$ brew services list
|
||||||
|
|
||||||
|
Name Status User Plist
|
||||||
|
|
||||||
|
mariadb started bruno /Users/bruno/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
|
||||||
|
|
||||||
|
php71 started bruno /Users/bruno/Library/LaunchAgents/homebrew.mxcl.php71.plist
|
||||||
|
|
||||||
|
httpd started root /Library/LaunchDaemons/homebrew.mxcl.httpd.plist
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Lancer au démarrage:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew services start mysql
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Démarrer (pas au boot):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew services run mysql
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Arrêter le service:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew services stop mysql
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Redémarrer le service:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew services restart mysql
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Taps (third-party repositories):
|
||||||
|
|
||||||
|
[:fa-link: brew tap](https://docs.brew.sh/Taps.html) rajoute des repositories à **brew**
|
||||||
|
|
||||||
|
#### Liste les repos tapped:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew tap
|
||||||
|
caskroom/cask
|
||||||
|
homebrew/apache
|
||||||
|
homebrew/core
|
||||||
|
homebrew/dupes
|
||||||
|
homebrew/php
|
||||||
|
homebrew/services
|
||||||
|
homebrew/versions
|
||||||
|
tideways/profiler
|
||||||
|
vapor/tap
|
||||||
|
```
|
||||||
|
|
||||||
|
<u>Les tap sont situés là:</u>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@silverbook:/usr/local/Homebrew/Library/Taps$ ls
|
||||||
|
caskroom homebrew tideways vapor
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Ajouter un repo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew tap <tapname>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Supprimer un repo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew untap <tapname>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cask:
|
||||||
|
|
||||||
|
### [:fa-link: Homebrew-Cask](brew-cask.md)
|
||||||
36
docs/macos/index.md
Normal file
36
docs/macos/index.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# macos
|
||||||
|
|
||||||
|
### Apache / PHP / MySQL
|
||||||
|
|
||||||
|
[Installer **Apache** (homebrew)](webserver/apache.md)
|
||||||
|
|
||||||
|
[Installer **PHP** (homebrew)](webserver/php.md)
|
||||||
|
|
||||||
|
[Installer **MySQL** (homebrew)](webserver/mysql.md)
|
||||||
|
|
||||||
|
[:fa-link: **PHP info** (Macbook)](http://silverbook.local/info.php)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Gestionnaire de paquets
|
||||||
|
|
||||||
|
[**MacPorts**](https://clicclac.synology.me/dokuwiki/doku.php?id=osx:macports) est un système pour installer, compiler et gérer des programmes open-source.
|
||||||
|
|
||||||
|
[**homebrew**](homebrew/brew.md) est un système pour installer, compiler et gérer des programmes open-source.
|
||||||
|
|
||||||
|
[**pip**](python/pip.md) (Python install packages)
|
||||||
|
|
||||||
|
[node](node/node-js.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Divers
|
||||||
|
|
||||||
|
[Se connecter au NAS en ssh et sans mot de passe](ssh/ssh-passwordless.md)
|
||||||
|
|
||||||
|
[Sécurité (Gatekeeper...)](securite.md)
|
||||||
|
|
||||||
|
[Calcul d'un checksum, md5, sha256…](md5.md)
|
||||||
|
|
||||||
|
[Touch ID](TouchID.md)
|
||||||
|
|
||||||
9
docs/macos/liens.md
Normal file
9
docs/macos/liens.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Liens
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Launchd](http://www.launchd.info)
|
||||||
|
|
||||||
|
[How to Use launchd to Run Scripts on Schedule in macOS](https://www.maketecheasier.com/use-launchd-run-scripts-on-schedule-macos/)
|
||||||
|
|
||||||
|
[Schedule jobs with crontab on Mac OS X](https://ole.michelsen.dk/blog/schedule-jobs-with-crontab-on-mac-osx.html)
|
||||||
28
docs/macos/md5.md
Normal file
28
docs/macos/md5.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Calculer le checksum d'un fichier ou d'un dossier
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Il faut installer **md5deep** (Recursively compute digests on files/directories) avec [homebrew](homebrew/brew.md).
|
||||||
|
|
||||||
|
Le paquet contient hash deep, md5deep, sha1deep, sha256deep, tigerdeep, whirlpooldeep.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Calcul du sha256 d’un fichier
|
||||||
|
|
||||||
|
```bash
|
||||||
|
HackiMac:~ bruno$ sha256deep /Users/bruno/Library/ssdtPRGen/ACPI/APIC.aml
|
||||||
|
|
||||||
|
64e0949f7af61f2c23e74ecd6c9f59d25f4b9b904befd9252159f671f0ea2581 /Users/bruno/Library/ssdtPRGen/ACPI/APIC.aml
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Calcul du sha256 d’un dossier
|
||||||
|
|
||||||
|
```bash
|
||||||
|
HackiMac:~ bruno$ sha256deep -r /Volumes/EFI/EFI/CLOVER/kexts/Other/realtekALC.kext
|
||||||
|
|
||||||
|
57b4630bf6365fd46d76e5d845b97cc8d1042e5fa48621086c3edcefb4d20517 /Volumes/EFI/EFI/CLOVER/kexts/Other/realtek
|
||||||
|
```
|
||||||
|
|
||||||
67
docs/macos/node/ghost.md
Normal file
67
docs/macos/node/ghost.md
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# ghost
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Installer nvm](nvm.md).
|
||||||
|
|
||||||
|
Version LTS de Node:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ nvm install --lts
|
||||||
|
$ nvm use --lts
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer ghost-cli:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install -g ghost-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un répertoire où installer Ghost:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mkdir myblog
|
||||||
|
$ cd myblog
|
||||||
|
$ ghost install local
|
||||||
|
```
|
||||||
|
|
||||||
|
Quand l'installation est terminée, on accède à Ghost à l'adresse http://localhost:2368/ et http://localhost:2368/ghost/ pour la page administration.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Paramétrage de Ghost (après l'installation)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ ghost setup
|
||||||
|
? Enter your blog URL: http://localhost:2368
|
||||||
|
? Enter your MySQL hostname: localhost
|
||||||
|
? Enter your MySQL username: root
|
||||||
|
? Enter your MySQL password: [hidden]
|
||||||
|
? Enter your Ghost database name: ghost_prod
|
||||||
|
✔ Configuring Ghost
|
||||||
|
✔ Setting up instance
|
||||||
|
? Do you wish to set up "ghost" mysql user? Yes
|
||||||
|
✔ Setting up "ghost" mysql user
|
||||||
|
? Do you wish to set up Nginx? No
|
||||||
|
ℹ Setting up Nginx [skipped]
|
||||||
|
Task ssl depends on the 'nginx' stage, which was skipped.
|
||||||
|
ℹ Setting up SSL [skipped]
|
||||||
|
? Do you wish to set up Systemd? No
|
||||||
|
ℹ Setting up Systemd [skipped]
|
||||||
|
? Do you want to start Ghost? Yes
|
||||||
|
Ghost is already running! Run `ghost ls` for more information
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
View running ghost processes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ ghost ls
|
||||||
|
┌─────────────┬───────────────┬─────────┬───────────────────────┬────────────────────────┬──────┬─────────────────┐
|
||||||
|
│ Name │ Location │ Version │ Status │ URL │ Port │ Process Manager │
|
||||||
|
├─────────────┼───────────────┼─────────┼───────────────────────┼────────────────────────┼──────┼─────────────────┤
|
||||||
|
│ ghost-local │ ~/Sites/ghost │ 2.0.3 │ running (development) │ http://localhost:2368/ │ 2368 │ local │
|
||||||
|
└─────────────┴───────────────┴─────────┴───────────────────────┴────────────────────────┴──────┴─────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
10
docs/macos/node/index.md
Normal file
10
docs/macos/node/index.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# WebServer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Ghost](ghost.md)
|
||||||
|
|
||||||
|
[node-js](node-js.md)
|
||||||
|
|
||||||
|
[nvm](nvm.md)
|
||||||
|
|
||||||
163
docs/macos/node/node-js.md
Normal file
163
docs/macos/node/node-js.md
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
# node.js
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Node.js](https://nodejs.org/fr/)® est un environnement d’exécution JavaScript construit sur le [moteur JavaScript V8 de Chrome](https://developers.google.com/v8/).
|
||||||
|
|
||||||
|
[npm](https://www.npmjs.com) est un gestionnaire de paquets pour JavaScript automatiquement installé avec Node.
|
||||||
|
|
||||||
|
[nvm](https://github.com/creationix/nvm) (Node Version Manager) est un gestionnaire de version de Node.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installation (Homebrew):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# installer node et npm
|
||||||
|
|
||||||
|
$ brew install node
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installation (directe):
|
||||||
|
|
||||||
|
Installer [Node.js](https://nodejs.org/en/download/) (version LTS)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installation ([nvm](nvm.md)):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install nvm
|
||||||
|
|
||||||
|
# installer Node 8
|
||||||
|
$ nvm install 8
|
||||||
|
|
||||||
|
# installer Node 10
|
||||||
|
$ nvm install 10
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Version de npm:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# version:
|
||||||
|
$ node -v
|
||||||
|
v9.5.0
|
||||||
|
$ npm -v
|
||||||
|
5.6.0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Update:
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install npm@latest -g
|
||||||
|
|
||||||
|
$ brew install node
|
||||||
|
|
||||||
|
$ npm install npm --global
|
||||||
|
```
|
||||||
|
|
||||||
|
https://docs.npmjs.com/getting-started/fixing-npm-permissions#option-2-change-npms-default-directory-to-another-directory
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Local:
|
||||||
|
|
||||||
|
Installer npm packages localement => `/Users/bruno/Sites/node_modules`
|
||||||
|
|
||||||
|
- Installer: `npm install <package_name>`
|
||||||
|
- Mise-à-jour: `npm update` (depuis le répertoire du module)
|
||||||
|
- Desinstaller: `npm uninstall <package_name>`
|
||||||
|
|
||||||
|
<u>Mises à jour disponibles:</u>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@silverbook:~/Sites/node_modules$ npm outdated
|
||||||
|
Package Current Wanted Latest Location
|
||||||
|
jquery MISSING 3.2.1 3.2.1
|
||||||
|
livephotoskit 1.4.11 1.5.2 1.5.2
|
||||||
|
```
|
||||||
|
|
||||||
|
<u>Mettre-à-jour:</u>
|
||||||
|
```bash
|
||||||
|
$ npm outdated | awk '{print $1}' | xargs npm update
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Global:
|
||||||
|
|
||||||
|
Installer npm packages globalement => `/usr/local/lib/node_modules/`
|
||||||
|
|
||||||
|
- Installer: `npm install -g <package_name>`
|
||||||
|
- Mise-à-jour: `npm update -g <package_name>`
|
||||||
|
- Désinstaller: `npm uninstall -g <package_name>`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Aller dans node_modules:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@SilverBook:~$ cd Sites/node_modules/
|
||||||
|
```
|
||||||
|
|
||||||
|
puis
|
||||||
|
|
||||||
|
- Liste package installé: `nom ls`
|
||||||
|
- Mises à jour disponibles: `nom outdated`
|
||||||
|
- Installer une m-à-j: `nom update`
|
||||||
|
- Installer un package: `nom install package`
|
||||||
|
- Désinstaller un package: `nom uninstall package`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Supprimer tous les modules:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ for package in `ls node_modules`; do npm uninstall $package; done;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Maintenance:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm doctor
|
||||||
|
npm WARN verifyCachedFiles Content garbage-collected: 46 (4358853 bytes)
|
||||||
|
npm WARN verifyCachedFiles Cache issues have been fixed
|
||||||
|
Check Value Recommendation
|
||||||
|
npm ping OK
|
||||||
|
npm -v v5.10.0 Use npm v6.4.1
|
||||||
|
node -v v8.11.4
|
||||||
|
npm config get registry https://registry.npmjs.org/
|
||||||
|
which git /usr/bin/git
|
||||||
|
Perms check on cached files ok
|
||||||
|
Perms check on global node_modules ok
|
||||||
|
Perms check on local node_modules ok
|
||||||
|
Verify cache contents verified 2159 tarballs
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Packages:
|
||||||
|
|
||||||
|
[Rechercher un package](https://npms.io)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### uninstall-all-modules
|
||||||
|
|
||||||
|
Desinstaller tous les modules=
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm uninstall
|
||||||
|
```
|
||||||
|
|
||||||
|
##### livephotoskit, jquery, picturefill
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user