Breaking News

You don’t have to leave the comfort of your Linux terminal to watch YouTube videos. ytfzf makes it easier to search YouTube from the command line.
It's no secret that Linux keyboard warriors spend their lives in the terminal, only surfacing to load a browser and watch their favorite Taylor Swift music video on YouTube.
With ytfzf, you can search YouTube videos from your terminal and stream them using a lightweight media player. You'd never need to open a browser to watch YouTube on Linux again!
ytfzf is a set of scripts that run in your terminal, and it doesn't use the YouTube API. When ytfzf starts up, it fetches a list of the top 10 Invidious instances and selects one at random. Invidious is a web-based alternative front end for YouTube, and there are thousands of instances across the world.
With the Invidious API, ytfzf searches for the video you want. It then uses yt-dlp to download and stream the video to mpv.
YouTube won't be able to set any cookies on your devices, and you won't see any adverts or pre-roll videos, either.
Before you install ytfzf, you need to install its dependencies, including mpv—a free media player for the command line, with support for a wide variety of media file formats, audio and video codecs, and subtitle types.
ytfzf uses yt-dlp to download YouTube videos you find, so you should install yt-dlp as well.
Clone the ytfzf repository, and cd into it:
Now compile ytfzf, install the documentation, and compile the add-ons:
ytfzf is now installed on your Linux system, and you can start it by entering:
As ytfzf is a bit awkward to type or remember, you may want to create a memorable alias for the command.
As ytfzf doesn't connect directly to YouTube to search for videos, when you start the app, you'll see "Fetching list of healthy invidious instances".
At the search prompt, enter the name of the video you want to search for. This doesn't need to be exact, and typing "swif" then hitting Enter will give you all the Taylor Swift music videos you could want. You can further refine these by inputting more text.
Use the arrow keys on your keyboard to navigate results, and hit Enter to stream the one you want.
mpv will open, and the video will play. You can pause the video with Space, and fast-forward or rewind with the arrow keys.
If you want to see thumbnails of the videos before you stream them, you need to add a switch before launching ytfzf:
Be aware this will not work in all terminals.
To create a playlist with ytfzf and mpv, simply press Tab when a video you want to watch is highlighted, then Enter to add it to the playlist.
Instead of launching ytfzf and then entering your search term, you can issue:
…to be given a list of Linux videos to select from. ytfzf accepts arguments to make your experience more precise. Here are some of them:
As an example, enter:
…and mpv will instantly start playing "Bejeweled" by Taylor Swift.
Being able to search YouTube from the terminal without needing to open a browser and accept adverts, tracking, and cookie consent dialogs will make you the envy of your friends.
Why not impress them even more by reading out a Wikipedia summary of your favorite musical artist in the very same terminal window?
David is a freelance writer with a background in print journalism, and a love of Free and Open Source Software.  He is a terrible guitar player, and he spends his free time touring the British Isles, off-grid, with his caravan and dogs. Occasionally, he writes books. No-one likes them. See what he's up to at


Leave a Reply

Your email address will not be published. Required fields are marked *

Share Article: