Find What’s Filling Your Linux Disk Without Deleting Files
Start with your home directory and use df, du, and sort to find large files and folders without deleting anything.
A low-disk warning does not tell you which files need attention. Before removing anything, check how full the filesystem is, then narrow the search to a directory you recognize.
This walkthrough starts in your home directory. It uses read-only commands and does not delete files, change permissions, or require administrator access. It is a first pass through your own files, not a complete audit of the machine.
Before you start
You need a GNU/Linux terminal with Bash and the GNU versions of df, du, and sort. These examples were tested with GNU coreutils 9.7 and Bash 5.2.37 on Linux x86_64. The options are not a promise of compatibility with macOS, BSD, or BusyBox tools.
A large home directory can take time to scan. Network-backed homes can also generate substantial I/O. Starting in your home directory limits the target, but it does not make the scan cheap. You can press Ctrl+C to stop it without deleting anything.
1. Check the filesystem containing your home directory
df -h -- "$HOME"
$HOME expands to your home directory. Keep the quotes so paths containing spaces remain one argument. The -- marks the end of command options.
Read the Avail and Use% columns. df reports space for the filesystem containing that path, not just your personal files. If your home has its own filesystem, this does not check the root filesystem. The -h option uses readable units such as M and G.
In the isolated test environment, this command reported a 32G filesystem with 28G available. Those figures described the test filesystem, not the size of the sample home directory. Your output will be different.
2. Compare the directories inside your home
du -h -x --max-depth=1 -- "$HOME" | sort -h
du estimates allocated disk space for the files it can examine, rather than their apparent file lengths. This command displays a total for each immediate subdirectory and a total for your home directory. sort -h sorts the readable sizes, with the largest rows at the bottom.
-xtellsduto skip directories on different filesystems. It does not exclude every mount point; same-filesystem bind mounts are not covered by that boundary.--max-depth=1limits which directory totals are printed. It does not limit how deeplyduscans to calculate them.- Hidden directories, such as
.cache, are included because the command targets the directory itself rather than a wildcard.
The last row is usually the home-directory total. Do not add it to the child rows: it already includes their usage. In testing, .cache and Downloads each showed 3.1M, while the whole sample home showed 11M.
Look for a large directory you recognize. A large cache, backup folder, or download directory is a reason to investigate, not permission to delete it.
3. Look inside one large directory
If Downloads exists and is worth checking, run:
du -a -h -x --max-depth=1 -- "$HOME/Downloads" | sort -h
Otherwise, replace Downloads with a directory name from your results. Keep the quoted path.
The added -a displays files as well as directories. In the test fixture, this showed a 2.0M file named project archive.bin, a 1.1M nested directory, and the 3.1M Downloads total. The filename with a space stayed intact.
If a nested directory is the large item, repeat the same command with that directory's path. Check one branch at a time. Remember that each directory row includes its contents, so parent and child rows are not separate amounts to add together.
4. Check files stored directly in your home directory
If the home total seems much larger than its listed subdirectories, add -a to the home scan:
du -a -h -x --max-depth=1 -- "$HOME" | sort -h
The initial directory-only view counted immediate files in the home total without listing them separately. This version exposed a 4.0M top-level file and a hidden 128K file in testing.
Read the results carefully
Watch for errors. A permission error means the affected directory was not fully examined. Do not hide those messages or add sudo just to silence them. A missing-directory error usually means you need to select a different path.
In both error tests, du failed while sort succeeded. The pipeline still returned a success status. A returned prompt, or a script reporting success for the pipeline, is not proof of a complete scan.
Do not expect df and du to match. One reports filesystem usage; this walkthrough measures only your selected directory tree. A small home directory does not explain a full filesystem by itself. Files outside your home are outside this check.
GNU du does not follow symbolic links by default. If your selected path is a link, choose the actual directory instead. These line-oriented reports are for human inspection, not reliable parsing of arbitrary filenames or input to a deletion command.
Testing and cleanup
The four commands were tested as an unprivileged user against an isolated sample home directory. Checks covered hidden entries, spaced filenames, directory totals, permission errors, and missing paths. File contents, paths, sizes, permissions, and modification times were unchanged; access times were not checked.
Actual mount boundaries, bind mounts, network filesystems, and production systems were not tested. The -x behavior above follows GNU documentation; it is not a security isolation guarantee.
There is nothing to roll back or clean up after these commands. A successful pass gives you paths and sizes worth reviewing, with no scan errors left unresolved. Decide separately whether they are needed and backed up before making changes.
Comments ()