Skip to main content


Optimize images with cronjob

With image styles and responsive breakpoints drupal generates automatically smaller images from the original uploaded ones.

Find lines in big files

Get all lines in a big file containing some text:

cat filename  | egrep "|||"

Thanks to Günter!

Find files NOT of type

find . -type f -not -iname "*.jpg" -not -iname "*.jpeg" -not -iname "*.gif" -not -iname "*.png" -not -iname "*.pdf"


Split files on lines

Split the file into multiple files at every 3rd line . i.e, First 3 lines into F1, next 3 lines into F2 and so on:

$ awk 'NR%3==1{x="F"++i;}{print > x}' filename

SCP syntax

Useful to copy directories from one server to another:

cd into the dir you want to have your data

scp -prq username@ .

Batch replace text in big files

For example: Change Collation in a big database dump.

cat dumpname | sed s/CHARSET=utf8/CHARSET=utf8\ COLLATE=utf8_unicode_ci/ > neuer_dumpname