LinuxCommandLibrary

moc

Play audio files from a terminal interface

SYNOPSIS

mocp [OPTIONS] [FILE|DIR]

PARAMETERS

-S, --start-server
    Starts the MOC server daemon if it's not already running.

-s, --stop-server
    Shuts down the MOC server daemon gracefully.

-x, --exit
    Exits the MOC client interface, leaving the server running.

-p, --play
    Starts playing music from the current position in the playlist.

-f, --next
    Skips to the next track in the current playlist.

-r, --previous
    Plays the previous track in the playlist.

-t, --toggle-pause
    Toggles between playing and pausing the current track.

-k, --seek TIME
    Seeks within the current track. TIME can be +N, -N (seconds), or N%.

-v, --volume LEVEL
    Sets the volume. LEVEL can be +N, -N (percentage change), or N (absolute percentage).

-M, --mute
    Toggles mute/unmute for the audio output.

-c, --clear
    Clears all entries from the current playlist.

-a, --append [FILE|DIR]
    Appends specified files or directories to the playlist.

-q, --enqueue [FILE|DIR]
    Adds specified files or directories to the end of the playlist.

-P, --playlist FILE
    Loads a specified playlist file (.m3u, .pls).

-h, --help
    Displays the help message with available options.

DESCRIPTION

MOC (Music On Console) is a powerful and lightweight ncurses-based console audio player for Unix-like systems. It features a simple two-panel interface, typically showing a file browser on one side and a playlist on the other. MOC supports a wide array of audio formats including Ogg Vorbis, FLAC, MP3, WAV, and can also play streams. Its distinctive feature is its client-server architecture: the actual player is a daemon (mocd) that runs in the background, while the user interacts with a client (mocp). This design allows music to continue playing even after the terminal is closed, and enables multiple clients to control the same server instance. MOC is renowned for its low resource consumption, clean interface, and stability, making it a favorite among command-line enthusiasts.

CAVEATS

MOC primarily operates through its daemon (mocd). If the daemon is not running, the client (mocp) will attempt to start it by default for most operations, but direct control requires the daemon to be active. Being a terminal-based player, it lacks a graphical user interface (GUI) and relies on ncurses for its interactive mode. Audio backend support depends on system configuration (e.g., ALSA, PulseAudio).

CLIENT-SERVER ARCHITECTURE

MOC's core design involves two components:
1. mocd: The MOC daemon, which runs in the background and handles all audio playback.
2. mocp: The MOC client, which is the user interface for controlling the daemon. This separation ensures continuous playback and allows for remote control and background operation.

CONFIGURATION AND KEYBINDINGS

MOC is highly customizable through its configuration files located in ~/.moc/. The main configuration file is ~/.moc/config, where users can adjust various settings like audio output, themes, and behavior. Keybindings can be modified in ~/.moc/keymap, allowing users to personalize keyboard shortcuts for player control.

HISTORY

MOC was first released in 2004 by Damian Pietras. Its development was driven by the desire for a minimalist, resource-efficient, and robust console audio player. The introduction of its client-server architecture, separating the player daemon (mocd) from the interactive client (mocp), was a significant innovation. This design allowed users to close their terminal window without stopping music playback, and facilitated remote control. MOC quickly became a popular choice among Linux users who favored command-line tools, establishing itself as a reliable and stable audio player in the terminal environment. While development pace has varied, it remains a well-regarded tool.

SEE ALSO

cmus(1), mpv(1), ncmpcpp(1), mplayer(1)

Copied to clipboard