list audio inputs
arecord -l
select alsa input
record from alsa input
arecord -t wav > [name].wav
record 5 seconds
arecord -d 5 > [name].wav
record as ogg
arecord -f cd -t raw | oggenc - -r -o [name].ogg
requires install ogg support
sudo apt-get install vorbis-tools

Pulse Audio

show commands available in pacmd
pacmd --help
info on PulseAudio deamon
pactl info
list loaded modules
pacmd info
list available devices
aplay -l
aplay -L
pacmd list-cards
To list existing streams
pactl list sink-inputs
pactl list source-outputs
moving application to another sink (sound output) while it is running
pacmd move-sink-input [id to move] [destination sink id]

Further reading