Skip to main content
C* Music Player:

How to filter music in cmus permanently

Summary

Learn how to use permanent filters in cmus to manage your music collection efficiently. With fset and factivate you can create persistent filters. The article contains many permanent filter examples and use cases which you can adapt.

Introduction #

In cmus, filtering your music collection efficiently is essential for managing large libraries. While temporary filters (:filter) apply only for the current session, permanent filters persist across views and sessions using fset, factivate, and playlists.

This article explains how permanent filters work in cmus, how to create and apply them, and provides real-world examples for different use cases.

Where cmus gets filtering information from #

cmus uses metadata embedded in audio files to filter music. This metadata includes ID3 tags (commonly used in MP3 files), Vorbis comments (used in Ogg Vorbis files), and other format-specific tagging systems. The player extracts this information when you add files to your library.

Difference between temporary and permanent filters #

cmus provides two types of filters:

  1. Temporary filters
    Applied using :filter. These filters work only until you change views or restart cmus. There is a separate article on temporary filters in cmus.
  2. Permanent filters
    Defined using fset and activated with factivate. They remain active until manually removed.

Permanent filters are useful when you frequently need to filter your library in the same way, such as hiding certain file formats or isolating specific genres.

Playlists can also function as filters. Learn how to create a playlist in cmus.

How permanent filters work in cmus #

Permanent filters in cmus work by defining filter conditions with fset, applying them with factivate, and managing them in view 6 (Filters View). Filters can be based on metadata such as filename, duration, or genre.

Creating a permanent filter #

Use :fset to define a new filter. Example:

:fset flac=filename="*.flac"

This creates a filter called flac that displays only FLAC files.

Activating a filter #

Once defined, activate the filter with:

:factivate flac

To deactivate the filter, use:

:factivate !flac

Managing filters in view 6 #

  1. Press 6 to enter the Filters View.
  2. Navigate to a filter and press space to select it.
  3. Press enter to apply the selected filter.

Examples of permanent filter use cases #

Show only FLAC files #

:fset flac=filename="*.flac"
:factivate flac

Show only MP3 files #

:fset mp3=filename="*.mp3"
:factivate mp3

Show only songs longer than 5 minutes #

:fset long_tracks=duration>300
:factivate long_tracks

Hide all songs shorter than 2 minutes #

:fset hide_short=duration<120
:factivate hide_short

Show only a specific artist #

:fset artist_bowie=artist="David Bowie"
:factivate artist_bowie

Show only a specific album #

:fset album_blackstar=album="Blackstar"
:factivate album_blackstar

Show songs released after 2010 #

:fset modern_tracks=date>2010
:factivate modern_tracks

Show only lossless formats (FLAC and WAV) #

:fset lossless=filename="*.flac" | filename="*.wav"
:factivate lossless

Exclude a specific genre #

:fset no_jazz=!genre="Jazz"
:factivate no_jazz

Show only a custom playlist #

:load my_playlist

Combining filters #

Show only FLAC files longer than 5 minutes #

:fset flac_long=filename="*.flac" & duration>300
:factivate flac_long

Exclude short songs and a specific artist #

:fset exclude_short_bowie=duration>120 & !artist="David Bowie"
:factivate exclude_short_bowie

How to remove permanent filters #

To deactivate a currently applied filter, use:

:fdeactivate filter_name

For example, to deactivate the FLAC filter:

:fdeactivate flac

To completely remove a filter definition, use:

:fset -remove filter_name

For example, to remove the FLAC filter permanently:

:fset -remove flac

This will delete the filter from cmus so that it cannot be reactivated later.

FAQ's #

Most common questions and brief, easy-to-understand answers on the topic:

What is the difference between temporary and permanent filters in cmus?

Temporary filters in cmus are applied using :filter and reset when switching views, whereas permanent filters set with fset and factivate persist until manually changed.

How do I create a permanent filter in cmus?

Use the :fset command to define a filter and :factivate to apply it. Example: :fset flac=filename="*.flac" followed by :factivate flac.

Can I apply multiple filters at once in cmus?

Yes, you can combine filters using logical operators. Example: :fset flac_and_large=filename="*.flac" & duration>300 applies both conditions.

How do I disable a permanent filter in cmus?

You can deactivate a filter using :factivate !filter_name. For example, :factivate !flac removes the FLAC filter.

How do I use playlists as filters in cmus?

You can create a playlist and switch to view 6 to use it as a filter. Use :save my_playlist to save a selection and apply it later.

Further readings #

Sources and recommended, further resources on the topic:

Author

Jonas Jared Jacek • J15k

Jonas Jared Jacek (J15k)

Jonas works as project manager, web designer, and web developer since 2001. On top of that, he is a Linux system administrator with a broad interest in things related to programming, architecture, and design. See: https://www.j15k.com/

License

How to filter music in cmus permanently by Jonas Jared Jacek is licensed under CC BY-SA 4.0.

This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only. To give credit, provide a link back to the original source, the author, and the license e.g. like this:

<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://www.ditig.com/cmus-permanent-filters">How to filter music in cmus permanently</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://www.j15k.com/">Jonas Jared Jacek</a> is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="license noopener noreferrer">CC BY-SA 4.0</a>.</p>

For more information see the Ditig legal page.

All Topics

Random Quote

“Content precedes design. Design in the absence of content is not design, it's decoration.”

 Jeffery Zeldman American web designer, author, and advocate for web standardsTwitter, - IT quotes