CLI programming

I am trying to use my arduino from the CLI, but I am having trouble understanding changing the state of pins.

I am wondering if there is a function available in avr-libc that is analogous to the digitalWrite(ledPin, HIGH) available in the arduino environment.

I have seen PORTB = 0x20 which would set pin 6, but this is not readable and I do not understand the PORTx sequences.

Any help or explanation would be much appreciated

Thanks in advance

There are makefiles floating around that permit you to use the arduino libraries from the CLI... (try searching for "makefile")