CloudsArk
Commands Linux

top Command Examples in Linux

Practice useful top command examples for everyday Linux administration and troubleshooting.

top Command Examples in Linux

Introduction

These examples show practical ways to use top on a Linux terminal. Each example is written so you can adapt it for administration or troubleshooting.

Example 1: Basic Usage

top

This is the simplest form of the command and is a good starting point before adding options.

Example 2: Common Admin Task

top -o %CPU

This example reflects a common task on RHEL, Rocky Linux, AlmaLinux, or similar systems.

Example 3: Useful Option

top -u apache

This option helps narrow the result, change behavior, or handle a more realistic target.

Example 4: Real-World Scenario

top -b -n 1 | head

Use this pattern when the task moves beyond a single basic command.

Example 5: Verification

uptime

Example output:

10:00:00 up 5 days,  2:13,  2 users,  load average: 0.22, 0.31, 0.28

Common Mistakes

  • Killing a process based on one short CPU spike.
  • Reading load average without considering CPU count.
  • Ignoring memory pressure and focusing only on CPU.

Quick Reference

top
top -o %CPU
top -u apache
top -b -n 1 | head
uptime

Summary

Good top usage means choosing the right option, keeping the target clear, and verifying the result with output you can explain.