tail + grep (+ awk)

tail -f /var/log/apache2/error.log | grep –line-buffered mod_rewritetail -f /var/log/apache2/error.log | grep –line-buffered mod_rewrite with awk: tail -f /var/log/messages | grep –line-buffered auth | stdbuf -o0 awk -F" " ‘{print $2}’tail -f /var/log/messages | grep –line-buffered auth | stdbuf -o0 awk -F" " ‘{print $2}’

Checking redirects with cURL

curl -s -L -D – http://marioosh.net:80 -o /dev/null -w ‘EFFECTIVE-URL: %{url_effective}\n’curl -s -L -D – http://marioosh.net:80 -o /dev/null -w ‘EFFECTIVE-URL: %{url_effective}\n’ https://www.chrislatta.org/articles/web/curl/track-redirects-curl-command-line

Resize images massively

Resize all images in current directory to 600px height: for i in *; do mogrify -verbose -resize x600 “$i” ; done Resize all images (*.jpeg, *.jpg, *.JPG) in current directory and subdirectories to 800px height: find -type f -iregex ‘\(.*\.jpeg\)\|\(.*\.jpg\)\|\(.*\.JPG\)’|xargs mogrify -verbose -resize x800

find & grep

Find ‘text to find‘ in *.xml files case-insensitive Method 1: grep -ir –include \*.xml ‘text to find’grep -ir –include \*.xml ‘text to find’ Method 2: find -name ‘*.xml’ -exec grep -i ‘text to find’ {} \;find -name ‘*.xml’ -exec grep -i ‘text to find’ {} \;