I
Insight Horizon Media

How do I check the current space of a directory?

Author

Christopher Anderson

Published Feb 22, 2026

How do I check the current space of a directory?

Use the -P flag to df , you’ll get it all on one line. related du -hs . to see the disk space in use for current directory.

How do I see disk usage in a directory?

The du command displays the amount of file space used by the specified files or directories. If the specified path is a directory, du summarizes disk usage of each subdirectory in that directory. If no path is specified, du reports the disk usage of the current working directory .

How do I check the size of a folder in Linux?

How to view the file size of a directory. To view the file size of a directory pass the -s option to the du command followed by the folder. This will print a grand total size for the folder to standard output. Along with the -h option a human readable format is possible.

How do I check the size of a Linux file in GB?

Use ls command for files and du command for directories. ls command will not list the actual size of directories(why?). Therefore, we use du for this purpose. Including -h option in any of the above commands (for Ex: ls -lh * or du -sh ) will give you size in human readable format ( kb , mb , gb .)

How do I see disk usage in Linux?

Check Disk Usage in Linux Using the du Command du /home/user/Desktop — this command line allows users to see into the disk usage of their Desktop folders and files (subdirectories are included as well).

How do I check disk space in Unix?

Check disk space on Unix operating system Unix command to check disk space: df command – Shows the amount of disk space used and available on Unix file systems. du command – Display disk usage statistic for each directory on Unix server.

How do you check MB size in Linux?

use the -lh option with ls. Note that -h is a GNU coreutils extension. If the M suffix bothers you in some way, you can get rid of it by using –block-size=1M. If however you want to see the size in MB (10^6 bytes) instead, you should use the command with the option –block-size=MB.

How do you check file size in Linux?

Using the ls Command

  1. –l – displays a list of files and directories in long format and shows the sizes in bytes.
  2. –h – scales file sizes and directory sizes into KB, MB, GB, or TB when the file or directory size is larger than 1024 bytes.
  3. –s – displays a list of the files and directories and shows the sizes in blocks.

What is the command to display the total disk usage of the current directory in Unix?

du command
The du command, short for “disk usage” reports the estimated amount of disk space used by given files or directories.

How do you check space utilization of a directory in Unix?

How do I find unpartitioned space in Linux?

While also finding the unallocated space in a hard disk using command line # fdisk /dev/sda will display the total space and total cylinder value. Now check the last cylinder value and subtract it from the total cylinder value. Hence the final value * 1000 gives you the unallocated disk space.

How many MB is in a GB?

1 Gigabyte is equal to 1000 megabytes (decimal). 1 GB = 103 MB in base 10 (SI). 1 Gigabyte is equal to 1024 megabytes (binary). 1 GB = 210 MB in base 2.