How to Download YouTube Videos From Linux Command Line

In this blog post, we will show you how to download youtube videos from linux command line using yt-dlp.

yt-dlp is an advanced fork of the well-known youtube-dl project, designed to offer additional features and improvements. This command line tool allows users to effortlessly download videos, playlists, and even entire channels from YouTube and various other supported sites.

Installing yt-dlp

Before we delve into the process, let’s start by installing yt-dlp on your Linux system. Open your terminal and run the following commands:

Ubuntu / Debian

$ sudo apt update 
$ sudo apt install yt-dlp -y


RHEL / Fedora / Rocky Linux / AlmaLinux

First install EPEL repository and then run following command.

$ sudo yum install yt-dl -y 
$ sudo dnf install yt-dlp-y

Arch Linux

$ sudo pacman -S yt-dlp


$ sudo zypper install yt-dlp -y

In order to install latest version of yt-dlp then run following curl and chmod command.

$ sudo curl -L -o /usr/local/bin/yt-dlp
$ sudo chmod a+rx /usr/local/bin/yt-dlp

Post yt-dlp installation, verify its version run,

$ yt-dlp --version

Download YouTube Videos From Linux Command Line

Now that you have yt-dlp installed, let’s explore the simple steps to download YouTube videos using the command line.

Use the following command to download a single video

$ sudo yt-dlp <video_url>

Replace <video_url> with the URL of the YouTube video you want to download.

For example:

$ sudo yt-dlp


If you want to download an entire playlist, use the following command:

$ sudo yt-dlp -i –yes-playlist <playlist_url>

Replace <playlist_url> with the URL of the YouTube playlist.

For example:

$ sudo yt-dlp -i --yes-playlist


Choosing Video and Audio Quality:

One of the highlights of yt-dlp is its ability to let you customize your downloads. You can choose specific video and audio quality options according to your preferences.

For example, to download the best video and audio quality available, use the following command:

$ sudo yt-dlp -f bestvideo+bestaudio <Video-URL>

If you prefer a specific video quality, you can specify it using:

$ sudo yt-dlp -f 'bestvideo[height<=720]+bestaudio/best[height<=720]' <Video-URL>

In order to download high-quality YouTube video and audio, use the following command.

$ sudo yt-dlp -f best <Video-URL>

If you’re interested in just the audio, you can use the following command:

$ sudo yt-dlp -x --audio-format mp3 <Video-URL>

To list all available format codes for the video, run

$ sudo yt-dlp -F <Video-URL>


$ sudo yt-dlp -F


To download the video along with the subtitles, run following command.

$ sudo yt-dlp --sub-langs all <video_url>  
$ sudo yt-dlp --sub-langs "en.*" <video-url>

In order to list all available sub-titles of a video, run

$ sudo yt-dlp --list-sub <Video-URL>

That’s all from this post, We hope you have found it informative and useful. Kindly do post your queries and feedback on below comments section.

1 thought on “How to Download YouTube Videos From Linux Command Line”

Leave a Comment