save audio thats being played.

I want to save a song which is being played from internet.
I cant find where it gets cached. Im also not sure if the whole sing will remain in the cache while the song finishes.
There must be a way using /dev/audio or something. Im not able to figure out.

You can use Audacity to record any audio from your computer (including streaming). However the process only works by using the GUI.

This works only with certain soundcards. Increasingly often with modern cards, recording the output stream itself is being disallowed. Let's give the RIAA a big round of thanks for castrating our hardware, folks.

There may be a way using a "dummy" audio output device but I've found just getting the music URL to be much easier. Browser-based players have a fundamental flaw: The music has to be downloadable for it to work. The worst they can do is hide the URL. I'd install tinyproxy on my system, run it, configure your browser to use it, and watch the list of URLs in its logfile. You may be able to find the location of the actual music download.

Im listening from rythmbox. Any idea where it caches music or anyother way to find url or the cache?

If it caches net music at all, might be under ~/.cache/rhythmbox/ . I doubt it saves the URL, but you can intercept the URL in transit by the means I described.