I've been using VLC with command line batch files for years to rip audio cds.

I just tried writing a similar bash script in Ubuntu 14.04 and was surprised--I can't figure out how to get a list of file names on the CD to pass to VLC Media Player to convert. I need something like:

for f in $FILES
   echo "Processing $f file..."
   # take action on each file. $f store current file name
   call_my_vlc_function( $f)

Is there a 'trick' to getting a list of files on an audio cd in Ubuntu for use in a bash script or is this just not possible? I've already read a number of articles on how the gvfs system is different from a 'real' file system, but I'm just amazed that there is something Windows can do so trivially which can't be done in bash.



  • I'd suggest to install ripit if you like command line tools Apr 28, 2014 at 20:19
  • An audio CD does not contain "files", it contains "data" -- en.wikipedia.org/wiki/Compact_Disc_Digital_Audio Apr 29, 2014 at 13:52
  • Yeah, I get that, but regardless I need that in order to use VLC as I do. I figured there -had- to be a way to do it, since its so easy in Windows.
    – jchwebdev
    May 2, 2014 at 22:22
  • How does your script fail? What error message are you getting?
    – Sparhawk
    May 3, 2014 at 5:25
  • It doesn't 'fail' because I can't write it. The idea is to call VLC with the 'file name' of each track as a command line parameter. If I can't get a list of the file names (as one can do in Windows) I can't call VLC to convert each file.
    – jchwebdev
    May 4, 2014 at 23:55

2 Answers 2


I guess I would second using ripit. However, it is just a wrapper around some other CD utilities, such as cdparanoia and cdda2wav. It seems to me that it would just be easier to rip the entire CD into the file format you need (OGG, WAV, MP3...).

However, if you must use VLC, then I suspect all you really need is the track information, and cdda2wav can do that, but other than the number of tracks, I'm confused as to what you are looking for specifically. Anyhow, if you want to do that to get the number of tracks, you could then pass in the parameter to VLC such as:

vlc cdda//sr0 --cdda-track 1

More about ripit, check out the README just off of http://www.suwald.com/ripit/use.php

If you go low-level with cdda2wav or its companions, you may have difficulty with the version that coms with Ubuntu, so you might want to read up on it and download the other version from http://cdrecord.org.

If none of this helps, then all I can say is that more input is needed.


You're probably getting names like "Audio File 1" "Audio File 2" etc in Windows. These aren't real files, they're made up by Windows. Either use a GUI file browser with this support like Nautilus, or else use ripit, crip, yaret or some other script to rip.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .