Directory listings become easier to scan when the entries that usually fall at the bottom need attention first. In Linux, ls -r reverses the active sort order, so a name-sorted view can show descending names and a time-sorted view can show the oldest entries first without changing files or directories.

The default ls order is name sorting under the current locale. Adding -1 prints one entry per line, while -r flips the order that ls would otherwise produce. That makes a before-and-after check easy in terminals, scripts, and handoff notes.

Reverse sorting only works when sorting is enabled. -U or --sort=none prints directory entries in storage order and leaves -r with nothing to reverse; use the default name sort or a specific sort key such as -t when the order must be predictable.

Steps to reverse file and folder listings in Linux:

  1. List the target directory in default name order.
    $ ls -1 /srv/reverse-demo
    alpha.txt
    archive
    logs
    zulu.txt

    -1 prints one entry per line so the ordering is easy to compare.

  2. Reverse the default name sort.
    $ ls -1r /srv/reverse-demo
    zulu.txt
    logs
    archive
    alpha.txt

    -r reverses the active sort key; with the default name sort, the entries appear in reverse alphabetical order.

  3. List entries by modification time when timestamp order matters.
    $ ls -lt --time-style=long-iso /srv/reverse-demo
    total 16
    -rw-r--r-- 1 root root   40 2026-04-14 09:03 zulu.txt
    drwxr-xr-x 2 root root 4096 2026-04-14 09:02 logs
    drwxr-xr-x 2 root root 4096 2026-04-14 09:01 archive
    -rw-r--r-- 1 root root    6 2026-04-14 09:00 alpha.txt

    -t sorts by modification time, newest first.

  4. Reverse the time sort to show the oldest entries first.
    $ ls -ltr --time-style=long-iso /srv/reverse-demo
    total 16
    -rw-r--r-- 1 root root    6 2026-04-14 09:00 alpha.txt
    drwxr-xr-x 2 root root 4096 2026-04-14 09:01 archive
    drwxr-xr-x 2 root root 4096 2026-04-14 09:02 logs
    -rw-r--r-- 1 root root   40 2026-04-14 09:03 zulu.txt

    -r flips the -t result, so the oldest modified entry appears first.

  5. Force bytewise name ordering when a script or comparison must produce the same order across hosts.
    $ LC_ALL=C ls -1r /srv/reverse-demo
    zulu.txt
    logs
    archive
    alpha.txt

    LC_ALL=C avoids language-specific collation differences for this command only.

  6. Skip unsorted mode when the output must be reversed.

    -U and --sort=none disable sorting, so -r has no effect. Keep sorting enabled with the default name order, -t, -S, -X, or another supported sort key before reversing the listing.