📁 File Management

Disk Usage Analyzer

Analyze disk usage to find space-hogging files and folders

★☆☆ Beginner 5-10 min January 12, 2025

Overview

Running out of disk space is a common problem. Claude can help you quickly analyze which files and folders are taking up the most space, identify content that can be safely deleted, and efficiently free up disk space.

Use Cases

  • Disk space running critically low, need quick cleanup
  • Find folders consuming the most space
  • Clean up caches and temporary files
  • Regular maintenance to keep disk healthy

Steps

Step 1: View Overall Disk Usage

First, understand the overall disk usage situation.

Please show my disk usage:
- Total capacity, used, and available space
- Usage percentage
- If there are multiple partitions, show each separately

Step 2: Analyze Directory Space Usage

Find folders taking up the most space.

Please analyze space usage in ~/ home directory:
- List the top 20 folders by space usage
- Show sizes in human-readable format (GB, MB)
- Sort in descending order by size
- Calculate what percentage of total space each folder occupies

Step 3: Identify Large Files

Find individual large files.

Find all files larger than 100MB in ~/ directory:
- Show file path, size, and last modification time
- Sort by size
- Identify file types (video, archives, disk images, etc.)
- Mark which might be temporary files or caches

Step 4: Cleanup Recommendations

Provide cleanup recommendations based on the analysis results.

Based on the above analysis, please provide cleanup recommendations:
- System caches that can be safely deleted
- Duplicate or outdated download files
- Unused applications
- Oversized log files
- For each recommendation, state how much space can be freed
- Mark risk level (safe/caution/dangerous)

Step 5: Execute Cleanup

Execute safe cleanup operations.

Please help me clean up the following:
1. Caches in ~/Library/Caches older than 30 days
2. Files in ~/Downloads older than 90 days
3. System log files (keep last 7 days)
4. Xcode derived data (if I confirm it's not needed)
List what will be deleted before cleaning, wait for my confirmation

Warning: Always confirm before deleting files! Some system files or caches may affect application performance if deleted. It's recommended to only clean content you're certain can be safely deleted.

Tip: Running space analysis regularly (like once a month) can prevent running out of space. You can have Claude create a quick report script showing space usage trends.

Common Questions

Q: Which folders typically take up the most space? A: Common space hogs include: ~/Library/Caches (app caches), ~/Downloads, photo libraries, node_modules, Xcode derived data, Docker images, etc.

Q: Can I recover files after cleanup? A: Cache files will be automatically rebuilt by applications after deletion, but downloads, documents, etc. cannot be recovered once deleted (unless in the Trash). It's recommended to move important files to a temporary folder first rather than deleting directly.

Q: How do I clean up Time Machine local snapshots? A: macOS automatically manages local snapshots. When space is tight, the system will automatically delete old snapshots. You can also use the tmutil command to manage manually.