Saturday, May 25, 2024
HomeTutorialsHow to Install and Use YouTube-DL on Linux System

How to Install and Use YouTube-DL on Linux System

As there is no official download button on the Youtube website to grab videos, so downloading youtube videos is always a bit tricky job. People have been using third-party applications to download videos from youtube. A few download managers are available for Linux, who has the option of downloading youtube videos. Some web browser extensions available to download youtube videos. But, if you want to use a hassle-free tool to download videos from youtube, surely YouTube-DL is the best option. YouTube-DL is a terminal shell-based command line application to download youtube videos on Linux. Here, YouTube-DL is the short form of Youtube Downloader.

YouTube-DL on Various Linux Distros

The YouTube-DL is written in Python, and C language. I must mention that the YouTube-DL grab videos from youtube based on the web scraping method. In this post, we are going to see how to install YouTube-DL on different Linux distros. Later, we will also see some useful techniques for downloading video and audio files from youtube using the YouTube-DL tool.

YouTube-DL on Linux

1. Installing YouTube-DL on Debian/Ubuntu Linux Distro

Linux users must know that the Gnome shell has gained tremendous attention from Ubuntu users across the world. You should be glad to know that the YouTube-DL is also a product of Gnome shell. That’s why the YouTube-DL works perfectly on Ubuntu Linux.

Method 1: Installing YouTube-DL on Ubuntu Linux via PPA Commands

Let’s see how to install YouTube-DL on Ubuntu Linux. In the very first step, I will update and upgrade the Linux system. Because updating the system repository is a crucial part before installing any package, it makes the installation smoother.

$ sudo apt update && sudo apt upgrade
$ sudo add-apt-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install youtube-dl

To check whether any version of YouTube-DL is already installed on your computer or not, you can use the following terminal command lines. Then you can update the YouTube-DL tool on Ubuntu.

$ youtube-dl -U
$ sudo youtube-dl --update

YouTube-DL on Linux install final

Method 2: Installing YouTube-DL on Ubuntu Linux via cURL Commands

There is also an extraordinary way to update the YouTube-DL on Linux that is based on the Client URL (cURL) command lines. To use cURL commands, you need to install the cURL tool. Then you may proceed to update the YouTube-DL. You can use the chmod command in the terminal to get the full access over your Linux system.

$ sudo apt install curl
$ sudo curl -o /usr/local/bin/youtube-dl
$ sudo chmod a+rx /usr/local/bin/youtube-dl

2. Installing YouTube-DL on Kali Linux Distro

Kali Linux is mainly used for high security and ethical hacking purpose. Regular Linux users can also use the Kali Linux for day to day use. The method of installing YouTube-DL on Kali Linux is pretty simple and straightforward. All the terminal command lines are given below. Kali Linux is built based on the fundamentals of Debian distributions, so we can use the sudo apt commands to install the YouTube-DL package on Kali Linux distro.

$ sudo apt install youtube-dl
$ youtube-dl
$ youtube-dl -F Youtube_URL

3. Installing YouTube-DL on Red Hat Linux Distro

Red Hat Linux is the business enterprise version among all of the Linux distros. We will be using the yum and commands to install and configure the YouTube-DL on Red Hat Linux. You can also use the wget commands to install the YouTube-DL in the local directory of Red Hat Linux. After the installation is done, you may now use the chmod command to get the full access over the YouTube-DL on your Red Hat Linux.

$ wget -O /usr/local/bin/youtube-dl
$ yum install youtube-dl
$ chmod a+rx /usr/local/bin/youtube-dl

4. Installing YouTube-DL on Arch Linux Distro

The Arch Linux is a bit underrated distribution of Linux. Because installing and maintaining applications on Arch Linux is a little tuff. However, now I will show how to install YouTube-DL on Arch Linux distro. We will use the cURL tool to update and upgrade the repository of YouTube-DL. Then we will change the root permission, so that we can run operations through the Linux terminal shell.

$ sudo curl -L -o /usr/local/bin/youtube-dl
$ sudo chmod a+rx /usr/local/bin/youtube-dl

Extra Tips – 1: Installing the GUI of YouTube-DL

Using the graphical user interface (GUI) of YouTube-DL is the easiest method to download youtube videos. I will now show how to install the GUI of YouTube-DL on Linux. First, update the system repository through the PPA shell commands. After that, you can install the GUI application through some terminal command lines. All the terminal commands are given below.

youtube-dl-gui linux

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

If you find any errors while installing the GUI of YouTube-DL, that could have occurred due to broken links or other repository restrictions. In that case, you can follow these terminal command lines given below.

$ wget
$ sudo dpkg -i youtube-dlg_0.4-1~webupd8~bionic9_all.deb
$ sudo apt-get install -f

You can also download the YouTube-DL-GUI from the official website of YouTube-DL-GUI. There you will find the GUI application for the Arch Linux, OpenSUSE, and Ubuntu Linux. Slackware repository, PyPi, and the Source Codes of YouTube-DL-GUI are also available on the website.

Download the YouTube-DL-GUI

Extra Tips – 2: Installing YouTube-DL via Pip on Linux Distro

Python will indeed be the leading programming language in the next decades. Here is a unique method to install YouTube-DL on your Linux machine via the Python Package Installer (PIP). First, you need to check which version of Python is running inside your Linux computer. Then you may continue to install the PIP package on Linux. Once the PIP package is installed, now you can start installing the YouTube-DL on Linux through the PIP installer. In my case, I am using Python 3, so I will install and run the PIP3 as well.

YouTube-DL on Linux pip

$ python3 --version
$ sudo apt install python3-pip
$ pip3 --version
$ sudo pip3 install youtube-dl
$ sudo pip3 install youtube-dl --upgrade

After the YouTube-DL is installed successfully on Linux, you may now update the YouTube-DL through the pip commands.

pip python

$ sudo youtube-dl -U
$ sudo -H pip3 install --upgrade youtube-dl

Getting Started with the Functions of YouTube-DL

Till now, we have learned how to install and configure YouTube-DL on Linux. Now I will show some primary features of YouTube-DL. YouTube-DL can download a single video, a bunch of videos, or even a full playlist from youtube. There are options to download subtitles along with the video. If you are a music lover, there are also options to extract and download audio-only from youtube. Now I am describing a few methods of how to use YouTube-DL on Linux.

Step 1: Download Video from Youtube by YouTube-DL

Before you start using the YouTube-DL, I would like to recommend you to go through the manuals of YouTube-DL. The manuals will help you to understand how to use YouTube-DL commands on Linux.

$ youtube-dl --help

To download a single youtube video, open your Linux terminal shell and follow the command line given below. You have to replace the video URL to get your desired video. You can also check the available formats of a particular youtube video. Then, select the video format and follow the next terminal command line. Here, the number 18 is assigned as an MP4 video. For better understanding, I am adding a picture of video formating.

downloading video from youtube

$ youtube-dl -F
$ youtube-dl
$ youtube-dl --list-formats
$ youtube-dl -f 18

format and code for video

Step 2: Downloading a Full Playlist from Youtube

Now, I will show how to download a full playlist through the YouTube-DL commands on Linux. But, be mindful that the playlist privacy must be public. You can also download an unlisted youtube video. You might want to know what would happen if you accidentally close the terminal window on Linux while the download process is running?

Will the download resume or, you have to start over? Well, luckily, the answer is yes, your download will be resumed and merged. You can download a full youtube channel through the YouTube-DL commands on Linux. YouTube-DL also supports bulk download, download specific video from a playlist, and multiple downloads at a time.

YouTube-DL on Linux playlist of ubuntupit

$ youtube-dl
$ youtube-dl
$ youtube-dl [URL1] [URL2]
$ youtube-dl -a videos-list.txt
$ youtube-dl -o linux-video
$ youtube-dl --playlist-items 6

Step 3: Assign Path & Formats for YouTube-DL

This is the step where you can assign a directory to store the downloaded videos on your Linux machine. Otherwise, YouTube-DL stores file in the Linux Home directory. You can download the best quality or the worst quality of the video from youtube through the YouTube-DL tool. Here, the syntax -f is used for starting the download process.

$ youtube-dl -o ~/Downloads/UbuntuPIT/linux-video
$ youtube-dl -f worst
$ youtube-dl -f best

If you find any video that is unavailable on your country, no worries, you can set a proxy address and port along with the YouTube-DL command in the Linux terminal.

$ youtube-dl --proxy url

YouTube-DL also has created an option to extract and download the audio file from the youtube video in mp3 format. To download an audio file using the YouTube-DL on Linux, you need to open the terminal shell and type  youtube-dl-x --audio-format mp3 <URL>. Here, the -x syntax is used to extract audio from the video file. YouTube-DL also allows downloading videos with subtitles. You can choose the type of subtitles and subtitle language.

$ youtube-dl -x --audio-format mp3
$ youtube-dl -x 9ao4FEaDGhQ

YouTube-DL on Linux subtitle

$ youtube-dl --write-auto-sub
$ youtube-dl --list-subs
$ youtube-dl --sub-lang en

Problems You May Face While Installing YouTube-DL

Here are some tips and tricks that would be helpful for you. If you find that the YouTube-DL has stopped functioning suddenly on your Linux machine, there is a chance that you have mismatched with the Python versions. This issue often occurs in Python 3.8. Make sure that your Python is working correctly. Then re-install the YouTube-DL on your Linux machine.

$ sudo apt-get purge youtube-dl
$ sudo apt remove youtube-dl
$ sudo apt install python3-pip
$ sudo pip install youtube-dl

If you had installed the YouTube-DL through the Snapcraft online application store, there is a chance that your YouTube-DL tool might stop working frequently. But don’t worry, this is a mild issue. Just install the Snap application on your Linux machine and re-install the YouTube-DL via the snap commands.

$ sudo apt install snapd
$ sudo snap install youtube-dl

Here is an actual tough problem that you may face while using the YouTube-DL on Linux. What would happen if you unintentionally delete the installation directory of the YouTube-DL from your filesystem? Here is the answer, you have to make the same directory inside your Linux machine and configure the permission settings. Usually, YouTube-DL is installed in the /usr/local/bin/youtube-dl directory.

$ sudo mkdir -v -p /usr/local/bin
$ sudo curl -o /usr/local/bin/youtube-dl
$ sudo chmod a+rx /usr/local/bin/youtube-dl

Removing YouTube-DL from Linux Distro

Till now, we have gone through all the processes of installing and using the YouTube-DL on Linux. But every so often, you may need to uninstall the YouTube-DL package from your computer. Here are some quick and basic terminal command-lines to remove YouTube-DL from Linux distros. You can also delete the installation directory of YouTube-DL from the Linux filesystem.

$ sudo apt-get remove youtube-dl
$ sudo apt-get remove --auto-remove youtube-dl
$ sudo apt-get purge youtube-dl
$ sudo apt-get purge --auto-remove youtube-dl

Ending Words

No doubt, Youtube is the richest video streaming website that is owned by Google. Youtube has not yet launched or announced to add any official download button to download videos from youtube. So, I think YouTube-DL is the best method to download youtube videos on Linux. And let me also add that downloading video from youtube is not illegal until you use it for business purposes or start taking advantage of it.

In this post, I have described all the possible ways of how to install YouTube-DL on Linux and how to use it properly. If you are a Linux user and think that using the YouTube-DL tool is an excellent method to download youtube videos, share this post on your social media. If you know any better approach to download youtube videos, please share your idea with us. Feel free to write your opinions in the comment section.

Mehedi Hasan
Mehedi Hasan
Mehedi Hasan is a passionate enthusiast for technology. He admires all things tech and loves to help others understand the fundamentals of Linux, servers, networking, and computer security in an understandable way without overwhelming beginners. His articles are carefully crafted with this goal in mind - making complex topics more accessible.


  1. Thanks Mehedi, this was very helpful when I had to re-install after upgrading to Ubuntu 22.04 – Got myself into a complete mess re YT-DL but your instructions guided me to the answer. \
    Thanks again

  2. youtube-dl -x –audio-format mp3
    I am trying this on openSuse Tumbleweed, but it is not working.
    I am able to use youtube-dl to download a video [mp4], but sometimes it would be nice to just pull the audio only.
    Is it possible that openSuse is missing something that is required to make this work?

    Also, I would like to know how to create a config file. Specifically, can I use any text editor to create “config”. KWrite or leafpad, for instance or would it be better to use one such as Nano?

    thank you Youtube-dl is awsome.

  3. Well done one minor issue:
    $ sudo apt-get purge youtube-dl
    $ sudo apt remove youtube-dl
    $ sudo apt install python3-pip
    $ sudo pip install youtube-dl

    I had to use on the last line.
    $ sudo pip3 install youtube-dl

    Good information thanks


Please enter your comment!
Please enter your name here

You May Like It!

Trending Now