When faced with danger, have no fear;
when faced with difficulty, have no worries or stress;
when faced with injustice, have no anger;
at all time, live life without guilt.
bash
Clear the whole Postfix mail queue
~# for i in `mailq|grep '@' |awk {'print $1'}|grep -v '@'`; do postsuper -d $i ; doneThomas Sewell from coolsewell.com contributed with this helpful notes:
Split big files for editing
If you need to edit a big file, for example a mysql full dump for recover a single database, and your editor, for example emacs, say
something like "Maximum buffer size exceeded" you can split it in many smaller files.
~$ split -b 100m ORIGINAL_BIG_FILE OUTPUT_FILE_NAMEOutput files will be:
OUTPUT_FILE_NAMEaa
OUTPUT_FILE_NAMEab
OUTPUT_FILE_NAMEac
and on ... every one 100MB weight.
Then you can edit and just keep your DB for restore.
How do you rename files with a certain pattern in bash?
How do you rename files with a certain pattern in bash?
for i in *ABC*
do
new=$ ( echo $i | sed ’s/ABC/DEF/’ )
mv $i $new
doneThanks Live from Yokohama
Print all ANSI colors
(from http://wiki.splitbrain.org/shellsnippets)
for i in 30 31 32 33 34 35 36 37 39
do
for j in 40 41 42 43 44 45 46 47 49
do
# skip if same fore- and backgroundcolor
if [ $j -eq $[ i + 10 ] ]; then
continue
fi
echo -e $i $j "\033[${i};${j}mCOLOR\033[0m"
done
done

