Download Youtube videos using Ubuntu (Linux) command

There are numerous Addons and Extensions for Web Browsers to download and even convert the downloaded video to your desired format. However, if you are thinking of making a script or a program to download it without the browser, this post is what you need.

Run the following command to install the program:

sudo apt-get install youtube-dl

To download any video, open it in the browser, copy the URL and paste it in the following command:

youtube-dl -o [filename].flv [Copied URL]

If you didn’t provide any path with the filename, it will download it to your home directory.

Fixing Download Errors

In case you get the following error message:

ERROR: unable to download video

Try the following to fix it:

sudo -s
youtube-dl -U
youtube-dl -t [Copied URL]