You may ask a question yourself when you see this article. Is it possible to listen music in Linux terminal? Yes because nothing is impossible in Linux.
We have covered many popular GUI-based media players in our previous articles but we didn’t cover any CLI based media players as of now, so today we are going to cover about cmus, is one of the famous console-based media players among others (For CLI, very few applications is available in Linux).
cmus (C* MUsic Player) is a small, fast and powerful console music player for Unix-like operating systems. It supports many audio formats like Ogg Vorbis, MP3, FLAC, Opus, Musepack, WavPack, WAV, AAC, MP4, audio CD, and everything supported by ffmpeg (WMA, APE, MKA, TTA, SHN, …) and libmodplug.
I have found one major advantage in cmus, It can start and play music files without hang when you open huge number of files in one short (thousands plus files) but many times GUI players get freeze on this situation.
- Gapless playback
- ReplayGain support
- MP3 and Ogg streaming (SHOUTcast/Icecast)
- Play queue
- Optional playback resume on startup
- Powerful playlist filters / live filtering
- Easy to use directory browser
- Customizable colors
- Dynamic keybindings
- Vi / less style search mode
- CUE sheets support
- Excellent compilations handling
- Uses Unicode internally for all string handling
How to install Cmus in Linux
Cmus is available in the default repositories of most Linux distributions, so use package manager to install it.
Debian/Ubuntu systems, use APT-GET command or APT Command to install cmus music player.
$ sudo apt-get install cmus
RHEL/CentOS systems, enable RPM Fusion Repository and use YUM Command to install cmus music player.
$ sudo yum install cmus
Fedora systems, enable RPM Fusion Repository and use DNF Command to install cmus music player.
$ sudo dnf install cmus
Arch Linux system, use Pacman Command to install cmus music player since it’s available from distribution official repository.
$ sudo pacman -S cmus
openSUSE system, enable PackMan Repository and use Zypper Command to install cmus music player.
$ sudo zypper install cmus
How to launch Cmus
Once you have installed on the system, just fire the following command on terminal to launch the Cmus music player. When you first launch cmus, it will open to the album/artist view, which looks similar to below.
Adding music files
5 to switch to the file-browser view that allows you to add music from your system. Use
DOWN arrow keys to navigate to where you have audio files stored. To add music into cmus library, select a file or folder, and press
Enter key allows you to navigate to inside a directory or play a selected audio file. To go back use
Backspace key. When audio files are loaded into library, you will see the time duration in the bottom right. In my case, i have added totally five audio files and the total playing time is
Cmus automatically saves your settings and library when you quit.
How to play audio files
2 to view library. 1 for Simple library view, which shows only an audio tracks in alphabetical order.
2 for Detailed library view, which divided into two parts. Left side artist/albums are sorted in alphabetical order and Right side audio files are sorted in the same manner
Use the UP and DOWN arrow keys to select a track you’d like to hear, and press Enter to play it.
Managing the queue
Lets say you’re listening a song, and you want to select which song to play next, without interrupting the current track. Just select the song you want to hear next and press
e. The selected song will be added into queue and start play automatically when the current track is complete.
4 to view/edit the queue, Press
P to change the order of the tracks and Press
shift-D to remove a track from the queue.
How to create a playlist
Everyone has their own playlists, that contains best collections. Cmus allow users to create a playlists, press
3 to view playlists but make sure you have add some songs into that. Press
2 and select a song you want and press
y to add it to a playlist.
Once you have added the collections, now press
3 to view playlists. You should see something like this. Use
D keys to move and delete tracks from the playlist.
How to search tracks
2 to bring the simple library view, then press
/ and input the song which you want to search, finally hit
Enter to select the songs. Press
n to find the next match.
How to control Cmus
Cmus has lots of keys to control everything. Refer the below list for easy understanding.
Cmus Control Keys ----------------- a - To add music into cmus library c - Pause/Resume playback z - To play the previous track b - To play the next track - - To reduce the volume by 10% = - To increase the volume by 10% s - To enable shuffle e - To add songs in queue y - To add a track into playlists D - To delete tracks from the playlist. / - To search a songs n - To find the next match on search. < & > - To seek by one minute k & j - To move up and down p & P - To change the order of the tracks Enter - To play songs shift-D - To remove the track from the queue. UP & DOWN Keys - To move up and down Right & Left Keys - To seek by 10 seconds Cmus has 7 views, which are accessible via the number keys. ----------------------------------------------------------- 1 - Library view 2 - Sorted library view 3 - Playlist view 4 - Play Queue view 5 - Browser view 6 - Filters view 7 - Settings view
How to Customize & Quit
Cmus has some very cool settings you can tweak, like changing the way tracks are displayed, enabling replaygain support or changing the keybindings. Press
7 for a quick overview of the current keybindings and settings.
When you’re done, Just type
:q and press Enter to quit. This will save your settings, library, playlist and queue.
Visit man pages to know more about Cmus.
$ man cmus