How to Download YouTube Videos on Android with Terminal Only

No third-party apps or root required!

Many Android users wonder how to download Youtube videos on their phone. This seemingly simple question invariably leads them to a handful of third-party apps that get the job done, though not always efficiently. For example, see Appual’s article “Why Converting YouTube to 320KBPs MP3 is a Waste of Time”. These third-party apps can also be full of ads.

There is a much simpler way to download either full videos or audio rips from YouTube, using only an Android terminal. In this Appuals guide, we will show you exactly how to accomplish this, no root required!


The first step is to download and install the terminal emulator of your choice.

Give the terminal app storage permissions if they are not requested on launch by default. You can do this by going into your Settings > Apps > (emulator app) > Permissions > Enable Storage Access.

Now in the terminal app, enter all of the following commands on individual lines:

packages install python
pip install youtube-dl
mkdir /data/data/com.termux/files/home/storage/shared/Youtube
mkdir -p ~/.config/youtube-dl
apt-get install nano

(The last command is going to install nano text editor. This will allow us to easily set up our config file for the youtube-dl process).

Open your youtube-dl config file in nano text editor with this terminal command:

nano ~/.config/youtube-dl/config

Now add the following lines to the config file:

-o /data/data/com.termux/files/home/storage/shared/Youtube/%(title)s.%(ext)s
-f "best[height<=480]"

[You can replace 480 with 360, 720, or 1080 for video resolution quality. if you want to download audio only, replace best[height<=480] with 140, so that it just reads -f 140]

Now because there is no CTRL+S to save our changes in nano editor, we need to use the volume keys instead of CTRL as a keyboard (unless you are using a keyboard over USB-OTG). So to save your config file in nano, press Volume Down + O (on the Android screen keyboard), and exit with Volume Down + X.

Now when you are back in the terminal emulator, you need to type a few more commands. This will link Youtube-dl’s native terminal commands to the “Share” menu in the official YouTube app.

mkdir ~/bin
cd ~/bin

And we will create and config a new file in nano once again:

nano termux-url-opener

And add the following line to this new config file, then save and exit nano.

youtube-dl $1

Now we are ready to test everything. You can launch YouTube and go to any video, then tap the “Share” button. You should see a Termux button and icon. Pressing this button will download the video to your Android phone!

Expert Tip

How to Download YouTube Videos on Android with Terminal Only

If the issue is with your Computer or a Laptop you should try using Reimage Plus which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Reimage by clicking the Download button below.

Download Now

I'm not interested