🐧 Linux / Shell Scripting
Beginner
How do you check memory usage in Linux?
Answer
Use free -h to display RAM and swap usage in human-readable format. The output shows total, used, free, shared, buff/cache, and available memory. Available (not Free) is the realistic amount usable by new processes since Linux aggressively uses RAM for caching. cat /proc/meminfo shows detailed memory statistics. vmstat -s gives a summary. top and htop show per-process memory usage in real time. For a single number: free -m | awk '/^Mem/ {print $3}' gives used MB.