Photo etc

Shell scripts for archiving digital photos in directories by date

The fact that most digital cameras store the shooting dates inside JPEG files in the EXIF format makes it possible to automatically archive the photos by date right after they are downloaded, which is exactly what the scripts below do. Here’s an example of a directory tree they create: 1999 1999-07 1999-07-14 IMG_48324.JPG IMG_48325.JPG IMG_48326.JPG […]

Read More
Linux

Shell script for removing duplicate files

The following shell script finds duplicate (2 or more identical) files and outputs a new shell script containing commented-out rm statements for deleting them. You then have to edit the file to select which files to keep – the script can’t safely do it automatically! OUTF=rem-duplicates.sh; echo “#! /bin/sh” > $OUTF; find “$@” -type f […]

Read More
Linux

Using GNU screen

If you do not like unnecessary windows open, or want to get the maximum out of your terminal session, screen will soon be in your .bash_history numerous times. I found GNU Screen’s barrier to entry quite high, and I wanted to lower it for my readers. GNU Screen enables you to run many shell processes […]

Read More
Security

Script to unmount Busy Devices

First the script tries to umount the drive normally. If that fails, it tries to restart famd which is the most common problem. If that fails it tries to restart xinetd. If that fails it uses the command fuser -ki which asks you if you want to kill each process that’s using that folder. Be […]

Read More
Linux

SSH Dictionary Attack Prevention with iptables

It is ideal to slow down the SSH dictionary attack when the infested host started to brute force the SSH authentication. There are many scripts/user-land daemons that perform monitoring and blocking. I prefer to use something that has less demand in memory/CPU usage. IPTables module provides a kernel level solution with little overhead.

Read More