Find old/oldest file from the tmp on Linux

find /tmp/ -type f -mtime +1 -exec rm {} \;

Delete all files having ‘jpg’ as extension within a folder and sub-folder older than 15 days old.

find . -mtime +14 -type f -name “*.jpg” -exec rm -f {} \;

SED command examples

remove/delete the line 10 from a file:

sed -i ’18 d’ fichier_A.txt
sed -i 18d fichier_A.txt

Delete 5 lignes from a certain line number, ex from line 6

sed -i 5,+6d file.txt

Delete the line which contains the word ‘BIDULE’

sed -i ‘/BIDULE/ d’ file.txt