Learn 🧠 All Concepts (20) 🤖 What is an LLM? 📚 RAG Explained ⚡ AI Agents 💻 Run AI Locally 🇮🇳 AI in India 📖 Learn Tracks 🔧 DevOps Track ⚙️ AI Ops Track 🗺️ AI Engineer Roadmap
Tools 🔧 AI Tools Directory 🔓 Open Source AI ⭐ Top GitHub Repos ✦ Claude Skill Repos 🚀 Ready-to-Deploy Projects
Build 🏗️ Build Hub 🎯 Master Prompts 🧩 RAG Agents 🚀 App Megaprompts
Workflows ⚡ All Workflows (22) 🎥 Text to Video 🎞️ Image to Video 🔊 Text to Speech ♻️ Automation
Resources 🧪 Colab Notebooks ⚙️ n8n Workflows 📈 Algo Trading 💰 Passive Income
🗂️ Browse All Topics About AItheGuru
Learn Linux for Production Support Vijay tames processes without Task Manager
Linux for Production Support Ch 5 / 32 Intermediate 🪟 Windows → Linux
🔄

Vijay tames processes without Task Manager

ps, top, kill, nice — process management for Windows engineers

⏱ 11 min 6 commands 5 takeaways
🔄
In this chapter
Vijay
Windows support engineer, week 4 on Linux
The story

Week 4. A Java application consuming 98% CPU. On Windows: open Task Manager, sort by CPU, right-click End Task. On Linux: command line. And it turned out to be faster.

TASK MANAGER EQUIVALENT - top and ps

Interactive dashboard (like Task Manager refreshing every 2 seconds):

top
# P = sort by CPU (like clicking CPU column header in Task Manager)
# M = sort by memory
# k, type PID, Enter = kill a process
# q = quit

Snapshot (like a screenshot of Task Manager):

ps aux                      # all processes from all users
ps aux --sort=-%cpu          # sorted by CPU, highest first
ps aux --sort=-%mem          # sorted by memory, highest first
ps aux | grep java           # find all java processes

Reading ps aux output:

USER    PID   %CPU %MEM   VSZ    RSS    STAT   COMMAND
tomcat  4521  97.3  12.1   2.1g  800m   Sl     java -jar myapp.jar
USER: who owns the process (User column in Task Manager)
PID: process ID (PID column in Task Manager)
%CPU: CPU usage
%MEM: memory percentage
RSS: actual physical RAM used (this is the real number)
STAT: S=sleeping, R=running, Z=zombie

KILLING PROCESSES - End Task equivalent

kill 4521               # polite kill (like End Task)
kill -9 4521            # force kill (like End Process Tree)
killall java            # kill all processes named java
pkill -f "myapp.jar"    # kill by pattern in command name

When to use which:

Always try kill PID first. Wait 10 seconds.
If still running, then kill -9 PID.
kill -9 is End Process Tree. No cleanup. Last resort only.

PROCESS PRIORITY - Task Manager right-click Set Priority

nice -n 10 command          # start a new process at lower priority
nice -n -10 command         # start at higher priority
renice +10 -p 4521          # lower priority of running process 4521
renice -5 -p 4521           # higher priority of running process
Nice values: -20 (highest) to +19 (lowest). Default is 0 (Normal).
Positive = lower priority (nicer to other processes).
Negative = higher priority (needs sudo).

FINDING WHICH PROCESS USES A PORT - Resource Monitor Network tab

Windows: Resource Monitor > Network > Listening Ports
Linux:   ss -tlnp | grep :8080
Linux:   lsof -i :8080         # more detail - process name, PID, user

MEMORY DETAILS

cat /proc/4521/status | grep VmRSS    # just the RAM usage for process 4521
pmap -x 4521                           # memory map (like Sysinternals VMMap)

BACKGROUND PROCESSES - no Services wrapper needed

nohup ./myapp.py &                  # run in background, keep running after logout
nohup ./myapp.py > output.log 2>&1 & # background with output captured to file
jobs                                # see background jobs in current session
Ctrl+Z                              # pause current foreground process
Ctrl+C                              # stop current foreground process

PROCESS TREE

pstree                      # all processes as a tree
pstree -p                   # include PIDs in the tree
ps -ef --forest             # alternate tree view

Vijay found the CPU-hogging process in 15 seconds with ps aux --sort=-%cpu. He tried kill, waited 10 seconds, confirmed it was gone, restarted the service. Total time: 3 minutes. He admitted: ps aux was faster than opening Task Manager.

Key takeaways

ps aux --sort=-%cpu shows processes sorted by CPU — same as clicking the CPU column in Task Manager

top is interactive Task Manager — press P for CPU sort, M for memory sort, k to kill, q to quit

kill PID is End Task (polite), kill -9 PID is End Process Tree (force) — always try polite first

lsof -i :8080 shows which process owns a port — same as Resource Monitor Network tab

nice and renice change process priority — equivalent to right-click Set Priority in Task Manager

Commands from this chapter
$ ps aux --sort=-%cpu | head -10
Task Manager CPU sort — top 10 CPU consuming processes
$ ps aux | grep processname
Task Manager search — find a specific process
$ kill PID
End Task equivalent — politely stop a process
$ kill -9 PID
End Process Tree equivalent — force stop immediately
$ lsof -i :8080
Resource Monitor equivalent — which process owns port 8080
$ pstree -p
Task Manager Details parent-child view as a tree with PIDs