Programming ruby Linux basics

Remove svn files inside directory
rm -rf `find . -type d -name .svn

Set path in linux
export PATH=$PATH:/usr/ruby/bin
Here /usr/ruby/bin is the path to ruby extecuatble.

grep and print process pid
ps -ef | grep search_string | grep -v grep | awk ‘{print  $2 }’

Kill process
kill -9 process_id_here
ps -ef | grep search_string | grep -v grep | awk ‘{print  $2 }’ | xargs kill -9

Store pid of process in a variable for further process
tokill=`ps -ef|grep ruby|grep -v grep|awk ‘{print $2}’`;kill -9 $tokill;

Mirror a website
Command to clone/copy a website for offline/local browsing.
wget -mk

Above command downloads all website pages in depth level with stylesheets, images and javascripts.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.