Unix - That is where ps, top, and htop come in.

1. ps (Process Status)

The "Polaroid Camera"

The ps command takes a snapshot of what is happening right now. It does not update live; it just gives you a static list of processes at the exact moment you typed the command.

How to use it

If you just type ps, you will only see processes running in your current terminal window (which is usually boring). The most popular way to use it is with specific "flags" (options) to see everything.

The Magic Command:

ps aux

* a: Shows processes for all users.

 * u: Displays the user/owner of the process.

 * x: Shows processes not attached to a terminal (background stuff).

Understanding the Output

When you run ps aux, you get a wall of text. Here are the columns that matter most to a student:

 * PID (Process ID): This is the most important column. Every process has a unique ID number (like a Student ID). If you need to stop a program forcefully (kill it), you need this number.

 * USER: Who started the program (e.g., root, your_name).

 * %CPU / %MEM: How much processing power and memory the program is eating up.

 * COMMAND: What the program actually is (e.g., python script.py or chrome).

> Pro Tip: Since ps aux lists thousands of things, students usually pipe it into grep to find a specific program:

> ps aux | grep firefox

2. top

The "Old-School Dashboard"

Unlike ps, top is dynamic. It refreshes every few seconds. It is installed on almost every Unix system by default, making it the reliable, "always there" tool.

How to use it

Just type:

top

Understanding the Interface

It looks a bit intimidating (like a hacker movie screen), but it is split into two parts:

 * The Header (The Summary):

   * Load Average: These three numbers show how busy the system was 1 minute, 5 minutes, and 15 minutes ago.

   * Tasks: Total processes running, sleeping, or "zombie" (stuck).

   * Cpu(s): usage breakdown.

   * Mem: Total RAM usage.

 * The List (The Processes):

   * The bottom half lists processes, usually sorted by who is using the most CPU. You will see the list jump around as processes change behavior.

Key Shortcuts for top:

 * q: Quit (Get me out of here!).

 * k: Kill a process (It will ask for the PID).

 * M: Sort by Memory usage (Find what's eating your RAM).

 * P: Sort by CPU usage (Default).

3. htop

The "Modern Control Center"

htop is the cooler, younger sibling of top. It is colorful, interactive, and much easier to read. However, it is not always installed by default—you might need to install it (sudo apt install htop or brew install htop).

Why Students Love It

 * Visual Bars: Instead of just numbers, it uses green and red bars to show CPU and Memory usage. It is much easier to glance at.

 * Scrolling: You can use your Up/Down arrow keys (or even the mouse!) to scroll through the list. In top, you can't scroll easily.

 * Tree View: It arranges processes in a "tree," so you can see if one program spawned another.

 * Bottom Menu: It lists the shortcut keys at the bottom of the screen so you don't have to memorize them.

Key Shortcuts for htop:

 * F9: Kill. You just highlight the process with arrows and hit F9. No need to type the PID manually!

 * F6: Sort. Lets you easily choose to sort by RAM, CPU, or User.

 * F10: Quit.