Download playlist from youtube on Ubuntu Linux

  • Download youtube-dl sudo apt-get install youtube-dl
  • Update your system sudo apt-get update
  • Check your version youtube-dl --version
  • Update to the last version sudo youtube-dl -U
  • Download all videos ignoring and retrying on errors and extracting using the best quality of video and audio on mp4 format
youtube-dl -citf 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4'[replace with the code after the equal] 

i.e. if your youtube's shared link is:

your command will be:

youtube-dl -citf 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4'

If you only want the mp3 file:

youtube-dl -f bestaudio "[replace with the code after the equal]" --exec "ffmpeg -i {} -codec:a libmp3lame -qscale:a 0 {}.mp3 && rm {} "
Attention: replace & by the correct double ampersand

you must have installed ffmpeg:
Manually installing ffmpeg with libmp3lame encoder support.
  1. Install lame encoder Download and extract lame from
  2. To extract use this command: tar xvzf lame-[your version].tar.gz
  3. access your extracted directory cd lame-*
  4. Create the Makefile ./configure
  5. make
  6. sudo make install
  7. Clone and install ffmpeg git clone
  8. Create Makefile using lame MP3 parameters ./configure --enable-libmp3lame
  9. make
  10. sudo make install
After all of these steps, you can use the youtube-dl command