Download videos from YouTube in Ubuntu

Watching videos on YouTube is great fun. Loads of videos are uploaded everyday including music videos, movie trailers, T.V. shows etc. But what about saving your favorite videos on your hard drive? It’s easy if you use Windows as you can extract the videos from your web browser’s temporary internet files folder. But doing this work on a Linux distro like Ubuntu can be difficult for some people, especially for people who are new to Linux. It may seem uneasy but it’s not that hard.

You can make use of the commands in Ubuntu to save your videos. ‘youtube-dl‘ is a small command-line program to download videos from YouTube. Firstly, you will need to install ‘youtube-dl’ in Ubuntu.

To do so, give the following command at the terminal:

sudo aptitude install youtube-dl

Using youtube-dl is easy. Use youtube-dl followed by a YouTube video URL to download the video.

For example: youtube-dl “http://www.youtube.com/watch?v=xyz”

Here the video be saved to the file xyz.flv. Since YouTube videos are encoded in Flash Video format, their extension is .flv.


You can change the file name of a video using the -o option.

For example: youtube-dl -o myvideo.flv “http://www.youtube.com/watch?v=xyz”

In this case the video will be saved as myvideo.flv.

You may have noticed that some videos require you to login before playing them. It’s so because these videos have been flagged as containing mature content. To download such videos, you can pass the program the username and password for your YouTube account with the -u and -p parameters.

For example: youtube-dl -u yourusername -p yourpassword “http://www.youtube.com/watch?v=xyz”

Here you username is ‘yourusername’ and password is ‘yourpassword’.

Now you can download your favourite videos and save them on your hard drive on Ubuntu too. Keep them and play them whenever you want.

You may also like: