There's a huge colection of examples on soxexam(1) - zcat
Under linux, you can record just by catting from /dev/dsp or /dev/audio. These 2 devices behave in almost exactly the same way - the only difference is that by default /dev/audio uses m-law format while /dev/dsp uses 8 bit unsigned data by default. You can change these settings by using the ioctl(2) function.
The type "ub" is shorthand for unsigned bytes (8 bit samples). s means signed, and w means words (16 bit samples).
This will take your file named sound.wav, and do the effect named fade on it. The first 0 means no fade-in, the second 0 means stop the fade-out 0 seconds before the end, and the 3 means start the fade-out 3 seconds from the end. This gets output to the sound device.
Note - the above command has not been tested! So if it's wrong, please edit this page to correct it.
2 pages link to SoxNotes: