Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, January 30, 2014

Pure command line if then without the if or then

The && and || can be used to control command flow like if then...
$ /use/bin/somecmd && echo "it worked!" || echo "epic fail!"

Process list filtering with grep

Adding the square brackets prevents the grep command from showing up in the process list.

$ ps -ef | grep proces[s]

Icinga log parsing perl command

The perl command changes unix time to human readable time in the output... Very useful for searching the check log archives.

more /usr/local/icinga/var/archives/* | perl -p -e 's/^\[(\d+)\]/"[". localtime($1) . "]"/e' | grep <what you're looking for>