# 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"` #### Historique: ```bash ❯ history 4235* cd perl 4237* git reset 4238* git reset --hard 4239* kymsu2 4242* rm -rf .git 4244* git init 4246* cd 4247* cd Pictures/thumbsup 4248* nano config.json 4249* cd .. 4250* cd thumbsup 4252* 916e 4255 rm .DS_Store 4257 l 4258 nano LICENSE 4259 nano README.md ``` Exécuter une précédente commande (!): ```bash ❯ !4231 916e bruno@DS916:~ $ ``` Executer la commande précédente (!!): ```bash ❯ nano README.md ❯ !! nano README.md ``` Les 5 dernières commandes: ``` ❯ history -5 4253 pwd 4254 hostname 4255 history 4256 nano config.json 4257 history 5 ``` Exécuter la dernière commande 'nano': ```bash ❯ !nano nano config.json ``` Voir la dernière commande 'nano (:p)': ```bash ❯ !nano:p nano config.json ``` #### "Reverse i" search: Taper **Ctrl+R** puis 'ssh': ```bash ❯ ssh dsm414 bck-i-search: ssh_ ``` Taper à nouveau **Ctrl+R**: ```bash ❯ git clone https://git.php.net/repository/pecl/networking/ssh2.git bck-i-search: ssh_ ``` Quand la bonne commande est trouvée, taper **Enter**. Sinon, taper Ctrl+G pour sortir. Commentaires interactifs: ajouter #comment pour retrouver plus facilement une commande. Pour zsh, activer cette fonction avec *setopt interactivecomments*. ``` ❯ setopt interactivecomments ❯ ping 192.168.1.8 #nas PING 192.168.1.8 (192.168.1.8): 56 data bytes ❯ ping 192.168.1.8 #nas bck-i-search: nas_ ```