Меню Рубрики

Check disk linux space

Linux / Unix – Checking Free Disk Space

Tutorial details
Difficulty Easy (rss)
Root privileges No
Requirements None
Time 1m

(a) df command : Report file system disk space usage.

(b) du command : Estimate file space usage.

df command examples to check free disk space

Type df -h or df -k to list free disk space:
$ df -h
OR
$ df -k
Sample outputs that show disk space utilization:

The df utility displays statistics about the amount of free disk space on the specified file system or on the file system of which file is a part. Values are displayed in 512-byte per block counts. The -H option is called as “Human-readable” output. It use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte in order to reduce the number of digits to four or fewer using base 10 for sizes i.e. you see 30G (30 Gigabyte).

How to check free disk space in Linux

To see the file system’s complete disk usage pass the -a option:
df -a
Find out disk usage and filesystem type by passing the -T option:
df -T
Want to get used and free inodes information on Linux? Try:
df -i

du command examples for checking free and used disk space

The du command shows how much space one ore more files or directories is using, enter:
$ du -sh
Sample outputs:

Fig.01: Unix df and du command outputs from my FreeBSD server

Say hello to ncdu command

ncdu (NCurses Disk Usage) is a curses-based version of the well-known ‘du’, and provides a fast way to see what directories are using your disk space. One can install with the following apt command/apt-get command:
sudo apt install ncdu
For RHEL/CentOS, first enable EPEL repo (see CentOS 8 turn on EPEL repo and RHEL 8 enable epel repo) and type the following yum command:
sudo yum install ncdu
Now just type:
ncdu
ncdu [dir] ncdu /etc/

GUI program

Above programs are good if GUI is not installed or you are working with remote system over the ssh based session. Linux and UNIX-like oses comes with KDE and Gnome desktop system. You will find Free Disk Space Applet located under GUI menus. Here is a sample from Fedora Linux version 22 system:

Conclusion

You learned how to keep track of disk utilization, and disk space with various Linux and Unix commands.

Источник

12 Useful “df” Commands to Check Disk Space in Linux

On the internet you will find plenty of tools for checking disk space utilization in Linux. However, Linux has a strong built-in utility called ‘df‘. The ‘df‘ command stands for “disk filesystem“, it is used to get a full summary of available and used disk space usage of the file system on Linux system.

Using ‘ -h ‘ parameter with (df -h) will show the file system disk space statistics in “human readable” format, means it gives the details in bytes, megabytes, and gigabyte.

Useful df Command Examples

This article explains a way to get the full information of Linux disk space usage with the help of ‘df‘ command with their practical examples. So, you could better understand the usage of df command in Linux.

1. Check File System Disk Space Usage

The “df” command displays the information of device name, total blocks, total disk space, used disk space, available disk space and mount points on a file system.

2. Display Information of all File System Disk Space Usage

The same as above, but it also displays information of dummy file systems along with all the file system disk usage and their memory utilization.

3. Show Disk Space Usage in Human Readable Format

Have you noticed that above commands displays information in bytes, which is not readable at all, because we are in a habit of reading the sizes in megabytes, gigabytes etc. as it makes very easy to understand and remember.

The df command provides an option to display sizes in Human Readable formats by using ‘-h’ (prints the results in human readable format (e.g., 1K 2M 3G)).

4. Display Information of /home File System

To see the information of only device /home file system in human readable format use the following command.

5. Display Information of File System in Bytes

To display all file system information and usage in 1024-byte blocks, use the option ‘ -k ‘ (e.g. –block-size=1K ) as follows.

6. Display Information of File System in MB

To display information of all file system usage in MB (Mega Byte) use the option as ‘ -m ‘.

7. Display Information of File System in GB

To display information of all file system statistics in GB (Gigabyte) use the option as ‘df -h‘.

8. Display File System Inodes

Using ‘ -i ‘ switch will display the information of number of used inodes and their percentage for the file system.

9. Display File System Type

If you notice all the above commands output, you will see there is no Linux file system type mentioned in the results. To check the file system type of your system use the option ‘ T ‘. It will display file system type along with other information.

10. Include Certain File System Type

If you want to display certain file system type use the ‘ -t ‘ option. For example, the following command will only display ext3 file system.

11. Exclude Certain File System Type

If you want to display file system type that doesn’t belongs to ext3 type use the option as ‘ -x ‘. For example, the following command will only display other file systems types other than ext3.

12. Display Information of df Command.

Using ‘–help ‘ switch will display a list of available option that is used with df command.

Read Also :

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

Источник

How to check free disk space in Linux

Keep track of disk utilization with this handy list of commands.

Subscribe now

Get the highlights in your inbox every week.

Keeping track of disk utilization information is on system administrators’ (and others’) daily to-do list. Linux has a few built-in utilities that help provide that information.

The df command stands for “disk-free,” and shows available and used disk space on the Linux system.

df -h shows disk space in human-readable format

df -a shows the file system’s complete disk usage even if the Available field is 0

df-ha.png

df -T shows the disk usage along with each block’s filesystem type (e.g., xfs, ext2, ext3, btrfs, etc.)

df -i shows used and free inodes

df-ti.png

You can get this information in a graphical view using the Disks (gnome-disk-utility) in the GNOME desktop. Launch it to see all disks detected by your computer, and click a partition to see details about it, including space used and space remaining.

gnome-disks_space.jpg

du -h shows disk usage in human-readable format for all directories and subdirectories

du -a shows disk usage for all files

du -s provides total disk space used by a particular file or directory

du-has.png

The following commands will check your total space and your utilized space.

This information can be represented visually in GNOME with the Disk Usage application, or with Filelight in the KDE Plasma desktop. In both applications, disk usage is mapped to concentric circles, with the middle being the base folder (usually your /home directory, but it’s up to you) with each outer ring representing one directory level deeper. Roll your mouse over any segment for detailed information about what’s taking up space.

Источник

Читайте также:  Grub rescue rosa linux

Популярные записи

Adblock
detector