Next: Group Maintenance, Previous: Listing Groups, Up: Group Buffer

### 2.12 Sorting Groups

The `C-c C-s` (`gnus-group-sort-groups`) command sorts the group buffer according to the function(s) given by the `gnus-group-sort-function` variable. Available sorting functions include:

`gnus-group-sort-by-alphabet`
  Sort the group names alphabetically. This is the default.
`gnus-group-sort-by-real-name`
  Sort the group alphabetically on the real (unprefixed) group names.
`gnus-group-sort-by-level`
  Sort by group level.
`gnus-group-sort-by-score`
  Sort by group score. See Group Score.
`gnus-group-sort-by-rank`
  Sort by group score and then the group level. The level and the score are, when taken together, the group's rank. See Group Score.
`gnus-group-sort-by-unread`
  Sort by number of unread articles.
`gnus-group-sort-by-method`
  Sort alphabetically on the select method.
`gnus-group-sort-by-server`
  Sort alphabetically on the Gnus server name.

`gnus-group-sort-function` can also be a list of sorting functions. In that case, the most significant sort key function must be the last one.

There are also a number of commands for sorting directly according to some sorting criteria:

`G S a`
  Sort the group buffer alphabetically by group name (`gnus-group-sort-groups-by-alphabet`).
`G S u`
  Sort the group buffer by the number of unread articles (`gnus-group-sort-groups-by-unread`).
`G S l`
  Sort the group buffer by group level (`gnus-group-sort-groups-by-level`).
`G S v`
  Sort the group buffer by group score (`gnus-group-sort-groups-by-score`). See Group Score.
`G S r`
  Sort the group buffer by group rank (`gnus-group-sort-groups-by-rank`). See Group Score.
`G S m`
  Sort the group buffer alphabetically by back end name
  (`gnus-group-sort-groups-by-method`).
`G S n`
  Sort the group buffer alphabetically by real (unprefixed) group name (`gnus-group-sort-groups-by-real-name`).

All the commands below obey the process/prefix convention (see Process/Prefix).

When given a symbolic prefix (see Symbolic Prefixes), all these commands will sort in reverse order.

You can also sort a subset of the groups:

`G P a`
  Sort the groups alphabetically by group name (`gnus-group-sort-selected-groups-by-alphabet`).
`G P u`
  Sort the groups by the number of unread articles (`gnus-group-sort-selected-groups-by-unread`).
`G P l`
  Sort the groups by group level (`gnus-group-sort-selected-groups-by-level`).
`G P v`
  Sort the groups by group score (`gnus-group-sort-selected-groups-by-score`). See Group Score.
`G P r`
  Sort the groups by group rank (`gnus-group-sort-selected-groups-by-rank`). See Group Score.
`G P m`
  Sort the groups alphabetically by back end name
  (`gnus-group-sort-selected-groups-by-method`).
`G P n`
  Sort the groups alphabetically by real (unprefixed) group name (`gnus-group-sort-selected-groups-by-real-name`).
`G P s`
  Sort the groups according to `gnus-group-sort-function`.

And finally, note that you can use `C-k` and `C-y` to manually move groups around.