Shells¶
ASH¶
Préférences:¶
- System:
/etc/profile
- User:
~/.profile
BASH:¶
Préférences:¶
Il cherche les fichiers dans l'ordre suivant:
- BASH comme login SHELL (une session où on se loggue dans le système, une connexion ssh):
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
- BASH comme application (après s'être loggué avec un autre SHELL)
/etc/bash.bashrc
~/.bashrc
Recharger la configuration:¶
$ source ~/.profile
ou
$ . ~/.profile
On peut aussi créer un alias: alias rload=". ~/.profile"
Historique:¶
❯ 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 (!):
❯ !4231
916e
bruno@DS916:~ $
Executer la commande précédente (!!):
❯ 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':
❯ !nano
nano config.json
Voir la dernière commande 'nano (:p)':
❯ !nano:p
nano config.json
"Reverse i" search:¶
Taper Ctrl+R puis 'ssh':
❯ ssh dsm414
bck-i-search: ssh_
Taper à nouveau Ctrl+R:
❯ 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_
Dernière mise à jour:
February 4, 2021