There's not a simple command-line way of doing it like that, no.
The best way, for programs that support it, is JACK. Tell a program to use JACK output, and use a JACK-capable recording tool (which could include command-line ones such as
ecasound or even plain old
jackrec) to connect to that application's output port and save it.
For ALSA apps, it's possible, but potentially more work. You'd need to install the
pavucontrol package from Synaptic. This is part of PulseAudio that for some reason Ubuntu don't include by default. Run it along with a recording app such as
gnome-sound-recorder and when you start that recording you should see it in the ‘Recording’ tab. You can then switch its input to ‘Monitor of (your sound card)’ to pick up all the sound being produced.
Unfortunately this doesn't isolate one particular application. If you needed to do that with an ALSA/Pulse app, you'd have to create a
.asoundrc file to configure a fake sound card that only your selected application would make sounds on, and record from that. Alternatively you could install a proper libasound2-plugins that includes the ALSA->JACK plug and then just use the JACK stuff. Unfortunately Ubuntu's libasound2-plugins doesn't include it, because that would just be too easy wouldn't it?
Skype is a further PITA, it has always had difficulty choosing where to send its output. For me, the newest version seems only ever to want to talk directly, unconfigurably, to Pulse, which has rather scuppered my attempts to connect it to anything else.
Sigh. Linux audio is a mess. Skype is a mess. Both of them together is a horror.