Linux Rip Audio CD

# A simple shell script to rip audio cd and create mp3 using lame 
# and cdparanoia utilities.
# ----------------------------------------------------------------------------
# Written by Vivek Gite <>
# (c) 2006 nixCraft under GNU GPL v2.0+
# ----------------------------------------------------------------------------
read -p "Starting in 5 seconds ( to abort press CTRL + C ) " -t 5
cdparanoia -B
for i in *.wav
	lame --vbr-new -b 360 "$i" "${i%%.cdda.wav}.mp3"
	rm -f "$i"

How Do I Use This Script?

Download the script. Put audio cd into drive. Create directory to store mp3s, enter:
mkdir music
cd music
mkdir "Album name"
cd !!:1

See HowTo: Linux Rip and Encode Audio CDs

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source, and DevOps topics via:
Category List of Unix and Linux commands
Disk space analyzers df ncdu pydf
File Management cat tree
Firewall Alpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilities NetHogs dig host ip nmap
OpenVPN CentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Manager apk apt
Processes Management bg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searching grep whereis which
User Information groups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPN Alpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
4 comments… add one
  • bas Nov 15, 2012 @ 8:40

    Very cool!
    But what about files name?
    Why i have to change handy?

  • Walter Apr 19, 2011 @ 18:46

    Oops, I used a wrong variable for the usage example ^^

    mkdir -p "music/Album name"
    cd !$
  • Walter Apr 16, 2011 @ 20:12

    The script should read

    # A simple shell script to rip an audio CD and create MP3s using lame
    # and cdparanoia.
    # ----------------------------------------------------------------------------
    # Written by Vivek Gite  and WS
    # (c) 2011 nixCraft under GNU GPL v2.0+
    # ----------------------------------------------------------------------------
    read -p "Starting in 5 seconds (to abort press CTRL + C)" -t 5
    if ! cdparanoia -B; then
    	echo "cdparanoia ended with error, bailing out" 1>&2
    	exit 1
    for i in *.wav; do
    	if lame --vbr-new -q 0 "$i" "${i%%.cdda.wav}.mp3"; then
    		rm -f "$i"
    		echo "Could not encode $i" 1>&2
    exit $rc

    I corrected spelling and added error checking. The script will now abort on a ripping error and won’t delete Wave files which have not been successfully encoded.
    If any error occurs, the exit code is not 0.
    Furthermore, “–vbr-new” and “-b 360” are contradictory options, the first telling lame to use variable bit rate and the second telling lame to use constant bit rate for encoding. I replaced the second with “-q 0” to achieve the best possible result.
    The usage example could be simplified with

    mkdir -p "music/Album name"
    cd $?
  • Peter Gaal Oct 20, 2010 @ 14:32

    petike-nb# abcde -a cddb,read,encode,tag,move,playlist,clean -d /dev/cdrom -o mp3 -V -x

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.