fatsort(1)

fatsort1

Fat file system sorting utility

Usage

fatsort [OPTIONS] DEVICE

Overview

FATSort sorts the directory structure of FAT file systems, including FAT12, FAT16, FAT32, and exFAT.

Sort options:

-a

Use ASCII order for sorting.

-c

Ignore case of file names (default for most locales).

-I PFX

Ignore the prefix PFX when comparing file names.

-n

Use natural order sorting.

-o FLAG Set the sort order of files, where FLAG is one of:

d : directories first (default)

f : files first

a : do not distinguish between files and directories

-r

Sort in reverse order.

-R

Sort in random order.

This option overrides all other sort options.

-t

Sort by last modification date and time.

The following options can be specified multiple times to control which directories are sorted:

-d DIR

Sort the specified directory DIR only.

-D DIR

Sort DIR and all its subdirectories.

-x DIR

Exclude DIR from sorting.

-X DIR

Exclude DIR and all its subdirectories from sorting.

The following options can be specified multiple times to select directories using POSIX.2 extended regular expressions:

-e RE

Only sort directories matching regular expression RE.

-E RE

Don't sort directories matching regular expression RE.

Note: Options -e and -E cannot be used together with -d, -D, -x and -X.

-L LOC

Use the specified locale LOC instead of the system locale. FATSort follows locale-specific rules when sorting file names and directories.

More options:

-l

List the current file order only.

-i

Display file system information only.

-f

Force sorting even if the file system is mounted.

-h, --help

Display this help message.

-v, --version

Show version information.

-q

Suppress all non-error output.

DEVICE must be a FAT12, FAT16, FAT32 or exFAT file system.

WARNING: THE FILE SYSTEM MUST BE CONSISTENT (I.E., FREE OF ERRORS) BEFORE RUNNING FATSORT. THERE IS A RISK OF FILE SYSTEM CORRUPTION. ALWAYS BACK UP YOUR DATA.

Environment

The environment variable LC_ALL determines the system locale used by FATSort.

Examples

fatsort /dev/sda

Sort /dev/sda.

fatsort -n /dev/sdb1

Sort /dev/sdb1 using natural order.

Releases

11 releases since Debian 4.0 (Etch); the text changed 8 times.

  1. 4.0
  2. 5.0
  3. 6.0
  4. 7–8
  5. 9–10
  6. 11
  7. 12
  8. 13
  9. Arch

-D since Debian 9 (Stretch); -E since Debian 11 (Bullseye); -I since Debian 9 (Stretch); -L since Debian 11 (Bullseye); -R since Debian 6.0 (Squeeze); -X since Debian 9 (Stretch); -a since Debian 9 (Stretch); -d since Debian 9 (Stretch); -e since Debian 11 (Bullseye); -f since Debian 6.0 (Squeeze); -n since Debian 6.0 (Squeeze); -r since Debian 6.0 (Squeeze); -t since Debian 9 (Stretch); -x since Debian 9 (Stretch).

-h until Debian 8 (Jessie); -o until Debian 10 (Buster); -v until Debian 8 (Jessie).

Author

Written by Boris Leidner.

Reporting bugs

Report bugs to <[email protected]>.

From fatsort 2:1.7.1.683-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.