Information
Useful one-liners for various things, I like to keep a repository of them for quick reference. Maybe you'll find some useful too.
One-liners
If you have a couple dozen DSCxxxx.jpg photos that you need to be renamed sequentially (or any file for that matter), like I often do, this'll do..
(change $c.jpg to whatever extension the files should end in, you can also apply arguments to ls -1 as necessary.)
f=$(ls -1); c=0; for i in $f; do mv $i $c.jpg; c=$(echo $c + 1 | bc); done
Strip large chunks of pesky comments from dist-default sample config files:
cat httpd.conf | perl -e 'while($a=<STDIN>){if($a !~ /^\s*#/){if($a ne "\n"){print $a;}}}' >httpd.conf.nocomments
Simple BASH forkbomb >:)
:()(:|:&);:
Sync my iTunes library FROM the
MacBook TO the Linux box's Banshee library:
rsync -va --exclude=*.m4v --exclude=*.m4p --rsh=ssh Music/iTunes\ Library/iTunes\ Music kevin@192.168.x.x:Music/