Download Youtube Videos From Linux Command-line

Have you ever liked a video so much that you want to download it and take it with you in places where there is no internet, but you don’t know how to do that in Linux? I have the right solution for you!

The solution is to use youtube-dl, which is a command-line program used to download videos from youtube and many other sites such as Instagram, MTV, soundcloud and RedTube. You can read the full list of supported sites here. The youtube-dl tool is coded in python and this makes it work in mulptiple platforms such as Windows, Unix boxes, Mac OS X and linux distributions (Ubuntu, Fedora, Arch etc). I love the fact it is coded in python because it is a great chance for me to study the source code of this tool since i am a python guy and youtube-dl is open source. Feel free to modify it, redistribute it or use it however you like.

What do you need to install and run youtube-dl command-line tool?

youtube-dl requires python Python interpreter, version 2.6, 2.7, or 3.3+. How you install it in Ubuntu and other Debian based distros (Linux Mint etc)? It is very easy, just open a terminal and type the same command as shown in Figure 1.

Enter the command:

sudo apt-get install youtube-dl

Figure 1

Figure 2

Figure 3

Figure 4

Not everyone uses ubuntu and linux mint, so how does one install youtube-dl in Arch linux or rpm based distros?

2) RPM Based Distro (Fedora, CentOS,etc)

sudo yum install youtube-dl

3) Arch Linux

Arch Linux users enter the following command in terminal.

sudo pacman -S youtube-dl

After successfully installing youtube-dl command line program we can use it to download videos. Open a new tab in your web browser and search for the youtube video you want to download. For example, i want to download Come & Get It of Selena Gomez.

First Step – Copy the url of the video

Second Step – Open a terminal and enter following command

youtube-dl (paste youtube-url)

Figure 5

Figure 6

The program will download video webpage, video info webpage and extract video information. You will get details about the download speed, size of the video and the download percentage. Uppss, i killed the download process without knowing about it, what should i do now? I typed Ctrl + C which is used to pause or stop the download.To resume the download i use the following command:

youtube-dl -c (paste youtube-url)

Figure 7

As you can see from Figure 7, it started where it stopped.

Figure 8

Now that you learned how to download videos from youtube on Linux, go and do a collection with your favourite videos. For any question you have do not hesitate to ask in the comments and use our brand new forum.