Command to Download YouTube Video

By Xah Lee. Date: . Last updated: .

download YouTube video by command: yt-dlp

yt-dlp is a fork with improvement of youtube-dl. yt-dlp began around 2020.

download at


youtube-dl is a command line utility to download YouTube videos, or twitter, facebook, and most other popular sites.


(Note: on Ubuntu linux, it has a package in apt-get, but it's old there and doesn't work.)

After installed, run this in terminal:

# download a youtube video
youtube-dl --

Download Video Audio Separately

youtube-dl --id -k -x -- URL

you get 4 files:

Download Just Audio

youtube-dl --id -f NNN -- URL

where NNN is the format number. example: youtube-dl --id -f 140 -- URL

you can find out what format there is by

List Available Formats

youtube-dl -F -- URL

Video by Command Line Tutorials