Le shell Bash
Bash (Bourne Again Shell) est le shell par defaut. Il interprete vos commandes et permet d'ecrire des scripts.
Variables
NOM="Linux"
VERSION=24
echo $NOM
echo "Bienvenue sur $NOM version $VERSION"
# Variables d'environnement
echo $HOME echo $USER echo $PATH
echo $SHELL echo $PWD
Redirections
ls -l > liste.txt # Ecraser
echo "ligne" >> liste.txt # Ajouter
commande 2> erreurs.txt # Erreurs
commande > tout.txt 2>&1 # Tout
commande > /dev/null 2>&1 # Ignorer
Pipes (|)
ps aux | grep nginx
cat /etc/passwd | sort
ls -la | wc -l
history | grep "apt"
cat fichier.txt | head -5 | tail -1