Harry Seldon's blog

Fractals, Chaos, and Control Systems on Rails

Read

Some useful commands in Linux administration when making a website.

Posted by Harry Seldon on September 27, 2008

This is a cheatsheet of useful commands in Linux administration when making a website in Rails. I am using these commands over and over again so I thought it might help someone.

Linux

Detailed list of files:

    ls -l 

List the running processes:

    ps -e  

Create a directory:

    mkdir demo 

Kill the use of a specific port (I use it when Aptana/RadRails crashes and do not close the port):

    fuser -k 3005/tcp  

Delete a directory and subdirectories, without confirmation, verbose mode. (BE CAUTIOUS !):

    rm demo/ -r -f -v  

Add a cron jon:

    crontab cron_job.txt 

List cron jobs:

    crontab -l 

Create cron job:

    crontab -e 

Mount a local virtual directory for an actual remote directory:

    sshfs ‘-oworkaround-rename’ username@ssh.domain.com: /home/username/remote/ 

MySQL

Connect to mysql local server:

    mysql -u username -p 

Connect to mysql remote server:

    mysql -u username -h mysql.domain.com -p 

Create databases (Rails style):

    CREATE DATABASE demo_development; 
    CREATE DATABASE demo_test; 
    CREATE DATABASE demo_production; 

Rails

Create a rails app:

    rails demo  

Install a plugin:

    script/plugin install git://github.com/pullmonkey/open_flash_chart.git 

Install a plugin, force reinstall:

    script/plugin install git://github.com/pullmonkey/open_flash_chart.git –force 

Launch server on a specified port:

    script/server -p 3005  

Open a console where you can send ruby commands to your app (Extremely useful!) in dev mode:

    script/console development

Open a console where you can send ruby commands to your app (Extremely useful!) in prod mode (BE CAUTIOUS !):

    script/console production

Migrate the database:

    rake db:migrate 

Migrate the database to a given version:

    rake db:migrate VERSION-22 

Migrate the production database:

    rake db:migrate RAILS_ENV-production 

Install gem:

    gem install RedCloth 

Install a given version of Rails:

    gem install -v-2.0.2 rails  

Git

Checkout a repo (svn meaning):

    git clone git://github.com/pullmonkey/open_flash_chart.git   

Get the differences:

    git diff 

Fetch from and merge with another repository or a local branch:

    git pull 

Checkout:

    git checkout 

Create a branch:

    git branch mybranch 

Configure the user settings:

    git config –global user.name "toto" 
    git config –global user.email "toto@example.com"  

Posted in | 2 comments | Tags , , , , , | atom

Search

Navigate


Recent Comments

Recent Posts

Tags

actuators aircraft atc blog chaos chaos_theory charts control controllers controls crisis economy finance flight fractals git gnc gs guidance linux mandelbrot marketing navigation ns ofc on pilot rails ruby sas scs sensors statistics systems techcrunch thinkosphere tutorial typo ubuntu wifi

Categories

Archives

Syndicate


Sponsor