MOTOSHARE ๐Ÿš—๐Ÿ๏ธ
Turning Idle Vehicles into Shared Rides & Earnings

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Owners earn. Renters ride.
๐Ÿš€ Everyone wins.

Start Your Journey with Motoshare

Real-Time Memory Monitoring in Linux with free -m and watch

When your Linux system starts slowing down, the first suspect is usually memory. Is RAM maxing out? Is swap being used? Is some process eating up everything?

Luckily, Linux offers simple yet powerful commands to help monitor memory usage โ€” and two of the most underrated ones are:

  • free -m
  • watch -n 1 free -m

Together, they give you a real-time, clear view of your memory status, right from the terminal.

Letโ€™s dive into what these commands do and how you can use them like a pro.


๐Ÿ” What is free -m?

The free command shows how much memory and swap space is being used, free, cached, and available on your system.

The -m flag tells free to display the values in megabytes.

โœ… Basic Usage:

free -m

Sample Output:

              total        used        free      shared  buff/cache   available
Mem:           7824        1836         612         130        5375        5583
Swap:          2047           0        2047

Breakdown of the Output

ColumnMeaning
totalTotal RAM or swap space
usedMemory currently in use
freeMemory that is completely unused
sharedMemory shared between processes
buff/cacheMemory used by buffers and cache
availableEstimation of memory available for new processes

๐Ÿ’ก Pro Tip:

Donโ€™t panic if used looks high. Linux uses free memory for caching to speed things up. The available column gives a better picture of what’s really usable.


๐Ÿ” What is watch -n 1 free -m?

This command runs free -m every second, updating the output in real-time.

โœ… Command:

watch -n 1 free -m

What It Does:

  • watch runs a command repeatedly.
  • -n 1 means run it every 1 second.
  • So you get a live dashboard of memory usage.

๐Ÿ’ผ When to Use These Commands?

  • ๐Ÿข Your system is slowing down
  • ๐Ÿง  You’re debugging memory leaks
  • ๐Ÿ› ๏ธ You want to monitor how apps consume memory
  • ๐Ÿ” You’re watching memory usage during load tests

๐Ÿง  Common Use Cases

1. โœ… Monitor a Laravel app under load:

ab -n 1000 -c 10 http://localhost/api/test
watch -n 1 free -m

Watch how your app consumes memory during performance tests.


2. โœ… Detect Swap Usage:

If Swap used starts increasing, your physical RAM is full, and the system is using disk (much slower).

free -m | grep Swap

3. โœ… Combine with Process Monitoring:

Run in two terminals:

  • Terminal 1:
watch -n 1 free -m

Terminal 2:

htop

Youโ€™ll see which process is using the memory in real time.


๐Ÿ“Œ Bonus Tip: Get a One-Liner Summary

free -m | awk 'NR==2{printf "Used: %sMB | Free: %sMB | Available: %sMB\n", $3,$4,$7}'

This outputs something like:

Used: 1856MB | Free: 612MB | Available: 5583MB

Perfect for scripts and logs.


๐Ÿง  Final Thoughts

Whether you’re a system admin or a developer managing servers, keeping an eye on memory is crucial. Tools like free -m and watch -n 1 free -m are simple, fast, and already built into every Linux distro โ€” no setup required.

The next time your system lags or you run a big process, use these commands to stay one step ahead.

Related Posts

Master Your DevOps Journey: The Ultimate Guide to MDE Certification

In today’s hyper-competitive IT world, where digital transformation is the norm, professionals need skills that deliver speed, security, and scalability. Enter the Masters in DevOps Engineering (MDE)…

Master SRE Basics: Foundation Certification Guide

In the world of modern software, where a single outage can derail businesses and frustrate users, Site Reliability Engineering (SRE) has emerged as the go-to discipline for…

SRECP Deep Dive: Tools, Tips, Training

In today’s hyper-connected digital landscape, where a single outage can derail millions in revenue, Site Reliability Engineering (SRE) has become the secret weapon for tech leaders. If…

Master SRE: Your Path to Unbreakable Systems

In an era where a single minute of downtime can drain millions from a company’s coffers, keeping digital services running smoothly isn’t optionalโ€”it’s essential. Site Reliability Engineering…

Ace the EX280: Your Key to Mastering Red Hat OpenShift

In today’s fast-paced tech landscape, container orchestration with Kubernetes is a must-have skill. But for enterprise environments, you need a platform that is robust, secure, and scalable….

Master Ansible Automation: Your Complete Guide to Red Hat EX407 Certification

In today’s lightning-fast IT world, manual server configurations are a thing of the past. Enter Ansibleโ€”the agentless powerhouse that’s transforming how teams manage infrastructure. If you’re a…

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x