Check Disk Usage on Ubuntu System
Q: How can you check the current disk usage and available space on your Ubuntu system?
- Ubuntu
- Mid level question
Explore all the latest Ubuntu interview questions and answers
ExploreMost Recent & up-to date
100% Actual interview focused
Create Ubuntu interview for FREE!
To check the current disk usage and available space on an Ubuntu system, you can use several commands in the terminal:
1. `df -h`: This command displays the disk space usage of all mounted filesystems in a human-readable format. The `-h` option makes the output easier to understand by showing sizes in KB, MB, or GB.
Example output:
```
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 100G 40G 60G 40% /
```
2. `du -sh /*`: If you want to check the disk usage for specific directories, you can use `du` (disk usage). The `-s` option summarizes the total size of each argument, and the `-h` option again makes it human-readable.
Example usage:
```
du -sh /home/*
```
3. `lsblk`: To view the disk space of all drives and partitions along with their mount points without needing to calculate used space, you can use `lsblk`.
4. Graphical Tool: If you prefer a graphical interface, you can use the 'Disk Usage Analyzer' (also known as Baobab) which provides a visual representation of disk usage.
Each of these methods provides valuable information depending on your needs, whether it's for checking overall disk usage or directory-specific usage.
1. `df -h`: This command displays the disk space usage of all mounted filesystems in a human-readable format. The `-h` option makes the output easier to understand by showing sizes in KB, MB, or GB.
Example output:
```
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 100G 40G 60G 40% /
```
2. `du -sh /*`: If you want to check the disk usage for specific directories, you can use `du` (disk usage). The `-s` option summarizes the total size of each argument, and the `-h` option again makes it human-readable.
Example usage:
```
du -sh /home/*
```
3. `lsblk`: To view the disk space of all drives and partitions along with their mount points without needing to calculate used space, you can use `lsblk`.
4. Graphical Tool: If you prefer a graphical interface, you can use the 'Disk Usage Analyzer' (also known as Baobab) which provides a visual representation of disk usage.
Each of these methods provides valuable information depending on your needs, whether it's for checking overall disk usage or directory-specific usage.


