LinuxCommandLibrary

mpc

Control Music Player Daemon (MPD)

TLDR

Toggle play/pause

$ mpc toggle
copy

Stop playing
$ mpc stop
copy

Show information about the currently playing song
$ mpc status
copy

Play the next song
$ mpc next
copy

Play the previous song
$ mpc prev
copy

Seek n seconds forward (+) or backward (-)
$ mpc [+n|-n]
copy

SYNOPSIS

mpc [options] [command] [arguments...]

PARAMETERS

-h, --help
    Displays help message for mpc.

-v, --version
    Shows version information for mpc.

-q, --quiet
    Suppresses output from some mpc commands.

-f, --format <format>
    Specifies output format for 'current' and 'playlist' commands using MPD tag syntax.

--host <host>
    Connects to the specified MPD host (e.g., 'password@hostname').

--port <port>
    Connects to the specified MPD port (default 6600).

add <URI>
    Adds a URI or path to the current MPD playlist.

clear
    Clears the current MPD playlist.

current
    Shows the currently playing song's information.

next
    Plays the next song in the playlist.

pause
    Pauses playback of the current song.

play [<position>]
    Starts playback, optionally at a specific playlist position.

prev
    Plays the previous song in the playlist.

rm <position>
    Removes a song from the playlist by its position.

search <type> <query>
    Searches the MPD database for songs matching the query (e.g., 'artist The Beatles').

status
    Displays the current status of MPD (e.g., playback state, volume).

stop
    Stops playback.

toggle
    Toggles between play and pause states.

update [<path>]
    Updates the MPD music database, optionally for a specific path.

volume <+/-value>
    Adjusts the master volume (e.g., '+5', '-10', '75').

playlist
    Displays the content of the current MPD playlist.

random <on|off>
    Enables or disables random playback mode.

repeat <on|off>
    Enables or disables repeat playback mode.

shuffle
    Shuffles the current MPD playlist.

DESCRIPTION

mpc (Music Player Command) is a lightweight, intuitive command-line client for interacting with the Music Player Daemon (MPD). It allows users to control an MPD instance, managing music playback, playlists, and daemon settings directly from the terminal. mpc can play, pause, stop, skip tracks, add and remove songs from the playlist, search the music database, adjust volume, and configure various MPD playback options like repeat, random, and crossfade. It's an essential tool for users who prefer a minimalist interface or want to script MPD control. Its simplicity and robust functionality make it a popular choice for remote MPD control or integration into shell scripts.

CAVEATS

Requires a running Music Player Daemon (MPD) instance to connect to.
By default, mpc attempts to connect to localhost:6600.
Environment variables MPD_HOST and MPD_PORT can override default connection settings.
Password-protected MPD instances require the password either in MPD_HOST or with the --host option.

ENVIRONMENT VARIABLES

mpc can use the following environment variables to configure its connection to MPD:
MPD_HOST: Specifies the hostname or IP address of the MPD server. Can include a password (e.g., 'password@host').
MPD_PORT: Specifies the port number of the MPD server (default is 6600).
These variables provide a convenient way to configure mpc without specifying host/port for every command.

HISTORY

mpc has been an integral part of the MPD ecosystem since its early days, providing a simple yet powerful command-line interface. It has evolved alongside MPD, maintaining its role as the de facto official client for basic command-line control and scripting, reflecting MPD's philosophy of daemon-based music playback.

SEE ALSO

mpd(1), ncmpcpp(1), m3u(5)

Copied to clipboard