31-05-2020
This commit is contained in:
31
docs/Windows/commandes.md
Normal file
31
docs/Windows/commandes.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Commandes
|
||||
|
||||
|
||||
|
||||
| No | Use this command | To do this |
|
||||
| ---- | ---------------- | ----------------------------------------- |
|
||||
| 1 | appwiz.cpl | Open Programs and Features |
|
||||
| 2 | compmgmt | Open Computer Management |
|
||||
| 3 | control | Open Control Panel |
|
||||
| 4 | cleanmgr | Open Disk Cleanup |
|
||||
| 5 | devmgmt | Open Device Manager |
|
||||
| 6 | diskmgmt | Open Disk Management |
|
||||
| 7 | eventvwr | Open Event Viewer |
|
||||
| 8 | hdwwiz | Start Add Hardware Wizard |
|
||||
| 9 | mmc | Open Microsoft Management Console |
|
||||
| 10 | msconfig | Open System Configuration |
|
||||
| 11 | msinfo32 | Open System Information |
|
||||
| 12 | mstsc | Open Remote Desktop Connection |
|
||||
| 13 | netplwiz | Open Advanced User Accounts Control Panel |
|
||||
| 14 | ncpa.cpl | Open Network Connections |
|
||||
| 15 | perfmon | Open Performance Monitor |
|
||||
| 16 | sysdm.cpl | Open System Properties |
|
||||
| 17 | resmon | Open Resoure Monitor |
|
||||
| 18 | rstrui | Start System Restore Wizard |
|
||||
| 19 | services.msc | Open Windows Services |
|
||||
| 20 | sdclt | Open Backup and Restore (Windows 7) |
|
||||
| 21 | slui | Open Windows Activation |
|
||||
| 22 | taskmgr | Open Task Manager |
|
||||
| 23 | taskschd | Open Task Scheduler |
|
||||
| 24 | wf | Open Windows Defender Firewall settings |
|
||||
| 25 | winver | Show Windows version |
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
[Windows Terminal](Terminal.md)
|
||||
|
||||
[WSL (Windows Sub Linux)](wsl.md)
|
||||
WSL (Windows Sub Linux) [Installer](wsl.md) - [Personnaliser](wsl_2.md)
|
||||
|
||||
[Trucs](trucs.md)
|
||||
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
# WSL
|
||||
# Installer WSL
|
||||
|
||||
|
||||
|
||||
### WSL 2 (installation)
|
||||
|
||||
Nécessite une <u>insider build</u> (31/03/2020)
|
||||
Nécessite au minimum la build 2004 (une <u>insider build</u> au 31/03/2020)
|
||||
Aller à Fonctionnalités de Windows:
|
||||
|
||||
- installer <u>Plateforme d'ordinateur virtuel</u> (Virtual Machine Platform)
|
||||
- installer <u>Sous-système Windows pour Linux</u> (Windows Subsystem for Linux)
|
||||
|
||||
Activer la virtualisation dans le BIOS.
|
||||
|
||||
- Asus: Advanced -> Configuration Processeur -> Virtualisation Techno: Intel (VMY) Virtualisation Technology
|
||||
- Gigabyte:
|
||||
|
||||
Pour voir, si elle est active, aller dans le Gestionnaire de taches -> onglet Performance
|
||||
|
||||
Pour Parallels Desktop, aller dans Configuration -> Matériel -> CPU et mémoire -> Paramètres avancés, et cocher <u>Activer la virtualisation imbriquée</u>.
|
||||
|
||||
Aller sur le Microsoft Store et installer une distrib Linux.
|
||||
@@ -198,11 +205,6 @@ cat ~/.ssh/id_rsa.pub | clip.exe
|
||||
|
||||
|
||||
|
||||
### VScode et wsl:
|
||||
|
||||
Afficher la palette de commande (Ctrl+Maj+P) et entrer <u>Remote-WSL: New Window</u>
|
||||
Depuis le terminal, taper `code .` ou `code-insiders .`
|
||||
|
||||
Lancer des commandes Linux depuis l'Invite de commandes ou Powershell:
|
||||
|
||||
```
|
||||
@@ -221,16 +223,6 @@ C:\Users\enzo2>wsl ls -la "/mnt/c/Program Files"
|
||||
|
||||
|
||||
|
||||
###Changer les couleurs pour **ls**:
|
||||
```
|
||||
LS_COLORS="ow=01;36;40" && export LS_COLORS
|
||||
```
|
||||
|
||||
cd utilise les couleurs ls.
|
||||
|
||||
```bash
|
||||
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
```
|
||||
|
||||
### =>[La suite (configurer wsl)](wsl2.md)<=
|
||||
296
docs/Windows/wsl_2.md
Normal file
296
docs/Windows/wsl_2.md
Normal file
@@ -0,0 +1,296 @@
|
||||
# Personnaliser WSL
|
||||
|
||||
|
||||
|
||||
### PowerShell
|
||||
|
||||
#### Installer git:
|
||||
|
||||
```powershell
|
||||
PS choco install git.install --params "/GitAndUnixToolsOnPath /NoGitLfs /NoAutoCrlf"
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installer Posh-Git and Oh-My-Posh:
|
||||
|
||||
https://github.com/JanDeDobbeleer/oh-my-posh?WT.mc_id=-blog-scottha
|
||||
|
||||
```powershell
|
||||
PS Install-Module posh-git -Scope CurrentUser
|
||||
PS Install-Module oh-my-posh -Scope CurrentUser
|
||||
```
|
||||
|
||||
Si PowerShell a besoin de NuGet, il propose de l'installer:
|
||||
|
||||
```powershell
|
||||
PS Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||
```
|
||||
|
||||
|
||||
|
||||
```powershell
|
||||
Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Configuration de PowerShell:
|
||||
|
||||
Exécuter "notepad $PROFILE" et ajouter à la fin:
|
||||
|
||||
```powershell
|
||||
Import-Module posh-git
|
||||
Import-Module oh-my-posh
|
||||
Set-Theme Paradox
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installer les polices:
|
||||
|
||||
Depuis WSL (linux)
|
||||
|
||||
```bash
|
||||
|
||||
# clone
|
||||
git clone https://github.com/powerline/fonts.git --depth=1
|
||||
# install
|
||||
cd fonts
|
||||
./install.sh
|
||||
# clean-up a bit
|
||||
cd ..
|
||||
rm -rf fonts
|
||||
```
|
||||
|
||||
Depuis PowerShell
|
||||
|
||||
```powershell
|
||||
# clone
|
||||
git clone https://github.com/powerline/fonts.git --depth=1
|
||||
# install
|
||||
cd fonts
|
||||
.\install.ps1
|
||||
#clean up
|
||||
cd ..
|
||||
rd /S /Q fonts
|
||||
```
|
||||
|
||||
|
||||
|
||||
### WSL
|
||||
|
||||
#### Installer zsh:
|
||||
|
||||
```bash
|
||||
$ sudo apt-get install zsh curl git
|
||||
|
||||
$ chsh -s $(which zsh)
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installer antibody:
|
||||
|
||||
```bash
|
||||
$ curl -sfL git.io/antibody | sudo sh -s - -b /usr/local/bin
|
||||
[sudo] password for bruno:
|
||||
getantibody/antibody info checking GitHub for latest tag
|
||||
getantibody/antibody info found version: 6.0.1 for v6.0.1/Linux/x86_64
|
||||
getantibody/antibody info installed /usr/local/bin/antibody
|
||||
```
|
||||
|
||||
On restaure .zshrc .zsh_plugins.txt .dircolors
|
||||
|
||||
```bash
|
||||
$ curl https://clicclac.info/backup/zsh_win10.tar.gz | tar -xzv
|
||||
```
|
||||
|
||||
On met à jour les plugins antibody
|
||||
|
||||
```bash
|
||||
$ antibody bundle < ~/.zsh_plugins.txt > ~/.zsh_plugins.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installer z plugin:
|
||||
|
||||
```bash
|
||||
$ cd /usr/local/etc/profile.d/z/
|
||||
|
||||
#Créer les dossiers profile.d et z si ils n'existent pas.
|
||||
|
||||
#Cloner le répertoire
|
||||
git clone https://github.com/rupa/z.git
|
||||
```
|
||||
|
||||
Ajouter la ligne suivante au .zshrc
|
||||
|
||||
```bash
|
||||
. /usr/local/etc/profile.d/z/z.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
### SSH
|
||||
|
||||
#### Générer une paire de clé ssh sous Windows:
|
||||
|
||||
```powershell
|
||||
PS ssh-keygen
|
||||
Generating public/private rsa key pair.
|
||||
Enter file in which to save the key (C:\Users\bruno/.ssh/id_rsa):
|
||||
Created directory 'C:\Users\bruno/.ssh'.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Copier les clés dans wsl:
|
||||
|
||||
```bash
|
||||
$ cp -r /mnt/c/Users/<username>/.ssh ~/.ssh
|
||||
|
||||
# Corriger les autorisations:
|
||||
$ chmod 700 ~/.ssh
|
||||
$ chmod 600 ~/.ssh/*
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installer keychain dans wsl:
|
||||
|
||||
```bash
|
||||
$ sudo apt install keychain
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Copier la clé sur le serveur:
|
||||
|
||||
```bash
|
||||
cat ~/.ssh/id_rsa.pub | ssh bruno@maboiteverte.fr 'cat>> ~/.ssh/authorized_keys'
|
||||
cat ~/.ssh/id_rsa.pub | ssh sentier@sur-le-sentier.fr 'cat>> ~/.ssh/authorized_keys'
|
||||
cat ~/.ssh/id_rsa.pub | ssh -p42666 bruno@clicclac.synology.me 'cat>> ~/.ssh/authorized_keys'
|
||||
```
|
||||
|
||||
Si il n'y a qu'une seule clé sur le serveur (scp écrase authorized_keys)
|
||||
|
||||
```bash
|
||||
scp -P42666 C:\Users\bruno\.ssh\id_rsa.pub bruno@clicclac.synology.me:~/.ssh/authorized_keys
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Ne plus demander la passphrase ssh:
|
||||
|
||||
https://medium.com/@glsorre/windows-subsystem-for-linux-never-prompt-your-ssh-passphrase-again-353db7c931ab
|
||||
|
||||
<u>Installer CredentialManager:</u>
|
||||
|
||||
```powershell
|
||||
PS Install-Module -Name CredentialManager
|
||||
```
|
||||
|
||||
<u>Copier les 2 fichiers suivants dans</u> `/home/[YOUR_WSL_USERNAME]/wslu/`
|
||||
|
||||
*keychain.ps1:*
|
||||
|
||||
```powershell
|
||||
$credentials = Get-StoredCredential -Target sshpassphrase
|
||||
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($credentials.Password)
|
||||
$passphrase = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
|
||||
C:\Windows\System32\wsl.exe -u [YOUR_WSL_USERNAME] -d [YOUR_DISTRIBUTION] /home/[YOUR_WSL_USERNAME]/wslu/keychain.sh $passphrase
|
||||
```
|
||||
|
||||
*keychain.sh:*
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
SSH_ASKPASS_SCRIPT=/tmp/ssh-askpass-script
|
||||
cat > ${SSH_ASKPASS_SCRIPT} <<EOL
|
||||
#!/bin/bash
|
||||
echo "$1"
|
||||
EOL
|
||||
chmod u+x ${SSH_ASKPASS_SCRIPT}
|
||||
export DISPLAY="0"
|
||||
export SSH_ASKPASS=${SSH_ASKPASS_SCRIPT}
|
||||
/usr/bin/keychain --clear id_rsa
|
||||
rm ${SSH_ASKPASS_SCRIPT}
|
||||
```
|
||||
|
||||
<u>Ouvrir dans le Gestionnaire d'identification:</u>
|
||||
|
||||
*Panneaux de configuration -> Gestionnaire d'identification -> Information d'identification Windows -> Ajouter des informations d'identification génériques*
|
||||
|
||||
- Adresse Internet ou réseau: sshpassphrase *(le mot passphrase)*
|
||||
- Nom d'utilisateur: sshpassphrase *(le mot passphrase)*
|
||||
- Mot de passe: <sshpassphrase> *(la passphrase)*
|
||||
|
||||
<u>Ouvrir le Planificateur de taches:</u>
|
||||
|
||||
*Panneaux de configuration -> Outils d'administration -> Planificateur de taches -> Créer une tache de base*
|
||||
|
||||
- Général:
|
||||
|
||||
- Mettre un nom: Launch Keychain
|
||||
|
||||
- Configuré pour Windows 10
|
||||
- Déclencheur:
|
||||
- quand j'ouvre une session
|
||||
|
||||
- Action: démarrer un programme
|
||||
- Programme/script: powershell
|
||||
- Ajouter des arguments: -File C:\Users\bruno\wslu\keychain.ps1
|
||||
|
||||
|
||||
|
||||
### VS Code
|
||||
|
||||
#### Avoir VisualCode en français:
|
||||
|
||||
Rechercher 'French language' dans les extensions
|
||||
|
||||
####
|
||||
|
||||
#### VScode et wsl:
|
||||
|
||||
Afficher la palette de commande (Ctrl+Maj+P) et entrer <u>Remote-WSL: New Window</u>
|
||||
Depuis le terminal, taper `code .` ou `code-insiders .`
|
||||
|
||||
La commande `code` est dispo depuis le terminal. Si elle ne l'est pas, vérifier que VS Code est dans le `PATH`.
|
||||
|
||||
Sinon ajouter la ligne suivante au `.zshrc`
|
||||
|
||||
```bash
|
||||
# VS Code
|
||||
export PATH="/mnt/c/Program Files/Microsoft VS Code/bin:$PATH"
|
||||
```
|
||||
|
||||
####
|
||||
|
||||
###Changer les couleurs pour **ls**:
|
||||
|
||||
```
|
||||
LS_COLORS="ow=01;36;40" && export LS_COLORS
|
||||
```
|
||||
|
||||
cd utilise les couleurs ls.
|
||||
|
||||
```bash
|
||||
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Fin
|
||||
|
||||
```bash
|
||||
$ uname --release
|
||||
4.19.84-microsoft-standard
|
||||
|
||||
# 08-08-2020
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user