How to Download YouTube Videos on Linux

Save YouTube videos to your computer to watch them offline

Since there's been a YouTube, people have wanted to download videos to save for later or to play offline and on the go. For copyright reasons, YouTube doesn't make downloads available. However, there's a youtube-dl tool to download videos for free on Linux, as well as Windows and Mac.

There are a couple of ways to use youtube-dl on Linux. A straightforward way is to use the youtube-dl script from the command line. If you prefer a graphical option, there's a front end for youtube-dl that provides a wide set of controls and options.

Install YouTube-dl

Whether you want to download YouTube videos with a graphical application or the command line, you'll need youtube-dl. Youtube-dl is a Python script that grabs a YouTube video from the web and converts it into various formats, including audio-only formats.

For Linux users, getting youtube-dl is usually straightforward. The script is open-source, and you can find it in most distribution repositories. Follow the instructions for your Linux distribution.

You'll also need FFMPEG to allow youtube-dl to convert the downloaded videos between formats and to control video and audio quality. You can install FFMPEG along with youtube-dl.

Ubuntu and Linux Mint

For Ubuntu and Linux Mint, youtube-dl tends to fall behind in the Ubuntu ecosystem. Usually, that wouldn't be a huge deal, but youtube-dl must stay current to stay ahead of YouTube updates that prevent it from functioning. So, if you use Ubuntu or Mint, install the Python Pip package manager to get the latest releases.

  1. Open a terminal.

  2. Enter the following command to install Pip and FFMPEG:

    sudo apt install python3-pip ffmpeg
    Install youtube-dl on Ubuntu
  3. Install youtube-dl using the Pip Python package manager:

    sudo pip3 install youtube-dl
    Install youtube-dl with Pip on Ubuntu
  4. When the install is complete, you can use youtube-dl from the command line. To update youtube-dl in the future, run the following command:

    sudo pip3 install --upgrade youtube-dl


The Debian multimedia repository contains a library of up-to-date packages for various multimedia apps, youtube-dl included. You'll need to add the repository if you haven't already. Then, install youtube-dl normally with Apt.

  1. Open a terminal.

  2. Enter the following command to add the repository to your computer:

    sudo echo "deb buster main non-free" > /etc/apt/sources.list.d/multimedia.list

    Substitute testing or sid if you're running one of those instead of stable.

  3. Update the Apt repositories to pull in the new one:

    sudo apt update -oAcquire::AllowInsecureRepositories=true

    This command allows for insecure repositories since you haven't installed the signing key for the multimedia repository yet.

  4. Install the signing keys for the repository:

    sudo apt install deb-multimedia-keyring
  5. Install youtube-dl and FFMPEG:

    sudo apt install youtube-dl ffmpeg
  6. You'll automatically get the updated one from the multimedia repository.


Fedora keeps updated versions of youtube-dl in their repositories, but you won't find FFMPEG there. For that, you'll need the RPM Fusion repository. If you use Fedora on the desktop, RPM Fusion is invaluable. If you don't have it, add it to your system and install both packages.

  1. Open a terminal.

  2. Run the following command to add the RPM Fusion repository with DNF:

    sudo dnf install$(rpm -E %fedora).noarch.rpm$(rpm -E %fedora).noarch.rpm
  3. Install youtube-dl and FFMPEG:

    sudo dnf install youtube-dl ffmpeg

Arch Linux and Manjaro

Arch Linux, and by extension Manjaro, has updated versions of youtube-dl and FFMPEG in its default repositories. Install it with Pacman:

pacman -S youtube-dl ffmpeg

Install the Front End

This next step is optional. If you prefer to work in the command line, go to that part. Otherwise, follow the steps to install the graphical front end for youtube-dl.

The path to install it is slightly different for every distribution. Follow the instructions for yours.

Ubuntu, Mint, and Debian

The developers of the graphical front end, Tartube, made their own packages for Ubuntu and Debian-based distributions. You can get the packages from their Sourceforge page.

  1. Open a browser, then go to the Tartube Sourceforge download page.

  2. Select Download Latest Version (the big green box) to download the latest release.

    Tartube download page for Ubuntu
  3. Save the resulting package to your Downloads folder.

  4. Open a terminal and change the directory to the Downloads folder.

  5. Look at the name of the downloaded package, and install it with Apt. Or, use this command:

    sudo apt install ./python3-tartube_*.deb


Like with Ubuntu and Debian, the Tartube developers packaged their software for Fedora and made it available on their Sourceforge page.

  1. Open a browser, then go to the Tartube Sourceforge download page.

  2. Select the latest version of Tartube from the list.

    Tartube download page for Ubuntu
  3. Find the latest RPM package from the list. Avoid the package with STRICT in the name.

    Tartube download Fedora
  4. Save the resulting package to your Downloads directory.

  5. Open a terminal and change to the Downloads directory.

  6. Install Tartube:

    sudo dnf install tartube-*.rpm

Arch Linux and Manjaro

Tartube is available in the AUR, so there are plenty of ways to get it. Choose the AUR install method you're comfortable with. If you're not familiar with the AUR, the following is the default method for installing AUR packages.

  1. Install the base-devel and git packages:

    sudo pacman -s base-devel git
  2. Change into a directory where you want to download the package and clone it with Git:

    cd ~/Downloads
    git clone
  3. Change directories to the tartube directory:

    cd tartube
  4. Build and install the package with makepkg:

    makepkg -si

Download a Video With the Front End

Now that Tartube is installed, you're ready to download videos from YouTube.

  1. Launch Tartube. You can find it listed under Multimedia in most application menus. On GNOME, you can search for it.

    Launch Tartube on Ubuntu
  2. Select Edit at the top of the window, then choose System preferences from the drop-down menu.

    Tartube open edit menu
  3. In the System preferences window, select youtube-dl from the top menu.

    Ubuntu Tartube preferences window
  4. Select the Path to youtube-dl executable drop-down menu and choose Use local path (youtube-dl). Select OK to close the preferences window.

    Ubuntu Tartube set youtube-dl path
  5. With Tartube open, select Videos in the upper-left corner of the window.

    Tartube open on Ubuntu
  6. Go to YouTube and copy the URLs of the videos you want to download. Then, paste the URL in the text box located in the middle of the Add videos dialog box.

    Ubuntu Tartube add URLs
  7. When you have the videos you want, Select OK.

  8. The main Tartube window appears, and your videos are queued up. Select Download all in the lower-left corner of the window to start the download.

    Ubuntu Tartube video queued
  9. Your videos are available through Tartube. Select Player. You can also find your video files in the tartube-data directory.

    Ubuntu Tartube video downloaded

Download and Convert a Video From the Command Line

If you're a fan of the command line, prefer a direct approach, or don't want to be bothered with another piece of software, use youtube-dl by opening a terminal and passing it a YouTube URL.

  1. Change directories to the folder where you want to download the videos. For example:

    cd ~/Downloads
  2. To download a video with no conversion, pass the URL to youtube-dl without any additional information:


    That gets you a playable video in the current directory.

  3. If you want to specify the output video format, add the -F flag to list the available formats:

    youtube-dl -F
    youtube-dl list available formats
  4. You'll see a list of available formats and resolutions. Choose the one you want, and use the number to the left in the table to specify it with the -f flag:

    youtube-dl -f 137
    youtube-dl download specific video format
  5. To tell youtube-dl to grab the best quality video, use the -f flag:

    youtube-dl -f best
  6. To extract audio from a YouTube video, use the -x flag combined with --audio-format and --audio-quality:

    youtube-dl -x --audo-format flac --audio-quality 0 best

    The --audio-format flag supports all major formats, including MP3, Vorbis, M4A, AAC, WAV, and FLAC. The --audio-quality flag uses a scale from 0 to 9, with 0 providing the best quality.

    youtube-dl download audio only
Was this page helpful?