Author image Doug MacEachern


Xmms - Interactive remote control shell for xmms


  perl -MXmms -e shell


Xmms::shell provides an alternative or companion interface to the xmms gui.

Feature summary:

Standard Play Controls

play, pause, stop, next, prev, eject

Standard Options

toggle repeat, toggle shuffle

Playlist Controls

clear, select, add file(s), add url(s), playlist load/save, sort (more options than the gui)

File Info

search, view and edit mp3 tags

Misc Controls

time change (and slider), volume change (and slider), balance change, window toggle

Shell Features
command history
command/file completion
file matching
title matching
emacs key bindings

Shell Command Summary

The complete list of shell commands is also available via the help command.


Add files to the current playlist, without clearing the current playlist. See also: play description of the special `-' character.


Alias a long command to one of your own definition, e.g.:

 xmms> alias cd play /cdrom
 xmms> cd

View or change the balance.


Clear the current playlist.


Display the current playlist track number, title, time, rate, frequency and mode.


Delete tracks from the playlist. (NOTE: at the time of this writing, the patches/xmms-playlist-delete.pat patch must be applied to xmms-0.9.1.) Example:

 xmms> delete 3

This command can also handle ranges, e.g. to play just your favorite tracks from and audio cd:

 xmms> play /cdrom
 xmms> delete 5, 7..10

Search for mp3 files by mp3 tag or file name. Root directory defaults to the last play command or greedy dig command.


 #"greedy" match against *.mp3 filename and all tag info
 xmms> dig ~/mp3 gabba|break

 xmms> track
 1 - Prodigy - Break'n'Enter [0:11/5:59 (3%)]
 2 - gabba (6:12)
 3 - gabba (4:47)
 4 - break_and_enter_95_live (5:58)
 5 - Prodigy - Diesel Power (Snake break - Mi (7:08)
 6 - The Prodigy - Acid Break (4:42)

 #match against mp3 `artist' tag only
 xmms> dig artist maxim|liam
 1 - Biohazard feat. Maxim Reality - Breathe [0:03/3:33 (1%)]
 2 - Liam Howlett (DJ mix) - Heavyweight Selection XL Mix (19:37)
 3 - Maxim - Dog Day (4:41)
 4 - Maxim - Factory Girl (2:33)

See also: play description of the special `-' character.


Just like pressing the eject button on the gui, pops up the load file window. However, if an audio cd is/was playing (and Audio::CD is installed), the cd tray will pop open. If an audio cd is not playing, but you want to open the tray, provided the cd argument:

 xmms> eject cd

Make environment variables available to the shell, e.g.:

 xmms> export PWD
 xmms> play $PWD/fav.mp3

 xmms> export MP3_HOME=/usr/local/mp3
 xmms> play $MP3_HOME/fav.mp3

 xmms> export CD="play /cdrom"
 xmms> $CD

The current playlist with be reduced to files matching the given pattern. If no files match, the playlist is not changed. Example:

 xmms> files ro(ck|ll) #reduces playlist to files containing `rock' and `roll'

To negate, use the ! prefix:

 xmms> files !fire    #removes files containing `fire' from the playlist

Print command summary.


This function adds a bit of functionality over the readline history. Mainly, ability to save and run history to and from files on disk. Example:

 xmms> play ~/mp3/favorites
 xmms> volume 40
 xmms> jtime 1 2:00
 xmms> jtime 2 0:45
 xmms> history >~/mp3/fav.hist #save current history
 xmms> history <~/mp3/fav.hist #read/run history from fav.hist

TAB completion on the special character `-' will recall the last directory from which a history script was read. See also: Xmms::SongChange.

If the file ~/.xmms/.perlrc exists, it will be automatically run as a history script when the shell is invoked, before the prompt loop. For example, my ~/.xmms/.perlrc file looks like so:

 volume 30

The clear subcommand can be used to clear the current history:

 xmms> history clear

This command will display information about the given track, where track is a number in the current playlist file. The sub-commands can be used to edit the mp3 tag of the track file. Example:

 xmms> info 2
 Size......... 4.9M
 Modified.....Thu May 20 16:29:43 1999
 Album........deleted from Jilted Generation
 Artist.......The Prodigy
 Title........We Eat Rhythm (Original Version)

 xmms> info 2 comment Great Tune
 comment set to `Great Tune'

 xmms> info 2 comment
 Comment......Great Tune

This command jumps to the last time set by the time command and defaults to 0:00. For example:

 xmms> dig file speedway #load files with the name `speedway'
 xmms> time 1:10         #jump 1:10 into the song
 ... time passes ...
 xmms> jtime             #jump back to 1:10

A two argument form of jtime can be used to set jump times for tracks without actually jumping to that time, until jtime is called in the no argument form. I like this for playing my favorite parts of songs, example:

 #set jump times for these three tracks
 xmms> jtime 3 0:30
 xmms> jtime 4 1:00
 xmms> jtime 6 2:11

See also, key bindings: M-\


This command is used to load a playlist file or to save the current playlist file to disk.


 xmms> list save ~/mp3/fav-tracks #save list
 playlist saved

 xmms> list ~/mp3/fav-tracks      #load list

To measure the size of a list:

 xmms> list size ~/mp3/slipknot.m3u
 slipknot_742617000027.mp3  560k
 slipknot_sic.mp3  3.1M
 Total: 40.2M

Mark the current output time for jtime.


Skip forward to next track in the playlist.


Pause the current track in the playlist.


With no arguments, this command is just the same as hitting the gui play button. When given an argument of a directory, file or file glob, the playlist will be set to these files. Example:

 xmms> play ~/mp3/prodigy/remixes/

 xmms> play ~/mp3/prodigy/live/*skylined*

TAB completion on the special character `-' will recall the last directory used with the add, play or dig command, this value is also saved to your ~/.xmms/config file, so it is always available. Example:

 xmms> play -<TAB>

completes to:

 xmms> play /home/dougm/mp3/prodigy/remixes/

Skip backward to previous track in the playlist.


Quit the xmms shell.


Toggle the repeat button.


This command will restore the xmms state to where it was just before the last quit command was run. That is, it will load the saved playlist and jump to the list position and output time where xmms was just before quitting. The playlist, position and output time are saved in ~/.xmms/config.


Toggle the shuffle button.


Sort the playlist various ways:


Sort by last file access time.


Sort by album mp3 tag.


Sort by artist mp3 tag.


Sort by artist mp3 tag.


Sort by file basename.


Sort by genre mp3 tag.


Sort by file size, from large to small.


Sort by file modification time, from new to old.


Sort by file modification time, from old to new.


Sort the list by order of your choice, e.g.:

 xmms> play /cdrom
 xmms> sort order 3, 10, 6..9, 1 

Tracks not specified in the new order are left out of the new playlist.


Sort by filename, including the path name.


Sort in random order.


Reverse the playlist order.


Sort by file size, from small to large.


Sort by title name.


Sort by tracknum mp3 tag.


Sort by year mp3 tag.


With no argument, this command will display the elapsed, total and remaining percentage time of the current track. When given a +N argument, it will jump the song forward N seconds. When given a -N argument, it will jump the song backward N seconds. +<TAB> and -<TAB> can be used a slider for moving forward and backward. Finally, a mm:ss argument will jump to that time in the song. Oh, and time <TAB> will complete to the form, which will jump to a random time in the song.


This function works just the same as the files function, but matches against playlist titles.


This function is used for interacting with the current playlist. With no arguments, it will print the entire list. When given a range argument, it will print the info for those tracks, for example:

 xmms> track 100..230

Given a number or title name, it will jump to that track in the playlist.


Add a url to the playlist for streaming. TAB completion on the special character `-' will recall the last url used with this command.

If Xmms::shell finds the $ENV{HOME}/.xmms/.perlurldb file when starting up, the urls in this file will be used for url tab completion.


View or change the volume. With no argument, this command displays the current volume percentage. With an argument, changes the volume to the given percentage. +<TAB> and -<TAB> can be used a slider for moving raising and lowering the volume. The up/down arrow keys are also bound to this slider.


This command is used to show or hide the xmms windows. If the shell is started and xmms is not already running, all windows will be hidden by default.

Key Bindings

Here is a list of some of the more useful key bindings. `C' is shorthand for the control key, `M' is shorthand for the meta key, which is normally the escape key.

C-a : move to beginning of the line
C-b : move backward one character
C-c : interrupt
C-d : delete next character
C-e : move to end of the line
C-f : more forward one character
C-h : delete previous character
TAB : complete
C-k : kill line
C-l : clear screen
C-n : next command in history list
C-p : previous command in history list
C-r : reverse search in history list
C-s : forward search in history list
C-t : transpose characters
C-u : discard line
C-y : yank line
M-< : beginning of history
M-> : end of history
M-b : move backward one word

The following key bindings are shortcuts specific to xmms:

up arrow : volume slide up
down arrow : volume slide down
M-= : next
M-- : prev
M-. : stop
M-/ : play
M-\ : jtime
M-m : mtime
M-, : pause
M-~ : shuffle
M-@ : repeat
M-` : run previous command in history list
M-1 : play track 1 in the playlist
M-2 : play track 2 in the playlist (and so on to #9)

The nice part about these key bindings is the single-keystoke-ness and that they are not added to the command history, leaving just the more complex commands in your history buffer.

Effective use of these bounds keys can actually make up a half-assed sampler too.

The following key bindings will toggle the xmms windows:

M-a : all windows
M-w : main window
M-l : playlist window
M-q : equalizer window

Command Aliases

A command abbreviation table is built at startup to provide the following command aliases:

   a     => add
   b     => balance
   ch    => change
   cl    => clear
   cr    => crop
   cu    => current
   de    => delete
   di    => dig
   e     => eject
   f     => files
   he    => help
   hi    => history
   i     => info
   j     => jtime
   l     => list
   m     => mtime
   n     => next
   pa    => pause
   pl    => play
   pr    => prev
   q     => quit
   rep   => repeat
   res   => resume
   sh    => shuffle
   so    => sort
   st    => stop
   tim   => time
   tit   => titles
   tr    => track
   u     => url
   v     => volume
   w     => window


xmms(1), Xmms::SongChange(3), Xmms::Remote(3), Xmms::Config(3), MPEG::MP3Info(3)


Doug MacEachern