memory-check
Check system memory usage, available memory, and identify cleanup opportunities. Use this skill when the user asks to check memory, RAM usage, free memory, or needs to clean up system resources.
When & Why to Use This Skill
The Memory Check skill is a specialized diagnostic tool for Linux-based systems designed to monitor RAM usage, swap space, and overall resource health. It provides real-time insights into system performance by analyzing memory allocation, identifying high-consumption processes, and offering actionable cleanup recommendations to optimize system speed and stability.
Use Cases
- System Performance Troubleshooting: Quickly diagnose why a Linux server or desktop is running slowly by analyzing real-time RAM usage and swap pressure.
- Resource Optimization: Identify the top 10 memory-consuming processes to determine which applications are hogging resources and may need to be restarted or closed.
- Server Health Auditing: Monitor available memory and disk space on remote servers or Raspberry Pi devices to ensure critical services have sufficient overhead to operate.
- Guided System Maintenance: Safely identify opportunities to clear system caches or reclaim memory when usage exceeds critical thresholds (e.g., >80%).
| name | memory-check |
|---|---|
| description | Check system memory usage, available memory, and identify cleanup opportunities. Use this skill when the user asks to check memory, RAM usage, free memory, or needs to clean up system resources. |
Memory Check Skill
This skill helps you check system memory usage and identify cleanup opportunities on Linux systems.
Instructions
When activated, follow these steps to provide comprehensive memory information:
1. Check Overall Memory Usage
Run the free command to show memory and swap usage:
free -h
This shows:
- Total memory available
- Used memory
- Free memory
- Shared memory
- Buffer/cache memory
- Available memory (what can actually be used)
- Swap usage
2. Check Detailed Memory Information
For more detailed breakdown:
cat /proc/meminfo | head -20
This provides:
- MemTotal: Total usable RAM
- MemFree: Free RAM
- MemAvailable: Available RAM for new applications
- Buffers: Memory used for file buffers
- Cached: Memory used for caching
3. Check Top Memory-Consuming Processes
Show the top 10 processes consuming the most memory:
ps aux --sort=-%mem | head -11
This helps identify which processes are using the most memory and might be candidates for cleanup.
4. Check Disk Space (Related Cleanup)
Since memory cleanup often goes hand-in-hand with disk cleanup:
df -h
5. Optional: Check System Cache
To see how much memory is used by caches:
sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
Warning: Only suggest running this if the user explicitly wants to clear caches, as it requires sudo and will clear page cache, dentries, and inodes.
Presenting Results
After running the commands, present the information in a clear format:
- Memory Summary: Show total, used, free, and available memory
- Memory Percentage: Calculate and show memory usage percentage
- Top Memory Users: List the top processes consuming memory
- Cleanup Recommendations: Based on the results, suggest:
- If memory usage is high (>80%), recommend closing unnecessary applications
- If swap is being heavily used, recommend adding more RAM or reducing memory load
- Identify specific processes that are using excessive memory
- Suggest disk cleanup if disk space is also low
Examples
Example 1: Basic Memory Check
User: "Check my memory usage"
Response: Run the commands and present:
- Total memory: 8GB
- Used: 6.2GB (77%)
- Available: 1.8GB
- Top processes: Chrome (2.1GB), Firefox (1.5GB)
- Recommendation: Memory usage is moderate. Consider closing unused browser tabs.
Example 2: Memory Cleanup Needed
User: "My system is slow, check if I need to clean up memory"
Response: Run all commands and present:
- Memory usage: 95%
- Swap usage: 80%
- Top processes identified
- Recommendations for closing specific high-memory processes
- Suggestion to restart memory-heavy applications
Notes
- These commands work on Linux systems (including Raspberry Pi OS)
- Some cleanup commands may require sudo privileges
- Always explain what each command does before running it
- Be careful with cache-clearing commands as they require sudo