Memory Management

free

The free command is a built-in Linux command that is used to display the amount of free and used memory in the system.

free -b   // Displays memory information in bytes
free -k   //Displays memory information in kilobytes (default)
free -m   //Displays memory information in megabytes
free -g   //Displays memory information in gigabytes
free -h   //Displays memory information in a human-readable

df

df" command is a Linux/Unix command that stands for "disk free". It is used to show the amount of free and used disk space on a file system.

df -h   //display the disk space information in a format that is easier to read for humans.4

du

The "du" command in Linux stands for "disk usage". It is used to estimate the file space usage of a directory or file(s). When you run the "du" command without any arguments, it will display the disk space usage of the current directory and its subdirectories

du -h | sort -hr //This will display the disk space usage information in a human-readable format and sort it by size with the largest files or directories at the top.

cat /proc/meminfo

"cat /proc/meminfo" command in Linux is used to display information about the system's memory usage

$ cat /proc/meminfo

/* output
MemTotal:        8088428 kB
MemFree:          947068 kB
MemAvailable:    4887716 kB
Buffers:           84312 kB
Cached:          4208312 kB
SwapCached:            0 kB
Active:          4548804 kB
Inactive:        2627148 kB
Active(anon):    2321560 kB
Inactive(anon):   334080 kB
Active(file):    2227244 kB
Inactive(file):  2293068 kB
*/

Last updated