Mplayer is initially a movie player for Linux, but through the many available options, it is capable of doing many other things, including to save, record or dump online music stream to file.

In it’s easiest form, running the following command will dump 1.FM’s Channel X (with more channels available from to current.mp3

$ mplayer -dumpstream  -dumpfile current.mp3

The following bash script takes this a little bit further by keeping the latest 3 dumps, and delete the older ones.

mv $WORKDIR/current.mp3 $WORKDIR/`date +%F`.mp3
if [ $CURRENTDUMP -ge $MAXDUMP ] ; then
   for i in `ls $WORKDIR | head -n $[($CURRENTDUMP-$MAXDUMP)+1]`; do
      rm $WORKDIR/$i
mplayer -dumpstream  $URL -dumpfile $WORKDIR/current.mp3

Going a little further is to run the script through cron nightly, for daytime listening probably while being mobile and offline. Crontab entry is editable by the following command;

$ crontab -e

and add the following line (assuming the script is located at /home/shakir/

0 2 * * * /home/shakir/

Do make sure the script is executable by running the following command:

$ chmod a+x /home/shakir/