Nice and proper shutdown of a program via console

Ever wanted to shutdown a program over the console just like you would close it normally over its GUI?

#example: transmission (bittorrent client) is able to 
#report its upload stats to the tracker before 
#shutdown this way

kill -2 `pidof transmission`

#or (if you're in a bad mood)

killall -s 2 transmission