perl grep (like unix's grep utility) - example args: '^[Cc]hris[^:]*' /etc/passwd
perl -we'$;=shift;die+grep{/$;/}<>'
portscanner
perl -MIO::Socket -wle'map { IO::Socket::INET->new(qq($ARGV[0]:$_)) and print } 1..$ARGV[1]||10000' localhost 1000
portscanner #2 (tells you which service runs on each open port)
perl -MIO::Socket -le'open S, "/etc/services" or die $!; /^(\S+)\s+(\d+)/ and $s{$2}=$1 for <S>;
IO::Socket::INET->new("$ARGV[0]:$_") and print "$s{$_}($_)" for 1..$ARGV[1]||1024' localhost 2000
Fetch a webpage (text-mode)
perl -MLWP::Simple -wlegetprint+pop 'http://site.com'
Generate random alphanumerical string (password generator)
perl -le'print map { (a..z,A..Z,0..9)[rand 62] } 0..pop' 7
Generate string using most characters (on my keyboard :-) )
perl -le'print map { chr( rand(93) +33 ) } 0..pop' 7
Stat your mbox (or logfile) for changes
perl -wle'$s = sub {(stat($ARGV[0]))[9]}; $t = &$s; for (;;) { sleep 2;
if ( &$s > $t) { $t = &$s; print "you have mail" } }' /var/mail/chris
Remove last character of each line of a file (or files!) and make backups of modified files.
perl -i.bk -wpe'chop' file
Ever watch a BSD box boot?
perl -e'$|++; 1 while select("","","",.04), print "\b", qw(/ - \ |)[$i++%4]'
Have a better/similar/smaller solution? E-mail me the one liner and I will put it up (and give you credit).