Linux CLI Terminal: Free Memory & Free Disk Space

How to Check Free Memory Space on Linux

========

How to Check Free Memory Space on Linux [Terminal]

==================================

Method 1: Using meminfo

cat /proc/meminfo

grep MemTotal /proc/meminfo

=================
=================

Method 2: Using free, top and Other Commands
1
Typing free in your command terminal provides the following result:
free
2
Use:
top
htop
3
Provides general information about processes, memory, paging, block IO, traps, and CPU activity.
vmstat

=================

How to Check Free Disk Space on Linux

========

How to Check Free Disk Space on Linux [Terminal]

==================================

Method 1: Using df 
The df command stands for disk-free and quite obviously, it shows you the free and available disk space on Linux systems.
1
With -h option, it shows the disk space in human-readable format (MB and GB).
df -h
2
View the disk usage with more details like filesystem type and blocks, you can use the command:
df -T
3
Shows the file system's complete disk usage even if the Available field is 0
df -a 

=================

Method 2: Using du, ls, and Other Commands
While df command is quite popular and should be enough for the use case, there are other alternatives that you can try including:

du -h → Shows disk usage in human-readable format for all directories and subdirectories.
du -a →Shows disk usage for all files.
du -s Provides the total disk space used by a particular file or directory.
ls -al →Lists the entire contents, along with their size, of a particular directory.
stat <file/directory> →Displays the size and other stats of a file/directory or a file system.
fdisk -l →Shows disk size along with disk partitioning information (may require sudo privileges).
dust  → An interesting alternative to the du command written in Rust, available for Arch Linux in the repositories. For other Linux distros, you can refer to its GitHub releases section.

=================