Saturday, 17 March 2012

Useful Shell commands in Linux (terminal)

find . -name file_name # path first option without equal
grep -rn string . --context=5      # path last

# count the lines of ruby
( find ./ -name '*.rb' -print0 | xargs -0 cat ) | wc -l

rails -e production
rake x:y x:z RAILS_ENV=test # chain tasks and env is loaded only once
rails c production --sandbox 
rails dbconsole -p'whatever'
tailf log/development.log | grep -v ECONNREFUSED -E 'Processing|Render|Parameters' # show actions and templates only
ssh user@host 'ls -l'
scp -C user@host /tmp/db.sql /tmp/db.sql # -C will compress the data over the wire
curl -Lk --user user:pwd --data "param1=value1&param2=value2" http://url
service --status-all
netstat -an | grep "LISTEN " # check the open ports
free -m # check the ram
df -H   # check the disk
curl --user usr:pwd -Lkv --data "param1=value1&param2=value2" www.url.com/post_here
scp -C urs@url:/origin/ destination/ 
ncdu / # disk usage
 

No comments:

Post a Comment