How to View Song Lyrics in the Linux Terminal


Listening to music relieves us of stress and makes us more productive at the task at hand. Occasionally, you might want to sing along with the euphonious melody of your favorite song but may end up struggling to identify the correct verse instead.


Luckily, you don’t need to leave the comfort of your /home and fire up a web browser to search for lyrics online. lyrics-in-terminal is a command-line app that displays song lyrics within the Linux terminal.


Installing lyrics-in-terminal on Linux

lyrics-in-terminal serves two different use cases. First, you can use it to identify lyrics for the currently playing track, and second, you can view the lyrics of a song stuck in your head by simply specifying its name to the command.

But before all that, you’ll have to install lyrics-in-terminal. Since it’s essentially a Python package, you need to have Python and PIP installed on your system. Most Ubuntu-based Linux distributions will have Python installed, but in case yours doesn’t, follow our guide to install Python on Ubuntu.

Then, install the python3-pip package before using PIP to install lyrics-in-terminal. To do this on Ubuntu- and Debian-based distributions, type:

sudo apt install python3-pip

On Arch Linux and its derivatives:

sudo pacman -S python-pip

To install python3-pip on Fedora, CentOS, RHEL, and Rocky Linux, type:

sudo dnf install python3-pip

After installing PIP, run the following command to install lyrics-in-terminal:

pip install lyrics-in-terminal

If you’re running an Arch-based distribution with AUR support, consider installing the package directly from the Arch User Repository using yay:

yay -S lyrics-in-terminal

You can invoke lyrics-in-terminal by typing lyrics in the terminal.

Remember to log out and back in again after installing the package, otherwise, the command won’t work.

How to View Song Lyrics on Linux

With the script in place, you can view the lyrics to a particular song using the -t flag. Note that you can get your desired results using just the song name, but if you want the results to be more accurate, it’s recommended that you specify both the song and artist name.

lyrics -t songname artist

For example, to view the lyrics to the song Bohemian Rhapsody by Queen, enter:

lyrics -t bohemian rhapsody

Or:

lyrics -t bohemian rhapsody queen

Output:

bohemian rhapsody lyrics in terminal

But that’s not the best part. Invoking lyrics-in-terminal without any arguments will scan for the currently playing song on your system and display its lyrics accordingly.

Display Lyrics for the Currently Playing Song

By default, if you simply type lyrics in the terminal and press Enter, it’ll start scanning for any active Spotify session, both the desktop client and web version. If found, lyrics-in-terminal will extract the song name from Spotify and display its lyrics.

lyrics
lyrics-in-terminal-working-with-spotify-web-1

That’s not it. You can also specify the name of the media player (other than Spotify) as an argument to the lyrics command. Supported players are VLC Media Player, Audacious, Rhythmbox, and mpd.

lyrics vlc
lyrics audacious
lyrics rhythmbox
lyrics mpd

In the lyrics view, you can press H to view the various keybindings that work with the interface. Some obvious ones are Up and Down to navigate through the lyrics line by line and Left and Right to move to the next page.

lyrics in terminal help page

You can also align the text to the left, right, and center using the J, K, and L keys. There’s also the option to switch between lyrics sources: R for Google and r for azlyrics.

If you come across any errors in the lyrics, you can edit the locally saved copy by pressing E. To update or delete the lyrics in the local cache, hit U or D, respectively.

Now You Can Sing Along With Your Favourite Track

lyrics-in-terminal isn’t just a simple tool that displays the lyrics to a song, it’s your entry pass to enjoying music in the way it was actually meant to be, by singing along.

Chances are you might not be impressed with the command-line interface of lyrics-in-terminal and would rather stick with the classic way of browsing lyrics websites. Even then, you’ll be spoilt for choice considering the sheer number of lyrics websites available on the internet.


Source link

Leave a Reply

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