Tag Archives: sh

Ignore sockets during tar backup

If you want to skip error sockets-related code during backup of whole filesystem you will be surprised there's no –ignore-sockets switch. But there's elegant method to to that: cd / sudo find . -type s > /tmp/sockets.lst if sudo tar … Continue reading

Posted in en | Tagged , | Leave a comment

Linux: How To Locate Duplicated Files Quickly

Locate duplicates quickly: I mean only size+filename check, not expensive MD5 sum computation: find . -printf "%f:%s:%p\n" -type f | \ awk -F: ' { key=$1 " " $2; occur[key]++; loc[key]=loc[key] $3 " " } END { for(key in occur) … Continue reading

Posted in en | Tagged , | Leave a comment

HOWTO: cleanup old files under Linux

Sometimes you want to separate old files (for example older than 30 days) into separate subdirectory to make navigation easier. Using Linux tools it's pretty easy task: mkdir -p OLD; find . -maxdepth 1 -mtime +30 -exec mv \{\} OLD … Continue reading

Posted in en | Tagged , | Leave a comment

GIT hooks: commit-msg to enforce commit rules

Recently I forgot to add #reviewthis directive for modifications of codebase that belongs to team A. And a subtle bug was introduced that way. Ops! I agreed earlier that all changes done to moduleB should be passed to a reviewer … Continue reading

Posted in en | Tagged , , | Leave a comment

Automatic free disk space monitoring on Linux server

The simplest way to monitor free disk space on Linux serwer, just place it in crontab: 0 8 * * *     df -h | awk '/^\// && $5 > 95 { print "missing space", $0 }' and ensure e-mail … Continue reading

Posted in en | Tagged , , | Leave a comment