How to Download YouTube Videos on Linux

Save YouTube Videos to Your Computer to Watch Them Offline

There are many reasons for storing YouTube videos on your hard drive as opposed to leaving them on the web and viewing them online.

For example, if you regularly take the train to work or you travel by plane, you know that internet access is either sparse or not existent. If you like to watch a series of training videos, it's good to know that you aren't reliant on the internet or the fact that the videos might be taken offline by the original poster.

What's more is that once the video is offline, you can watch it as often as you like without affecting network bandwidth, something that can easily downgrade the performance of your network if you're streaming videos often.

There are a number of tools available for downloading YouTube videos using Linux, like youtube-dl, clipgrab, nomnom, and python-pafy. ytd-gtk is often used along with youtube-dl since it provides a GUI for easier use. minitube and smtube let you watch YouTube videos straight from the desktop.

This guide, however, explains how to download YouTube videos using youtube-dl and ytd-gtk on Linux. Downloading YouTube videos using youtube-dl is just one of many of our favorite Linux terminal commands.

Tip: If you want to get the MP3 version of a YouTube video, you can do that, too. Follow that link to learn how to listen to the YouTube video as an MP3 audio file on your computer, phone, or tablet.

of 04

Download youtube-dl

Install youtube-dl From Ubuntu Software Centre
Download Youtube Videos Using Ubuntu.

You can download and install youtube-dl using the relevant package manager for your Linux distribution.

If you're using Ubuntu, you can install youtube-dl from the Ubuntu Software Centre or with apt-get.

To use the terminal option, start by updating some things on the back end, so enter these commands in order, pressing Enter after each one:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install youtube-dl

The above "install" command will work for all Ubuntu based distributions including Linux Mint, Elementary OS, and Zorin.

If you're using Fedora or CentOS, use Yum Extender or yum:

yum install youtube-dl

Are you using openSUSE? Try YaST or Zypper for installing youtube-dl.

of 04

Download a Video Using youtube-dl

Find A Youtube Video To Download
Find A Youtube Video To Download.

Obviously, before you can download a video, you need to find its URL so that youtube-dl knows which video to get.

  1. Open YouTube and search for the video, or click the link to the video if you received the YouTube URL over an email or in some other application.
  2. Once you're on YouTube, go up to the very top of the page where the address is located, and select all of it so that it's highlighted.
  3. Use the Ctrl+C keyboard shortcut to copy the location to the video.
  4. Open a terminal window and type youtube-dl.
  5. Put a space and then right-click the terminal window and paste the link.
  6. Press Enter to run the youtube-dl command and download the video.

What you should see in the terminal window before downloading the video might look something like this: 


Note: If you get an error about anconv not being updated, you can run two commands to fix that. After you run these, try the youtube-dl command again:

sudo add-apt-repository ppa:heyarje/libav-11 && sudo apt-get update
sudo apt-get install libav-tools
of 04

Download and Install ytd-gtk

GUI For Download Youtube Videos Using Linux
GUI For Download Youtube Videos Using Linux.

The same tool used to install youtube-dl can be used to get ytd-gtk, which is the program-like version of youtube-dl that might be easier to use for some people.

So, either use the graphical package manager supplied with your distribution or jump into the command line tool again.

For Ubuntu (and its derivatives), type the following:

sudo apt-get install ytd-gtk

Note: If you can't install ytd-gtk using the command above, download the DEB file directly and install it manually.

If you're using Fedora/CentOS, enter this:

yum install ytd-gtk

Use Zypper if you're using openSUSE.

of 04

How to Use the YouTube Downloader

Youtube Downloader
Youtube Downloader For Ubuntu.

You can start the YouTube download directly from the terminal window by typing the following:

ytd-gtk &

Note: The & at the end lets you run a process in the background so that control is returned to your terminal window.

Alternatively, you can run the YouTube downloader by using the menu system for your distribution. For example, you can access the Dash within Ubuntu and search for and open Youtube-Downloader to run the application.

The Youtube Downloader has three tabs: "Download," "Preferences," and "Authentication." Here's what to do to get the YouTube video:

  1. From the "Download" tab, paste the video's URL into the URL box and press the plus symbol next to it.
  2. After the video is added to the queue, either add more so that you can download videos in bulk, or use the button on the bottom right to start the download.
  3. The video will save to whatever location is chosen in the "Download Folder" option in the "Preferences" tab.

The "Preferences" tab is very important because when you click the download link for the first time you might get an error stating the requested format is not available.

The reason for this is that the default video output type in this YouTube download program is Hi-def, but that format isn't available on all systems.

The preferences tab allows you to change the output format to any of the following types, so pick a different one and try again if you get the format error:

  • Hi-def
  • Mobile
  • flv 240p
  • flv 360p
  • flv 480p
  • mp4 360p
  • mp4 720p

In addition to changing the output format, you can also change the output folder for the videos and supply proxy account details.

The authentication tab lets you enter a username and password for YouTube if you need to download private videos from a certain YouTube account.

Was this page helpful?