In the top command, pressing N (upper-case, so Shift + n) sorts the process list by PID (Process ID).
Here is why that is useful:
- Numerical Order: It organizes the list starting from the lowest PID number to the highest.
- Creation Order: Since Linux usually assigns PIDs in increasing order, sorting by
Noften places the oldest processes (like system services that started at boot) at the top and the most recently started processes at the bottom. - Stability: Unlike sorting by CPU (
P) or Memory (M), which causes the rows to jump around constantly as usage fluctuations, sorting by PID keeps the list relatively still, making it easier to read specific process details.
Give it a try:
- While
topis running, pressShift + n. - You will see the PID column on the far left become organized numerically.
- Press
Pif you want to switch back to sorting by CPU usage.
Do you have any other questions about the columns in top?