This tutorial is about How to Play Music From the Linux Command Line. Recently I updated this tutorial and will try my best so that you understand this guide. I hope you guys like this blog, How to Play Music From the Linux Command Line. If your answer is yes after reading the article, please share this article with your friends and family to support us.
Table of contents
Check How to Play Music From the Linux Command Line
The terminal is typically used to perform administrative tasks on a Linux system, such as installing packages, configuring services, upgrading and updating packages, to name a few. But did you know that you can play your favorite audio files directly from the terminal? Yes, you can, thanks to some great and innovative console-based music players.
When you spend most of your time on the console screen reading texts, executing commands, and busy, what could be more refreshing than listening to your favorite music? Besides refreshing, there are other situations where you want to play music directly from the command line.
How to play music from the Linux command line
Install MPD and NCMPCPP
- Both programs are available in the repositories of most distributions. If you’re on Ubuntu, they’re definitely there. Install them with apt.
- sudo apt install mpd ncmpcpp
- Default MPD configuration can be found in “/etc/mpd.conf”. You can create settings per user, but assuming it’s a computer you just own, you don’t really need to. Just edit the file in your favorite editor with sudo.
- When you open the configuration file for the first time, you might feel intimidated. There are a ton of options there and even more documentation. That’s really a good thing. You can use the file itself as a reference. Still, there really aren’t that many lines you need to edit to get the MPD service to work the way you need it to.
- First, look for the music_directory option. That is the directory where MPD will look for your music library. Set the option equal to the directory where your music is.
- music_directory “/home/user/Music”
- Then do the same for the playlist directory. This is where MPD (and NCMPCPP) will store and fetch playlists.
- playlist_directory “/home/user/Music/playlists”
- There are some options to change in the next section. First, look for the user and group options. The defaults here are really good. If you want to change them, you can.
- user “mpd”
- #group “ungroup”
- The next bit is about how you will connect to MPD. You want to uncomment the bind_to_address line that is set to a Unix socket and the port line. It should look like the following example.
- bind_to_address “/run/mpd/socket”
- port “6600”
- Depending on the client, MPD might start playing the moment the computer starts up. If you don’t want that, uncomment and set this line:
- You’ll also probably want MPD to automatically detect and add new music that is added to the music directory. To do so, uncomment the line here:
Final remarks: How to Play Music From the Linux Command Line
I hope you understand this article, How to Play Music From the Linux Command Line. If your answer is no, you can ask anything via the contact forum section related to this article. And if your answer is yes, please share this article with your friends and family to give us your support.