Archive for the ‘Linux’ Category

md5 on a string

Friday, December 18th, 2009

To get the md5 hash of a string from the command line, do e.g. this:

echo -n hallo | md5sum

It is important to do “echo -n” to prevent echo from outputting the trailing new line. Otherwise the newline will be included in the hash.

tail -f with highlighting

Monday, October 5th, 2009

Use

tail -f /path/to/my.log | perl -p -e 's/(KEYWORD_1|KEYWORD_2)/\033[7;1m$1\033[0m/g;'

to highlight all occurences of KEYWORD_1 and KEYWORD_2 in tail -f.