informatique:system_admin:shell
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
informatique:system_admin:shell [17/08/2009 15:57] – édition externe 127.0.0.1 | informatique:system_admin:shell [13/10/2023 11:42] (Version actuelle) – [Redirection flux standard] cyrille | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== Shell ====== | ====== Shell ====== | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | |||
+ | |||
+ | **Control Keys**: | ||
+ | * Ctrl-S : Pause Display | ||
+ | * Ctrl-Q : Restart Display | ||
+ | * Ctrl-C : Cancel Operation | ||
+ | * Ctrl-U : Cancel Line | ||
+ | * Ctrl-D : Signal End of File | ||
+ | |||
+ | |||
+ | ===== Commandes ===== | ||
+ | ==== sed ==== | ||
+ | |||
+ | |||
+ | * [[https:// | ||
+ | |||
+ | > [[http:// | ||
+ | >> | ||
+ | >> | ||
+ | >> | ||
+ | >> | ||
+ | |||
===== Tips ===== | ===== Tips ===== | ||
==== Redirection flux standard ==== | ==== Redirection flux standard ==== | ||
+ | |||
+ | * https:// | ||
+ | * https:// | ||
+ | |||
+ | tag: stderr, redirect | ||
Avec linux et windows, pour rediriger la sortie d' | Avec linux et windows, pour rediriger la sortie d' | ||
Ligne 12: | Ligne 44: | ||
<code bash> | <code bash> | ||
cat toto.txt > | cat toto.txt > | ||
+ | </ | ||
+ | Ou en utilisant la commande '' | ||
+ | <code bash> | ||
+ | cat toto.txt | tee output.log | ||
+ | </ | ||
+ | |||
+ | Un " | ||
+ | <code bash> | ||
+ | command &> file | ||
</ | </ | ||
Ligne 26: | Ligne 67: | ||
sed -e " | sed -e " | ||
</ | </ | ||
+ | |||
+ | |||
+ | ==== Effacer des fichiers selon leur âge ==== | ||
+ | |||
+ | <code bash> | ||
+ | find /tmp/ -amin +120 -type f -delete | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | find . -daystart -ctime -8 | xargs ls | ||
+ | # puis | ||
+ | find . -daystart -ctime -8 | xargs rm -fr | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | find -ctime 9 -exec rm -f {} \; | ||
+ | </ | ||
+ | |||
+ | ==== Extraire des champs ==== | ||
+ | |||
+ | Je voudrais extraire le password de /etc/shadow | ||
+ | |||
+ | On peut faire en 1 seule commande awk | ||
+ | awk -F: '/ | ||
+ | ou sed, mais c'est pas forcément plus léger (ni plus lisible) que ta solution | ||
+ | sed -ne '/ | ||
+ | ou | ||
+ | cat /etc/shadow | awk -F":" | ||
+ | |||
+ | ==== Session/ | ||
+ | |||
+ | > Comment lancer un script et se déconnecter avant la fin de son exécution ? | ||
+ | |||
+ | * Le lancer avec '&' | ||
+ | * Le lancer avec la commande ' | ||
+ | ou les deux ? | ||
+ | # nohup ./script.sh & | ||
+ | |||
+ |
informatique/system_admin/shell.1250517440.txt.gz · Dernière modification : 19/05/2012 00:15 (modification externe)