2014/11/19

How many hours ago was the file changed?

FILE="/path/to/file"
CURRENT_DATE=$(date +%s)
PREVIOUS_DATE=$(date -d "$(ls -ld $FILE | awk '{print $6,$7,$8}')" "+%s")
DELTA=$(( CURRENT_DATE - PREVIOUS_DATE ))
DELTA_HOURS=$(echo "scale=2; $DELTA / 3600" | bc)
echo $DELTA_HOURS hours ago

2014/11/04

List broken link(s)

Also catches cyclic links:
find /path/to/search -type l -exec test ! -e {} \; -print

Does not catch cyclic links:
find /path/to/search -xtype l

Deprecated:
find /path/to/search -L -type l 2>/dev/null | xargs ls -l