### Commands by ringlerun (2) the last day the last week the last month all time sorted by date votes

• for example if you did a: ls -la /bin/ls then ls !$ is equivalent to doing a ls /bin/ls 9 !$
· 2010-01-24 17:59:52
• sometimes if directories are too deep, chmod -R fails... in those cases, a find comes in most handy :)

-10
find . -print -exec chmod 777 {} \;
· 2009-12-23 13:16:31

### What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

### Check These Out

find and delete empty dirs, start in current working dir

Quick find function
A function that allows you to perform a case-insensitive search in the current directory, and directories in the current directory (but no further), for files containing the first argument anywhere in their names.

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "\$S" }

To take information about the characteristics of the installed memory modules.

Generate a (compressed) pdf from images
use imagemagik convert

Find the package that installed a command

escape any command aliases
e.g. if rm is aliased for 'rm -i', you can escape the alias by prepending a backslash: rm [file] # WILL prompt for confirmation per the alias \rm [file] # will NOT prompt for confirmation per the default behavior of the command

Find Duplicate Files (based on MD5 hash) -- For Mac OS X
This works on Mac OS X using the md5 command instead of md5sum, which works similarly, but has a different output format. Note that this only prints the name of the duplicates, not the original file. This is handy because you can add | xargs rm to the end of the command to delete all the duplicates while leaving the original.

rename file name with fixed length nomeric format pattern