See cmus --help for more information.
CMus can be controlled via UNIX-socket using cmus-remote command. This is very useful feature because it allows you control CMus without having to switch to the desktop where CMus window is.
See cmus-remote --help for more information.
There are 6 views in cmus:
To switch between the views use keys '1' - '5'. Views 1-3 display current playlist. View 3 can be sorted (see sort option).
View 4 displays play queue. Tracks in the play queue are played first and removed from the queue immediately after playing starts. After last track from play queue has been played CMus starts playing tracks in the playlist.
View 5 allows you to browse filesystem, add tracks to playlist, enqueue tracks, delete files and even play tracks directly from the browser. You can also 'cd' into a playlist.
View 6 displays user defined Playlist Filters.
Key | Description |
---|---|
F1 | show help window |
z | skip back in playlist |
x | play |
c | pause |
v | stop |
b | skip forward in playlist |
C | toggle continue |
r | toggle repeat |
m | toggle playlist mode (all, artist, album) |
p | toggle play mode (tree (view 1), shuffle (view 2), sorted (view 3)) |
t | toggle time elapsed/remaining |
Q | quit |
: | enter command mode |
left, h | skip 5 seconds back in song |
right, l | skip 5 seconds forward in song |
1 | switch to artist/album/track tree view |
2 | switch to shuffle view |
3 | switch to sorted view |
4 | switch to play queue view |
5 | switch to directory browser view |
up, k | move up |
down, j | move down |
page up, ctrl-b | move page up |
page down, ctrl-f | move page down |
home, g | go to top of the window |
end, G | go to bottom of the window |
- | volume down |
+, = | volume up |
{ | left channel down |
} | right channel down |
[ | left channel up |
] | right channel up |
Key | Description |
---|---|
del, D | remove selected artist, album or track from playlist |
e | append selected artist, album or track to the play queue |
E | prepend selected artist, album or track to the play queue |
i | jump to current track |
u | remove non-existent files from playlist and update tags for changed files |
enter | play selected track |
space | show/hide albums for the selected artist |
tab | switch window in the artist+album/track view |
Key | Description |
---|---|
del, D | remove selected track from the queue |
Key | Description |
---|---|
del, D | remove selected file |
a | add file/directory to playlist |
e | append selected file/directory to the play queue without adding to playlist |
E | prepend selected file/directory to the play queue without adding to playlist |
i | toggle showing of hidden files |
enter | cd to selected directory/playlist or play selected file |
backspace | cd to parent directory |
Key | Description |
---|---|
del, D | remove selected filter |
space | select/unselect filter |
enter | apply selected filters |
Press ':' any time to enter command mode. The command mode works much like VIM's command mode. Tabulator expansion works for files/dirs, commands and options. There's command history too (up/down arrow keys). Press 'ESC' to leave command mode and return to Normal Mode.
You don't have to type whole command name if it is unambiguous. For example :a some-file.mp3.
Use the :set command to set options.
Command | Description |
---|---|
:add dir/file/playlist/url | Add dir/file/playlist/url to playlist. This command can be used to join playlists. |
:bind context key command | Define keybinding (See Keybindings). |
:cd [directory] | Change directory. Default directory is $HOME. |
:clear | Clear playlist. |
:enqueuedir/file/playlist/url | Add dir/file/playlist/url to the play queue. |
:filter [value] | Set temporary playlist filter. If no value is given filtering is disabled. |
:fset name=value | Add or replace filter |
:load filename | Clear playlist and then load a new one. Simple one track/line lists and .pls playlists are supported. |
:run command | Execute command for the currently selected files (See Running Programs). |
:save [filename] | Save playlist. Default filename is the last used one. |
:seek [+-]POS | Seek top POS (seconds). POS can be suffixed with 'm' (minutes) or 'h' (hours). |
:set OPTION=VALUE | Set option (See Options). |
:shuffle | Reshuffle playlist. |
:unbind context key | Remove keybinding. |
Option | Description |
---|---|
output_plugin | output plugin (alsa, arts, oss) |
buffer_seconds | size of player buffer in seconds (1-10) |
confirm_run | confirm :run with >1 files (true/false) |
dsp.*, mixer.* | output plugin options (use tab to cycle through all possible options) |
color_* | user interface colors (See User Interface Colors) |
format_current | format of the line showing currently played track |
format_playlist | format of text in views 2-4 |
format_title | format of terminal window title |
format_track_win | format of text in track window (view 1) |
altformat_* | format strings used when file has no tags |
sort | comma separated list of sort keys for the sorted view (3). Valid keys: artist, album, title, tracknumber, discnumber, date, genre, filename) |
status_display_program | script to run when player status changes (See Status Display) |
Character | Description |
---|---|
%a | artist |
%l | album |
%D | disc number |
%n | track number |
%t | title |
%g | genre |
%y | year |
%d | duration |
%f | path and filename |
%F | filename |
%= | start align right (use at most once) |
%% | literal '%' |
You can use printf style formatting (width, alignment, padding).
:set format_trackwin= %02n. %t (%y)%= %d :set format_current= %n. %-30t %40F (%y)%= %d
To see current value of an option type :set option=<TAB>.
Some MP3s encode tags using different character set than specified in the frame. In other words those MP3s are broken but because this is so common problem cmus has an option (mad.charset) to change character set used for those broken MP3s.
You need to edit ~/.config/cmus/config manually, this can't be set using :set command. Default value is ISO-8859-1.
mad.charset = "cp1251"
Note: If you change this option you need to remove ~/.cache/cmus/trackdb.* files because they contain tags encoded in the old character set.
Key | Description |
---|---|
/WORDS | search forward |
?WORDS | search backward |
//WORDS | search forward (see below) |
??WORDS | search backward (see below) |
/ | search forward for the latest used pattern |
? | search backward for the latest used pattern |
n | search next |
N | search previous |
WORDS is list of words separated by spaces. Search is case insensitive and works in every view.
In views 1-4 words are compared to artist, album and title tags. Use //WORDS and ??WORDS to search only artists/albums in view 1 or titles in views 2-4. If the file doesn't have tags words are compared to filename without path.
In view 5 words are compared to filename without path.
CMus supports Shoutcast/Icecast streams (Ogg and MP3). To add stream to playlist use :add command or cmus-remote.
:add http://example.com/path/to/stream
Add filters using :fset command, select filters with space and then apply selected filters by pressing enter. Only tracks matching the activated filters will be shown in the playlist (views 1-3). Filters do not change the actual playlist content, i.e. :save command will still save all tracks to playlist file whether they are visible or not.
Filter | Type | Description |
---|---|---|
filename | string | filename or URI |
artist | string | |
album | string | |
title | string | |
genre | string | music genre |
date | integer | year |
duration | integer | seconds |
stream | boolean | true if track is a stream |
tag | boolean | true if track has tags |
Strings are case insensitive. ? matches exactly one character and * zero or more characters. To match literal '?' or '*' you need to escape it with backslash ('\?' and '\*', to get literal backslash use '\\').
Integers are non-zero and -1 means the value is not set. For example date=-1 tests if date is not set.
Type | Comparators |
---|---|
boolean | none (filter name itself has value true or false) |
integer | <, <=, =, >=, >, != |
string | =, != |
Filters are separated with & (and) or | (or). Parenthesis can be used to group expressions and ! (not) inverts expression value.
Filter names are case sensitive and can contain only these characters: a-zA-Z0-9_-
Sometimes you may want to set temporary playlist filter which you only use once (you don't want to add it to the filter list). Use :filter to set temporary filter or disable filtering if no argument given.
:fset ogg=filename="*.ogg" # use the filter above, user defined filters are like booleans :fset ogg-rock=ogg&genre="*rock*" # not 80s music unless artist is Iron Maiden :fset foo=!(date>=1980&date<1990)|artist="iron maiden" # regular files, not streams :fset files=!stream # temporarily filter ogg files or streams # 'ogg' is user defined filter (see above) :filter ogg|stream # disable any filters :filter
You can execute external commands for the currently selected files by executing :run command. Playlist view (1, 2 or 3) must be active when running commands. In view 1 you can run any command for files of the selected track, album or artist. In views 2 and 3 command is executed for the only selected file, of course. CMus will ask confirmation if there are more than one selected files unless confirm_run is false.
{} in the command is replaced with the selected files. If the command doesn't contain {} the selected files are automatically appended to the command. /bin/sh compatible quoting are supported (single/double quotes and escaping with \).
Both stdout and stderr are redirected to /dev/null and stdin is closed so you can't run interactive text mode programs. GUI programs should work just fine.
These examples assume that view 1 is active and the selected album contains only files file1.ogg and file2.ogg.
# rm -f file1.ogg file2.ogg :run rm -f # tagger -uniq -date 2004 file1.ogg file2.ogg :run tagger -uniq -date 2004 # cp file1.ogg file2.ogg /tmp :run cp {} /tmp/
CMus can run external program which can be used to display player status on desktop background (using root-tail for example), panel etc.
For example if you use WMI you can write a script that displays currently playing file on the wmi statusbar using wmiremote command:
:set status_display_program=cmus-status-display
To disable status display set status_display_program to empty string.
#!/bin/bash # # cmus-status-display # # Usage: # in cmus command ":set status_display_program=cmus-status-display" # # This scripts is executed by cmus when status changes: # cmus-status-display key1 val1 key2 val2 ... # # All keys contain only chars a-z. Values are UTF-8 strings. # # Keys: status file url artist album discnumber tracknumber title date # - status (stopped, playing, paused) is always given # - file or url is given only if track is 'loaded' in cmus # - other keys/values are given only if they are available # output() { # write status to /tmp/cmus-status (not very useful though) echo "$*" >> /tmp/cmus-status 2>&1 # WMI (http://wmi.modprobe.de/) #wmiremote -t "$*" &> /dev/null } while [[ $# -ge 2 ]] do eval _$1=\"$2\" shift shift done if [[ -n $_file ]] then output "[$_status] $_artist - $_album - $_title ($_date)" elif [[ -n $_url ]] then output "[$_status] $_title" else output "[$_status]" fi
Change color_* options to customize colors.
Example:
:set color_statusline_bg=4
Tip: type :set color_<tab> to cycle through all color option variables.
Value | Color |
---|---|
-1 | default color. use this if you want transparency |
0 | black |
1 | red |
2 | green |
3 | brown (or yellow) |
4 | blue |
5 | magenta |
6 | cyan |
7 | gray |
8 | dark gray |
9 | bright red |
10 | bright green |
11 | bright yellow |
12 | bright blue |
13 | bright magenta |
14 | bright cyan |
15 | white |
16-255 | more colors, not supported by every terminal |
Note: On terminals supporting only 16 colors you can use colors 8-15 for foreground only.
Terminal Type | Number of Colors Supported |
---|---|
gnome-terminal | 16 |
rxvt-unicode | 88 |
xterm | 256 |
GNU Screen | as many as the terminal inside which screen is running |
Use :bind context key command to bind a key and :unbind context key to remove existing keybinding. Use tab to cycle through contexts, keys and functions.
Context | Description |
---|---|
browser | Directory browser |
common | All views |
filters | Filters view |
playlist | Views 1-3 |
play_queue | Play Queue |
Function | Description |
---|---|
help | |
next | |
pause | |
play | |
prev | |
quit | |
search_next | |
search_prev | |
seek_backward | |
seek_forward | |
stop | |
toggle_continue | |
toggle_play_mode | |
toggle_playlist_mode | |
toggle_remaining_time | |
toggle_repeat | |
view_1 | |
view_2 | |
view_3 | |
view_4 | |
view_5 | |
view_6 | |
vol_down | |
vol_left_down | |
vol_left_up | |
vol_right_down | |
vol_right_up | |
vol_up | |
win_activate_next | toggle active window in view 1 |
win_bottom | goto bottom |
win_down | scroll down one row |
win_page_down | scroll down one page |
win_page_up | scroll up one page |
win_top | goto top |
win_up | scroll up one row |
Function | Description |
---|---|
expand_artist | toggle showing albums for selected artist |
play_selected | play selected track |
queue_append | append to play queue |
queue_prepend | prepend to play queue |
remove | remove artist/album/track from play queue |
select_current | jump to currently playing file |
update | remove non-existent files from playlist and update tags for changed files |
Function | Description |
---|---|
remove | remove selected track from queue |
Function | Description |
---|---|
add | add selection to playlist |
cd_parent | cd .. |
enter | enter directory/playlist or play file |
queue_append | append to play queue |
queue_prepend | prepend to play queue |
reload | reload directory |
remove | remove selected file |
toggle_show_hidden | toggle showing hidden files |
Function | Description |
---|---|
activate | activate selected filters |
delete_filter | delete filter |
toggle_filter | select / deselect filter |
# make control-h toggle showing hidden files :bind browser ^H toggle_show_hidden # remove binding for F1 key (help by default) :unbind common F1
You can override location of these files by setting XDG_CONFIG_HOME and/or XDG_CACHE_HOME environment variables.
If you configured cmus with DEBUG=2 then debugging information will be written to /tmp/cmus-debug file. After a crash last lines of these files should contain useful information.
Run gdb cmus core and type backtrace to see at which line cmus crashed.
Timo Hirvonen <tihirvon AT gmail.com>