Home / Exciting tips / Linux / How to control music players from the Linux command-line

How to control music players from the Linux command-line

Do you listen to music while working in the Linux terminal? Do you find it annoying to have to exit the terminal, even for a minute, to skip a song, pause something, or stop music playback altogether? If so, you’ll be interested to know that it is possible to control music players from the Linux command-line. Follow along as we go over two easy ways to use the Linux command-line to control music players!

Method 1 – PlayerCTL

PlayerCTL is a command-line application that, when used, can control music players from the command-line, as long as they support MPRIS (Media Player Remote Interfacing Specification).

Installing PlayerCTL

Sadly, PlayerCTL does not come pre-installed on any of the mainstream Linux distributions. So, before we show you how to use it to control your music player via the command-line, we must demonstrate how to install it. Luckily, PlayerCTL is a favorite in the Linux community, so getting it is not difficult.

To install the PlayerCTL application working on your Linux PC, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, follow the command-line instructions outlined below that corresponds with the distribution you use.

Ubuntu

To get PlayerCTL working on Ubuntu, use the following Apt command.

Note: PlayerCTL is only in the Ubuntu software repositories for version 19.10 and newer.

sudo apt install playerctl

Debian

On Debian, an older release of the PlayerCTL program can be installed from the “Main” software repository using the following apt-get command.

sudo apt-get install playerctl

Keep in mind that this version of PlayerCTL is only available to Debian 10 Buster and Debian Sid users. If you want to gain access to this app and are on Debian 9, you must first upgrade your operating system. To upgrade from Debian 9 to Debian 10, follow our guide on the subject. Also, be sure to consult the official documentation.

Arch Linux

On Arch Linux, you’ll be able to install the PlayerCTL program via the “Community” software repository. Be sure to edit your Pacman.conf file to include the “Community” software repository, or it will not be possible to install the app.

When “Community” is enabled on your system, use the following Pacman command down below to get PlayerCTL working on Arch Linux.

sudo pacman -S playerctl

Fedora

As of Fedora 30, PlayerCTL is available to all Fedora Linux users. To install the software on your system, use the following dnf install command.

sudo dnf install playerctl

OpenSUSE

As of OpenSUSE 15.1, it is possible to get the PlayerCTL app working. To start the installation, use the following zypper install command.

sudo zypper install playerctl

Can’t get PlayerCTL working on your release of OpenSUSE? You may be using an outdated version of LEAP. Be sure to upgrade from 15.0 to 15.1!

Generic Linux

The PlayerCTL application is available for installation for all Linux users via the source code on GitHub. If you are using a Linux operating system that does not have PlayerCTL readily available, click here to learn how to build it from scratch.

Using PlayerCTL to control music playback

PlayerCTL can pause, play, stop, go to the next song, and skip back to the previous song. Open up a terminal window and follow the command-examples below to learn how to use it to control music playback.

Note: do not run PlayerCTL as root with sudo! The commands will not work!

Pause

Need to pause a song that is currently playing? Make use of the playerctl pause command.

playerctl pause

Play

Trying to start up playback of a song again from the command-line? Use the playerctl play command.

playerctl play

Stop

Want to stop music playback altogether? Run the playerctl stop command.

playerctl stop

Next

Need to skip to the next song in your playlist? Execute playerctl next in the command-line.

playerctl next

Previous

Accidentally skip too many songs? Go back to the previous song with playerctl previous.

playerctl previous

Method 2 – Omnipause

Omnipause is another command-line application that can control music from the command-line. However, unlike PlayerCTL, it doesn’t work with any player that supports MPRIS. Instead, it works with D-Bus, which only some music apps support.

Installing Omnipause

Sadly, Omnipause is not nearly as popular as PlayerCTL, so the app isn’t present in any popular Linux distribution’s software repositories. Instead, you’ll need to download the source code from GitHub and compile it from scratch.

To start the installation of Omnipause, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, use the commands below to set up the Git app on your system.

Ubuntu

sudo apt install git

Debian

sudo apt-get install git

Arch Linux

sudo pacman -S git

Fedora

sudo dnf install git

OpenSUSE

sudo zypper install git

With the Git tool installed, use the git clone command to download the Omnipause source-code.

git clone https://github.com/mel00010/OmniPause.git

Move the terminal window into the “OmniPause” folder and install the program with sudo make install.

cd OmniPause sudo make install

Use Omnipause to control music playback

With Omnipause, you can pause music, start or resume it with play, stop playback with the stop command, go forward a song with next, and go back with previous. To learn how to control your favorite music player with Omnipause, follow the command-examples below.

Pause

To pause music playback with OmniPause, use the omnipause pause command.

omnipause pause

Play

Need to start playback or resume it? Use the omnipause play command in a terminal window.

omnipause play

Stop

Looking to stop music playback altogether? Run the omnipause stop command.

omnipause stop

Next

Want to go forward a song in the playlist? Execute the omnipause next command.

omnipause next

Previous

Need to go back a song in your playlist? Run omnipause previous

omnipause previous

About excitingtips

Check Also

How to play Steam games on Chrome OS with Linux Support

Do you have a Google Chromebook? Do you love video games? Want to play Steam …

Leave a Reply

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