Monitoraggio delle risorse di sistema: `df`, `du`, `free`
Controlli lo spazio su disco, le dimensioni delle directory e l’utilizzo della memoria per mantenere il sistema ottimizzato.
Monitoraggio delle risorse di sistema: `df`, `du`, `free` è una lezione Linux Command Line Mastery gratuita su CoddyKit. Questa è la lezione 3 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.
Why Monitor System Resources?
Keeping an eye on your system's resources is crucial for smooth operation. Just like a car needs fuel and oil, your computer needs enough disk space and memory to run efficiently.
Ignoring these can lead to slow performance, crashes, or even data loss.
Check Disk Space with `df`
The df command, short for "disk free", reports the amount of available disk space used by file systems.
It's your go-to command to see how much room is left on your partitions.
`df` Command in Action
Let's try df with the -h option for human-readable output. This makes sizes like gigabytes (GB) and megabytes (MB) easy to understand.
Run this command in your terminal:
df -hInterpreting `df` Results
The output of df -h shows several columns:
- Filesystem: The name of the disk partition.
- Size: Total capacity of the partition.
- Used: Space currently occupied.
- Avail: Remaining free space.
- Use%: Percentage of disk space used.
- Mounted on: Where the filesystem is accessible in the directory tree.
Disk Usage with `du`
While df shows overall disk free space, du ("disk usage") estimates file space usage, primarily for specific files or directories.
It helps you find out which folders are taking up the most space.
`du` on a Directory
To see the total size of a directory in a human-readable format, use -s (summary) and -h (human-readable) with du. Replace /var/log with any directory you want to check.
du -sh /var/logDetailed `du` Output
Want to see the size of subdirectories within a folder? Use --max-depth=N to limit the depth of the output. Here, we'll see direct subdirectories (depth 1).
du -h --max-depth=1 /home/userMonitor Memory with `free`
Memory (RAM) is vital for your system's speed. The free command displays the total amount of free and used physical and swap memory in the system.
Keeping an eye on free memory helps prevent slowdowns.
`free -h` in Practice
Similar to df, using the -h option with free provides output that's much easier to read. It shows memory in KB, MB, or GB.
free -hResource Monitoring Check
You're running low on disk space and want to find which large directories are consuming it. Which command is best suited for this task?
Recap: System Resources
Great job! In this lesson, you learned how to monitor your Linux system's vital resources:
df: Check overall disk free space.du: Estimate disk usage for files and directories.free: Monitor physical and swap memory usage.
These commands are essential tools for maintaining a healthy and optimized system!
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 «Monitoraggio delle risorse di sistema: `df`, `du`, `free`» è gratuita?
Sì — il testo completo di «Monitoraggio delle risorse di sistema: `df`, `du`, `free`» è 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 «Monitoraggio delle risorse di sistema: `df`, `du`, `free`»?
Controlli lo spazio su disco, le dimensioni delle directory e l’utilizzo della memoria per mantenere il sistema ottimizzato. 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 3 di 4.
Quanto tempo richiede la lezione «Monitoraggio delle risorse di sistema: `df`, `du`, `free`»?
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