Programming arduino using terminal on linux

I have an Arduino UNO hooked up to a linux server (terminal only no X) by USB. Is it possible to program it this way?

yes

You need
avr-gcc
avrdude
make
but also the directory tree of the arduino IDE.
You do not need to start the IDE itself, but you need a proper Makefile.

Makefile examples:

http://code.google.com/p/u8glib/source/browse/sys/arduino/HelloWorld/Makefile.100.uno
http://www.arduino.cc/playground/uploads/Learning/Makefile

Oliver