Master Linux Server Monitoring with watch, top, and ac Commands
This guide explains how to use Linux commands such as watch, top, and ac to continuously monitor server performance, track user activity, view process resource consumption, and analyze login times, providing practical examples and command options for effective system administration.
Monitoring Linux Servers with watch
The watch command repeatedly executes a given command at a specified interval, allowing real‑time observation of changing values. By default it runs every 2 seconds; the -n option changes the period. $ watch -n 5 date Common uses include checking who is logged in and monitoring system load. For example, to see active users every 10 seconds: $ watch -n 10 who To watch the overall load average: $ watch uptime To count the total number of processes continuously: $ watch -n 5 'ps -ef | wc -l' To monitor memory usage in megabytes:
$ watch -n 5 free -mInspecting Processes with top
The top utility provides a dynamic, real‑time view of system metrics and per‑process resource consumption. By default it shows all users; the -u option limits the display to a specific user. $ top -u alvin The output includes CPU usage, memory usage, load averages, and a list of processes with their IDs, owners, and resource percentages.
Tracking Login Time with ac
The ac command (part of the acct or psacct package) reports accumulated login time for users. Running it without arguments shows the total time for all users. $ ac Adding -p displays per‑user totals, while -d breaks the data down by day.
$ ac -p $ ac -d | tail -10Conclusion
By combining watch, top, and ac, administrators can continuously observe server health, monitor individual user activity, and analyze resource consumption without leaving the command line.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
