Recursively listing a directory tree exposes every nested file and folder below a starting path, which is useful when checking application content, auditing backup scope, or confirming what exists before cleanup work. A full recursive view is also the quickest way to spot hidden files that would be missed by a shallow directory listing.
In Linux, find is the most reliable built-in tool for this job because it walks the directory tree directly and can print every path, only files, only directories, or cleaned-up relative names from the same command flow. Unlike ls -R, it also includes hidden entries such as dotfiles without needing a separate display mode.
Recursive listings can become noisy on large trees or when the starting path includes protected directories, mounted volumes, or network storage. Start from the narrowest useful directory, add -maxdepth when only the first few levels matter, and add -xdev when a scan from a mount root such as / or /var should stay on one filesystem.
$ find /srv/recursive-demo /srv/recursive-demo /srv/recursive-demo/logs /srv/recursive-demo/logs/app.log /srv/recursive-demo/logs/app.log.1 /srv/recursive-demo/README.md /srv/recursive-demo/.hidden-root /srv/recursive-demo/docs /srv/recursive-demo/docs/notes-2025.txt /srv/recursive-demo/docs/archive /srv/recursive-demo/docs/archive/notes-2024.txt /srv/recursive-demo/config /srv/recursive-demo/config/app.conf /srv/recursive-demo/config/.env
find walks the tree directly, so hidden entries such as /srv/recursive-demo/.hidden-root and /srv/recursive-demo/config/.env appear without an extra flag.
$ find /srv/recursive-demo -mindepth 1 -printf '%P\n' | sort .hidden-root README.md config config/.env config/app.conf docs docs/archive docs/archive/notes-2024.txt docs/notes-2025.txt logs logs/app.log logs/app.log.1
-mindepth 1 omits the root path itself, and %P removes the starting-path prefix from each printed entry.
$ find /srv/recursive-demo -type f -printf '%P\n' | sort .hidden-root README.md config/.env config/app.conf docs/archive/notes-2024.txt docs/notes-2025.txt logs/app.log logs/app.log.1
-type f excludes directories, symlinks, device nodes, and other non-regular entries.
$ find /srv/recursive-demo -mindepth 1 -type d -printf '%P\n' | sort config docs docs/archive logs
Keeping -mindepth 1 in the directory-only view removes the starting directory from the result set.
$ find /srv/recursive-demo -maxdepth 2 -mindepth 1 -printf '%P\n' | sort .hidden-root README.md config config/.env config/app.conf docs docs/archive docs/notes-2025.txt logs logs/app.log logs/app.log.1
-maxdepth 2 keeps the listing from descending into docs/archive/notes-2024.txt because that file sits one level deeper than the limit.
$ find /srv/recursive-demo -ls 2905320 4 drwxr-xr-x 5 root root 4096 Apr 14 01:23 /srv/recursive-demo 2905324 4 drwxr-xr-x 2 root root 4096 Apr 14 01:23 /srv/recursive-demo/logs 2905328 4 -rw-r--r-- 1 root root 7 Apr 14 01:23 /srv/recursive-demo/logs/app.log 2905327 4 -rw-r--r-- 1 root root 8 Apr 14 01:23 /srv/recursive-demo/logs/app.log.1 2905331 4 -rw-r--r-- 1 root root 6 Apr 14 01:23 /srv/recursive-demo/README.md ##### snipped #####
Use -ls for a human-readable audit, and use -print0 instead of newline output when the result will be passed to another command that must handle unusual file names safely.