i figured this out, just need to add this option to avrdude command:
-P /dev/ttyUSB0
this is the full command:
avr-gcc -O -Wall -mmcu=attiny24a demo.c -o demo.out
avr-objcopy -O ihex demo.out demo.hex
sudo avrdude -v -P /dev/ttyUSB0 -B 125kHz -p ATtiny24A -c stk500 -e -U flash:w:demo.hex
this code compiles c code into .hex file and flashes the program into avr microcontroller using my stk500 programmer board.