How to check disk space usage in linux

how to check disk space usage in linux

How to Check Disk Space on Linux from the Command Line

Apr 13, Check Linux Disk Space Using df Command. You can check your disk space simply by opening a terminal window and entering the following: df. The df command stands for disk free, and it shows you the amount of space taken up by different drives. By default, df displays values in . How to check disk usage by folder on Linux 1. Check disk usage by folder via command line 2. Check disk usage by folder via GUI 3. Closing Thoughts.

Joinsubscribers and get a daily digest of news, geek trivia, and our feature articles. By submitting your email, you agree to the Terms of Use and Privacy Policy. The df how to decorate small bathrooms pictures du commands report on disk space usage from within the Bash shell used on Linux, macOS, and many other Unix-like operating systems. Bash contains two useful commands related to disk space.

To find out the available and used disk space, use df disk filesystems, sometimes called disk free. Type df and press enter in a Bash terminal window to get started. Using df without any options will display the available and used space for all mounted filesystems. At first glance, it might look impenetrable, but it is quite easy to understand.

How to record from radio on the internet can replace the 1K block counts with more useful output by using the -B block size option.

These letters represent the kilo, mega, giga, tera, peta, exa, zeta, and yotta values from the multiple of scale. For example, to see the disk usage figures in megabytes, you would use the following command. Note there is no space between the B and M. The -h human readable option instructs df to use the most applicable how to get e books for free for the size of each filesystem. In the next output note what is the meaning of irregularities there are filesystems with gigabyte, megabyte and even what is the definition of penchant sizes.

If you need to see the information represented in numbers of inodes, use the -i inodes option. An inode is a data structure used by Linux filesystems to describe files and to store metadata about them. On Linux, inodes hold data such as the name, modification date, position on the hard drive, and so on for each file and directory.

Unless told not to, df will provide information on all of the mounted file systems. This can lead to a cluttered display with a lot of output. If you use the new Ubuntu snap method of installing applications, you can acquire a lot of these. We can tell df to exclude filesystems of a specific type.

To do so, we need to know what type of filesystem we wish to exclude. The -T print-type option will give us that information. It instructs df to include the type of filesystem in the output. We can exclude them with the following command:. That gives us a more manageable output.

To get a total, we can add the --total option. We can ask df to only include filesystems of a particular type, by using the -t type option. If we want to see the sizes for a set of filesystems, we can specify them by name. Drive names in Linux are alphabetical. Partitions are numbered.

We tell df to return information on a particular filesystem by passing the name of the filesystem as a command parameter. So to look at all partitions on the first drive, we could use:. We can ask df to report on a set of named filesystems. To further customize the display, we can tell df which columns to include. To do so use the --output option and provide a comma-separated list of the required column names. Make sure not to include any spaces in the comma separated list.

Long commands are perfect candidates to be turned into an alias. We can create an alias dfc for df custom by typing the following and pressing Enter:. Typing dfc and pressing enter will have the same effect as typing in the long command. To make this alias permanent add it to your. If how to check disk space usage in linux want to take the opposite approach and have df return all the information it possibly can use the -a all option and the --output option as shown below.

The -a all option asks df to include every filesystem, and using the --output option without a comma-separated list of columns causes df to include every column. Piping the output from df through the less command is a convenient way to review the large amount of output this can produce. We can use the du command to show which folders are holding the most data. Issuing the du command with no options will display a list of all directories and sub-directories below the directory the du command was issued in.

If you do this from your home folder the listing will be very long. The output format is very simple. Each line shows the size and name of a directory. By default, the size is shown in 1K blocks. To force du to use a different block size, use the -B block size option. To use 1M blocks, use this command:.

Just like dfdu has a human-readable option, -hwhich uses a range of block sizes according to the size of each directory. The -s summarize option gives how to check disk space usage in linux total for each directory without displaying the sub-directories within each directory.

The Picture folder holds the most data by far. We can ask du to sort the folders in size from largest to smallest. By refining the information returned by df and du it is easy to find out how much hard disk space is in use, and to discover what is taking up that space. You can then make an informed decision about moving some data to other storage, adding another hard drive to your computer or deleting redundant data.

These commands have a lot of options. We described the most useful options here, but you can see a complete listing of the options for the df command and for the du command in the Linux man pages.

The Best Tech Newsletter Anywhere. Joinsubscribers and get a daily digest of news, comics, trivia, reviews, and more.

Windows Mac iPhone Android. Smarthome Office Security Linux. The Best Tech Newsletter Anywhere Joinsubscribers and get a daily how to reinstall facebook on blackberry curve 8520 of news, geek trivia, and our feature articles. How-To Geek is where you turn when you want experts to explain technology. Since we launched inour articles have been read more than 1 billion times.

Want to know more?

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

Nov 24, Check Disk Space in Linux Using the df Command df, which stands for Disk Filesystem, is used to check disk space. It will display available and used storage of file systems on your machine. When executing this command, you will see the default columns: Filesystem, Size, Used, Available, Use%, and Mounted On. Jun 22, The df command is the tool I first used to discover drive space on Linux, way back in the s. Its very simple in both usage and reporting. To this day, df is my go-to command for this task. This command has a few switches but, for basic reporting, you really only need one. That command is df -H. The -H switch is for human-readable format. Jan 26, df command Shows the amount of disk space used and available on Linux file systems. du command Display the amount of disk space used by the specified files and for each subdirectory. btrfs fi df /device/ Show disk space usage information for a btrfs based mount point/file system.

Managing disk space on a Linux server is an important task. For example, package manager applications notify you how much disk space will be required for an installation. For that information to be meaningful, you should know how much space your system has available. In this tutorial, learn how to use the df command to check disk space in Linux and the du command to display file system disk space usage.

The df command stands for disk free , and it shows you the amount of space taken up by different drives. By default, df displays values in 1-kilobyte blocks. You can display disk usage in a more human-readable format by adding the h option:.

This displays the size in kilobytes K , megabytes M , and gigabytes G. This displays the usage on your primary hard drive. Use the mount point in the Mounted on column to specify the drive you want to check. Note: The df command only targets a full filesystem. Even if you specify an individual directory, df will read the space of the whole drive. This can address a point of confusion in storage technology.

Because of this, a gigabyte hard drive ends up with roughly gigabytes of usable storage. The du command displays disk usage. This tool can display disk usage for individual directories in Linux , giving you a finer-grained view of your disk usage. Use it to display the amount of space used by your current directory:.

Like the df command, you can make du human-readable:. You can simplify the display with the s option:. With the second command, you may have noticed a permission denied error message.

Use the sudo command to elevate your privileges:. You should now understand how to use df and du commands to check disk space on your Linux system. Remember, to display a complete list of options, use either df help or du help. Check out our article on how to use fsck command to run a filesystem check as preventive maintenance or when there is an issue with your system. Web Servers , SysAdmin. In most modern Linux operating systems, managing a service is quite simple when it comes to basic commands.

Read More. Security , SysAdmin. How to Use the su Command in Linux with Examples. Learn how to use the su command with practical examples and explanations. Change users in the terminal window. Backup and Recovery , SysAdmin. Rsync is a Linux tool that allows you to transfer files to another location.

You can customize the command by. How to Get the Size of a Directory in Linux. Use the command line interface to display directory size and for display disk space. This guide will help you. Alongside her educational background in teaching and writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts and streamlining intricate software installations. How to Check Disk Space in Linux.

How much space do I have free on my Linux drive? You can check your disk space simply by opening a terminal window and entering the following: df The df command stands for disk free , and it shows you the amount of space taken up by different drives. Display Usage in Megabytes and Gigabytes. You can display disk usage in a more human-readable format by adding the h option: df h This displays the size in kilobytes K , megabytes M , and gigabytes G. Understanding the Output Format.

The columns should be self-explanatory: Filesystem This is the name of each particular drive. This includes physical hard drives, logical partitioned drives, and virtual or temporary drives. Size The size of the filesystem. Used Amount of space used on each filesystem. Avail The amount of unused free space on the filesystem. Mounted on This is the directory where the file system is located. This is also sometimes called a mount point. This is part of the Linux operating system.

These are the files that prevent multiple users from changing the same file at the same time. Display a Specific File System. Display File Systems by Type. To list all file systems by type, use the command: df ht ext4 This lists drives with the ext4 type, in human-readable format.

Display Size in Instead of You can display disk usage in units of instead of du H This can address a point of confusion in storage technology. You can simplify the display with the s option: du hs This shows how much space the current directory uses. Next you should also read.

3 thoughts on “How to check disk space usage in linux

  1. Using templates wouldnt work either because i would delete them because i wrongly think that i wont need them and end up needing them later

Add a comment

Your email will not be published. Required fields are marked *