Operations 7 min read

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.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Linux Server Monitoring with watch, top, and ac Commands

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 -m

Inspecting 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 -10

Conclusion

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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Server Monitoringtopwatchac
Liangxu Linux
Written by

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.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.