How to Install and Use YouTube-DL on Ubuntu 18.04

Install YouTube-DL ubuntu

This guide will take you through how to install and use Install YouTube-DL on Ubuntu 18.04. YouTube-DL is a command line tool written in Python to help users download videos from YouTube, Dailymotion, Yahoo, Facebook, Flickr,  PressTV and many other sites. YouTube-DL is a cross-platform piece of software, it runs on Windows, Linux/Unix, and macOS.

YouTube-DL support download from many sites in different formats, both as a video and audio files. By default, youtube-dl will pick the highest quality but you can obtain low quality if you have a slow internet connection by passing some options.

Other good features of youtube-dl include:

  • Resuming interrupted downloads
  • Extracting mp3 from video files
  • Downloading all video files from a playlist
  • Download only the videos uploaded in the last x days
  • Set  Maximum download rate
  • Embed subtitle into the video while downloading

How to install youtube-dl on Ubuntu

There are three ways to install youtube-dl on Ubuntu 18.04 system. We will consider the installation of youtube-dl from all the three methods:

Install youtube-dl from apt

The first and easy method is installing youtube-dl from apt repository. For this, you just need to run the command:

$ sudo apt-get install youtube-dl

Install youtube-dl using pip

youtube-dl package can also be installed using pip. First, install packagepython-pip.

$ sudo apt-get install python-pip

Once pip is present on the system, use it to install youtube-dl :

$ sudo pip install youtube-dl

Install youtube-dl from binary

Youtube-dl is also distributed as a binary package which you can download and install it.

sudo wget -O /usr/local/bin/youtube-dl
sudo chmod a+x /usr/local/bin/youtube-dl
hash -r

Any of the three methods should work fine for you.

Update YouTube-DL

You can always update youtube-dl to the latest release using the command below:

$ sudo youtube-dl -U

How to Use youtube-dl

Once you have installed youtube-dl , see below examples of how to download Videos and extract audio with youtube-dl.

Download highest quality video

To download the highest quality of a video from a URL, use the command:

$ youtube-dl

Check available video formats

YouTube-DL supports a multitude of formats, e.g  Mp4, mkv, webm, FLV e.t.c. To list available video codes, use -F option. E.g

$ youtube-dl -F
18 mp4 640x360 medium , avc1.42001E, mp4a.40.2@ 96k, 26.70MiB
43 webm 640x360 medium , vp8.0, vorbis@128k, 30.47MiB
22 mp4 1280x720 hd720 , avc1.64001F, mp4a.40.2@192k (best)

Take note of the format number - 18,43,22. This is used when downloading the video.

Download Specific video format

After getting a list of formats available, download specific format using -f format-number. E.g

$ youtube-dl -f 22

This will download format/codec1280x720 hd720.

Download Audio

You can also download audio using youtube-dl  like below:

youtube-dl --extract-audio --audio-format mp3

This will extract audio from the video and save it to disk.

Download a video playlist

Youtube-dl saves all videos on a playlist by default. Just copy playlist URL and pass it to youtube-dl command line tool.

$ youtube-dl

You can also start from a specified number.

$ youtube-dl --playlist-start 5

Force resume of partially downloaded files

To force resume of partially downloaded files without overriding completed, use -cwi options:

$ youtube-dl -cwi video-url

Use a proxy server to download files

$ youtube-dl --proxy

Download and embed subtitles to a video

Use the option --write-auto-sub to download Video subtitles if available.

$ youtube-dl --write-auto-sub <other-options> <url>

Install Youtube-dl GUI

If you are not a cli-centric person, you can as well install  Youtube-dl GUI program for easy download of video files. youtube-dl-gui is a cross-platform front-end GUI of the popular youtube-dl written in wxPython.

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update && sudo apt-get install youtube-dlg

You should be able to launch the tool from cli or Search

Read Also:

YouTube-DL is one of the best, complex and feature-rich tools to download Videos from the list of sites supported. It is fast, cross-platform, with low resource utilization. Give it a try and you'll like it.

Josphat Mutai 12:05 am


Your email address will not be published. Required fields are marked *

All comments are subject to moderation.


  1. I am running Ubuntu 14.04 and was trying to use 'youtube-dl' - but getting lots of error messages. I even removed and reinstalled the package from the repository using the suggested command above "sudo apt-get install youtube-dl".

    Using google and after looking at numerous web pages I came across one that suggested that the package should be loaded from the '' site directly which would ensure that this would be the latest version:

    And what a shock I got when I used 'youtube-dl -v' on the two versions!

    The linux repository version was 2014.02.17
    The '' version was 2019.03.09

    By the way the latest version seems to work fine under Ubuntu 14.04

  2. Only problems were earlier this year when I upgraded to 19.04... bios takes much longer to boot up as well... and Youtube-DL seems to preprocess but go into Error right after... not always, but most of the time. Is this a 19.04 issue only?