If you want to upload a program to Arduino from the command line can be done with inotool.

First install dependences:

apt-get install python-setuptools
apt-get install python-configobj
apt-get install python-jinja2
apt-get install python-serial

For serial tests:

apt-get install picocom

Obtain source and compile it:

git clone git://github.com/amperka/ino.git
make install

Start a project:

mkdir blink
cd blink
ino init

Change it src/sketch.ino with your program. A sample:

#define LED_PIN 13

void setup()
{
    pinMode(LED_PIN, OUTPUT);
}

void loop()
{
    digitalWrite(LED_PIN, HIGH);
    delay(100);
    digitalWrite(LED_PIN, LOW);
    delay(900);
}

In my case I’m using Arduino Duemilanove so I created a configuration file ino.ini (in the same project folder):

[build]
board-model = atmega328

[upload]
board-model = atmega328

You will need arduino-core:

apt-get install arduino-core

Build project

ino build

And now upload to Arduino:

ino upload

My Arduino:

My Arduino

You can see a good tutorial here.