Lire un fichier ligne à ligne :

1 while IFS= read -r ligne
2 do
3   echo $ligne
4 done <fichier.log

Avoir la date d'il y a X jours :

 1 #Le jour précédent
 2 date --date='1 days ago' +%Y%m%d
 3 
 4 #Il y a 1 mois
 5 date --date='1 months ago' +%Y%m%d
 6 
 7 
 8 #Dernier jours du mois ou la date :
 9 date -d "2013-01-01 +1 month -1 day" +%d
10 
11 #Date avec heure :
12 date  +%Y%m%d_%H%M%S

Redirection :

 1 # rediriger stdout seul
 2 hello01.pl > hello01.log
 3 
 4 # rediriger stderr seul
 5 hello01.pl 2> hello01.err
 6 
 7 # rediriger stdout + stderr
 8 hello01.pl &> hello01.all
 9 
10 qui est équivalent à
11 hello01.pl 1>hello01.all 2>&1

Rechercher un fichier avec un inode :

1 find / -inum #inode
2 ou
3 debugfs -R 'ncheck 296488178' /dev/mapper/vg0-lv_appli

Informations sur une connexion SSH :

1 SSH_CLIENT='192.168.223.17 36673 22'
2 SSH_CONNECTION='192.168.223.17 36673 192.168.223.229 22'
3 SSH_TTY=/dev/pts/6
4  => pas dinfo en root si passage via su

Fichier tar avec la date

1 #--selinux permet de garder les contextes SELinux
2 tar --selinux -czvf ./backup-"$(date +%Y%m%d_%H%M%S)".tar.gz /mes/fichiers/