Hosting Operations
Read-onlyCheck Bytes and Inodes Before Cleanup
A host is failing writes and you need to know whether byte usage or inode usage is the tighter limit before deleting anything.
Command
df -h /var && df -ih /var
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not treat df output as a cleanup plan; it only identifies the pressured filesystem.
Expected output
Two filesystem tables: one for byte usage and one for inode usage.
System impact
Read-only. Nothing changes. The command prints filesystem byte and inode summaries.
May require elevated permissions on protected paths or service-owned files.
Recovery / rollback: no state is changed.
When to use it
Use at the start of disk incidents before deciding whether to hunt large files or huge counts of small files.
When not to use it
Do not treat df output as a cleanup plan; it only identifies the pressured filesystem.
next steps
Related commands
Check Inodes When Disk Space Looks Fine
Sometimes the disk has free bytes but still cannot create files.
df -ih
Rank Old Cleanup Candidates by Size
The oldest file is not always the file that buys back meaningful space.
find /var -xdev -type f -mtime +7 -printf '%s %TY-%Tm-%Td %p\n' 2>/dev/null | sort -nr | head
Find Directories Burning Inodes
Inode cleanup starts by finding the directory with too many files.
find /var/cache -xdev -type f -printf '%h\n' 2>/dev/null | sort | uniq -c | sort -nr | head
Preview Old Temp Files Before Deleting
The safe version of cleanup is a candidate list first.
find /var/tmp/uploads -xdev -type f -mtime +7 -printf '%TY-%Tm-%Td %10s %p\n' 2>/dev/null | sort
Summarize Cache File Ages
Cache cleanup is safer when you know whether files are stale or still active.
find /var/cache -xdev -type f -printf '%TY-%Tm-%Td\n' 2>/dev/null | sort | uniq -c
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.