3 Jul
Unix Tips
Simple Ruby Commands
- Batch rename of files
Dir.foreach(‘.’){|fn|`mv #{fn} #{fn.sub(‘_f’,‘#f’)}` if fn =~ /_f/}
ssh
Login without Password
$cd ~/.ssh $ ssh-keygen -t rsa $ cat id_rsa.pub |ssh lifidea@lifidea.com 'cat >> .ssh/authorized_keys'
xargs
cp
#mv (sydney)
find spam_2/ -type f|head -100|xargs -i mv {} ./spam
#Substitute % into input from stdin
$ find . |tail -10 |xargs -J % cp % ../spam_s/
#ungzip
find /work2/COLLECTIONS/blogdata/ -name 'feeds*.gz'|xargs gzip -c -d > trecblog_feed.docs
awk
grep ^\<title topics.1-50 topics.51-100 |awk -F':' '{print $3}' > query_title.1-100
wget
#Crawl Website, only for changes, with .html extension wget -o cs.log -r -l 10 -N -E -k -D umass.edu "http://www.cs.umass.edu":http://www.cs.umass.edu
screen
- http://www.delorie.com/gnu/docs/screen/screen_toc.html
- http://www.kuro5hin.org/story/2004/3/9/16838/14935
- http://aperiodic.net/screen/quick_reference
- http://gentoo-wiki.com/TIP_Using_screen