Comprendere i processi: `ps`, `top`, `htop`
Esplori i comandi per visualizzare, monitorare e comprendere i processi attivi nel sistema Linux.
Comprendere i processi: `ps`, `top`, `htop` è una lezione Linux Command Line Mastery gratuita su CoddyKit. Questa è la lezione 1 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Linux Command Line Mastery, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Linux Command Line Mastery include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
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.
psMore `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 auxDeciphering `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.
topNavigating `top`
top is interactive! Here are some basic keys:
- Press
qto quit. - Press
Mto sort processes by memory usage. - Press
Pto sort processes by CPU usage (default). - Press
kto "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).
htopWhy 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. Useps auxorps -effor comprehensive lists.top: Provides a real-time, interactive view of processes, sorted by resource usage.htop: An enhanced, more user-friendly version oftopwith visual bars, mouse support, and easier navigation.
These tools are essential for any Linux user!
Impara Linux Command Line Mastery con un tutor IA — gratis
Scrivi ed esegui vero codice nel tuo browser, ricevi aiuto istantaneo da un tutor IA disponibile 24/7, e riprendi da dove hai lasciato sul web o nell'app.
- Corsi
- 12
- Lezioni
- 48
Domande Frequenti
La lezione «Comprendere i processi: `ps`, `top`, `htop`» è gratuita?
Sì — il testo completo di «Comprendere i processi: `ps`, `top`, `htop`» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Linux Command Line Mastery, passa a CoddyKit PRO. Il corso Linux Command Line Mastery include 4 lezioni in totale.
Cosa imparerò in «Comprendere i processi: `ps`, `top`, `htop`»?
Esplori i comandi per visualizzare, monitorare e comprendere i processi attivi nel sistema Linux. Eserciti Linux Command Line Mastery con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Linux Command Line Mastery?
Non è richiesta alcuna esperienza precedente. Linux Command Line Mastery su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 1 di 4.
Quanto tempo richiede la lezione «Comprendere i processi: `ps`, `top`, `htop`»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Linux Command Line Mastery?
Sì. Ogni lezione Linux Command Line Mastery include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Comprendere i processi: `ps`, `top`, `htop`
- Gestione dei processi: `kill`, `bg`, `fg`
- Monitoraggio delle risorse di sistema: `df`, `du`, `free`
- Priorità dei processi con nice, renice e i segnali