0Pricing
Linux Command Line Mastery · Lesson

Understanding Processes: `ps`, `top`, `htop`

Explore commands to view, monitor, and understand active processes on your Linux system.

Understanding Processes: `ps`, `top`, `htop` is a free Linux Command Line Mastery lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Linux Command Line Mastery learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

What Are Processes?

Welcome! In this lesson, we'll explore how to view and monitor programs running on your Linux system. These running programs are called processes.

Understanding processes is crucial for system administration, troubleshooting, and managing resource usage.

`ps`: Snapshot of Processes

The simplest way to see active processes is with the ps command. It gives you a snapshot of current processes.

By default, ps shows processes owned by your user in the current terminal session.

ps

More `ps` Details: `aux` and `-ef`

To see all processes on the system, including those owned by other users and system processes, we use options like aux or -ef.

  • a: Show processes for all users.
  • u: Display user/owner.
  • x: Show processes without a controlling terminal.

The -ef option is a common alternative on some systems, providing similar comprehensive output.

ps aux

Deciphering `ps` Output

When you run ps aux, you'll see several columns:

  • USER: The owner of the process.
  • PID: The unique Process ID.
  • %CPU: CPU usage percentage.
  • %MEM: Memory usage percentage.
  • CMD: The command that started the process.

These details help you identify what's running and by whom.

PID and PPID Explained

Every process has a unique PID (Process ID). It's like a social security number for a process.

Many processes are started by other processes. The process that starts another is called its parent process. The child process will have a PPID (Parent Process ID) that matches the parent's PID.

This creates a process tree, showing how processes are related.

ps -o pid,ppid,cmd

`top`: Real-time Monitoring

While ps gives a snapshot, top provides a dynamic, real-time view of your system's processes.

It continuously updates, showing CPU and memory usage, uptime, and a list of processes sorted by CPU usage (by default).

This is great for spotting processes consuming a lot of resources.

top

Navigating `top`

top is interactive! Here are some basic keys:

  • Press q to quit.
  • Press M to sort processes by memory usage.
  • Press P to sort processes by CPU usage (default).
  • Press k to "kill" a process (you'll need the PID).

Remember to be careful when using k!

`htop`: An Enhanced `top`

htop is an improved, interactive process viewer that's often preferred over top due to its user-friendliness.

It offers a more colorful and intuitive interface, making it easier to see CPU and memory usage visually.

You might need to install it first (e.g., sudo apt install htop on Debian/Ubuntu).

htop

Why Use `htop`?

htop provides several advantages:

  • Visual Bars: Clear graphs for CPU, memory, and swap.
  • Scrolling: Easily scroll horizontally and vertically.
  • Mouse Support: Click to sort columns or select processes.
  • Easy Filtering/Searching: Quickly find specific processes.
  • Tree View: See process hierarchy clearly.

It's a powerful tool for monitoring system health.

Process Command Check

You've learned about ps, top, and htop. Let's see if you can distinguish their primary uses.

Processes: Snapshot vs. Real-time

Great job! You now understand how to monitor processes on Linux.

  • ps: Gives a static snapshot of processes. Use ps aux or ps -ef for comprehensive lists.
  • top: Provides a real-time, interactive view of processes, sorted by resource usage.
  • htop: An enhanced, more user-friendly version of top with visual bars, mouse support, and easier navigation.

These tools are essential for any Linux user!

Frequently asked questions

Is the “Understanding Processes: `ps`, `top`, `htop`” lesson free?

Yes — the full text of “Understanding Processes: `ps`, `top`, `htop`” is free to read here on the web, and the Linux Command Line Mastery course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Linux Command Line Mastery course, upgrade to CoddyKit PRO.

What will I learn in “Understanding Processes: `ps`, `top`, `htop`”?

Explore commands to view, monitor, and understand active processes on your Linux system. You practise Linux Command Line Mastery with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Linux Command Line Mastery?

No prior experience is required. Linux Command Line Mastery on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Understanding Processes: `ps`, `top`, `htop`” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Linux Command Line Mastery lesson?

Yes. Every Linux Command Line Mastery lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Understanding Processes: `ps`, `top`, `htop`
  2. Managing Processes: `kill`, `bg`, `fg`
  3. Monitoring System Resources: `df`, `du`, `free`
  4. Process Priorities with nice, renice, and Signals
← Back to Linux Command Line Mastery