Thursday, May 1, 2025

Unix Top Command

Here's the above explanation in clean, semantic HTML format: ```html Unix top Command - Usage Guide

Unix top Command - Usage Guide

๐Ÿ” What top Shows

When you run top, it displays:

1. System Summary

  • uptime: How long the system has been running.
  • users: Number of logged-in users.
  • load average: 1, 5, and 15 minute load.
  • Tasks: Total, running, sleeping processes, etc.
  • CPU usage:
    • %us: user processes
    • %sy: system/kernel processes
    • %id: idle time
    • %wa: I/O wait
    • %hi: hardware interrupts
    • %si: software interrupts
    • %st: steal time (VMs)
  • Memory and Swap: Total, used, free, buffers, etc.

2. Process List

Displays information per process:

  • PID: Process ID
  • USER: Owner
  • %CPU: CPU usage
  • %MEM: Memory usage
  • TIME+: Total CPU time used
  • COMMAND: Command name

๐Ÿ› ️ Common Day-to-Day Usage in Production

  • Find High CPU Usage: Use P to sort by CPU usage.
  • Check Memory Leaks: Use M to sort by memory usage.
  • Identify Stuck or Zombie Processes: Look for state Z.
  • Check Load Averages: High load may indicate system stress.
  • Check I/O Wait: High %wa indicates disk bottlenecks.
  • Kill a Misbehaving Process: Use k and enter PID.

๐Ÿง  Useful Keybindings in top

Key Action
PSort by CPU usage
MSort by memory usage
kKill a process (enter PID)
RRenice a process
cToggle full command display
1Show all CPU cores
hHelp
qQuit

๐Ÿงช Pro Tips

  • Use top -u <username> to filter by user.
  • Use top -p <PID> to monitor a specific process.
  • Use htop for a more visual alternative (if installed).
``` You can save this as an `.html` file and open it in any browser. Want me to include a live example or a downloadable template?

No comments:

Post a Comment

Sudo Command Details

sudo -l -U a762311 Output : User a762311 may run the following commands on MACLB390804