tamatesting.blogg.se

Size of file folder
Size of file folder









To find the apparent size of a directory, use the -apparent-size option. The -c option tells du to print a grand total of all sizes: sudo du -shc /var/* 24K /var/dbĪnother way to get a report about the disk usage of the first-level subdirectories is to use the -max-depth option: sudo du -h -max-depth=1 /var 77G /var/libīy default, the du command shows the disk space used by the directory or file. The first one is to use the asterisk symbol ( *) as shown below, which means “match everything that doesn’t start with a period (. What if you want to display the disk usage of the first-level subdirectories? You have two options.

  • /var - The path to the directory you want to get the size.
  • h - Print sizes in a human-readable format ( h).
  • s - Display only the total size of the specified directory, do not display file size totals for subdirectories.
  • size of file folder

    The du command will print “du: cannot read directory”.

    size of file folder

  • The command starts with sudo because most of the files and directories inside the /var directory are owned by the root user and are not readable by the regular users.
  • Let’s explain the command and its arguments: The output will look something like this: 85G /var For example, to get the total size of the /var directory, you would run the following command: sudo du -sh /var Typically, you would want to display the space occupied by the directory in a human-readable format. When invoked without any options, du displays the disk usage of the given directory and each of its subdirectories in bytes. If no path is specified, du reports the disk usage of the current working directory If the specified path is a directory, du summarizes disk usage of each subdirectory in that directory. Getting the Size of a Directory #Ĭommand displays the amount of file space used by the specified files or directories. The command you’ll want to use to get the actual size of a directory is du, which is short for “disk usage”. That’s the size of space on the disk that is used to store the meta-information for the directory, not what it contains.

    size of file folder

    When listing the contents of a directory using the lsĬommand, you may have noticed that the size of the directories is almost always 4096 bytes (4 KB).











    Size of file folder