\/root<\/b> directory on your server.<\/p>\r\n\r\n\r\n\r\ndu<\/pre>\r\n\r\n\r\n\r\nYou should get the following output.<\/p>\r\n\r\n\r\n\r\n
.<\/p>\r\n\r\n\r\n\r\n
root@vps:~# du\r\n4 .\/.config\/procps\r\n4 .\/.config\/mc\/mcedit\r\n12 .\/.config\/mc\r\n20 .\/.config\r\n8 .\/.nano\r\n4 .\/.gnupg\/private-keys-v1.d\r\n8 .\/.gnupg\r\n4 .\/.local\/share\/mc\/mcedit\r\n16 .\/.local\/share\/mc\r\n20 .\/.local\/share\r\n24 .\/.local\r\n8 .\/.ssh\r\n4 .\/.cache\/mc\/mcedit\r\n12 .\/.cache\/mc\r\n16 .\/.cache\r\n120 .<\/pre>\r\n\r\n\r\n\r\nAs you can see the output is not very understandable, and there is no information about the given numbers if they are in Kilobytes, Megabytes, or Gigabytes<\/p>\r\n\r\n\r\n\r\n
Execute the du<\/b> command along with the “-h<\/b>” argument.<\/p>\r\n\r\n\r\n\r\ndu -h<\/pre>\r\n\r\n\r\n\r\nNow, the output will be different:<\/p>\r\n\r\n\r\n\r\n
root@host:~# du -h\r\n4.0K .\/.config\/procps\r\n4.0K .\/.config\/mc\/mcedit\r\n12K .\/.config\/mc\r\n20K .\/.config\r\n8.0K .\/.nano\r\n4.0K .\/.gnupg\/private-keys-v1.d\r\n8.0K .\/.gnupg\r\n4.0K .\/.local\/share\/mc\/mcedit\r\n16K .\/.local\/share\/mc\r\n20K .\/.local\/share\r\n24K .\/.local\r\n8.0K .\/.ssh\r\n4.0K .\/.cache\/mc\/mcedit\r\n12K .\/.cache\/mc\r\n16K .\/.cache\r\n120K .\r\n<\/pre>\r\n\r\n\r\n\r\nAs you can see now, the directories and files are displayed with their sizes in Kilobytes (In this example there were no files or folders in Megabytes).<\/p>\r\n\r\n\r\n\r\n
<\/span>Display Directory Size<\/span><\/h2>\r\n\r\n\r\n\r\nIn this example, we are going to use the default WordPress installation directory. Before you check the size we assume that you have downloaded it from their official website.<\/p>\r\n\r\n\r\n\r\n
wget https:\/\/wordpress.org\/latest.zip\r\nunzip latest.zip<\/pre>\r\n\r\n\r\n\r\nTo check the size of the WordPress directory, execute the command below:<\/p>\r\n\r\n\r\n\r\n
du -csxh \/wordpress<\/pre>\r\n\r\n\r\n\r\nYou should get the following output:<\/p>\r\n\r\n\r\n\r\n
root@vps:~# du -csxh wordpress\/\r\n64M wordpress\/\r\n64M total\r\n<\/pre>\r\n\r\n\r\n\r\nThis command is very useful, the meaning of the arguments are described below:<\/p>\r\n\r\n\r\n\r\n
-c, --total\r\n produce a grand total\r\n -s, --summarize\r\n display only a total for each argument\r\n -x, --one-file-system\r\n skip directories on different file systems\r\n -h, --human-readable\r\n print sizes in human readable format (e.g., 1K 234M 2G)<\/pre>\r\n\r\n\r\n\r\nYou can also use the additional “-k<\/b>” or “-m<\/b>” flags to display the directory in Kilobytes or Megabytes.<\/p>\r\n\r\n\r\n\r\nroot@vps:~# du -csxh -k wordpress\/\r\n65296 wordpress\/\r\n65296 total\r\nroot@host:~# du -csxh -m wordpress\/\r\n64 wordpress\/\r\n64 total\r\n<\/pre>\r\n\r\n\r\n\r\nTo check the sizes of all directories and files inside the WordPress directory execute the command below:<\/p>\r\n\r\n\r\n\r\n
cd \/wordpress\r\n\r\ndu -bsh *<\/pre>\r\n\r\n\r\n\r\nYou should receive the following output:<\/p>\r\n\r\n\r\n\r\n
root@vps:~\/wordpress# du -bsh *\r\n405 index.php\r\n20K license.txt\r\n7.3K readme.html\r\n7.0K wp-activate.php\r\n8.4M wp-admin\r\n351 wp-blog-header.php\r\n2.3K wp-comments-post.php\r\n3.0K wp-config-sample.php\r\n9.7M wp-content\r\n3.9K wp-cron.php\r\n40M wp-includes\r\n2.5K wp-links-opml.php\r\n3.9K wp-load.php\r\n47K wp-login.php\r\n8.4K wp-mail.php\r\n23K wp-settings.php\r\n32K wp-signup.php\r\n4.7K wp-trackback.php\r\n3.2K xmlrpc.php\r\n<\/pre>\r\n\r\n\r\n\r\nThis is the explanation of the command above:<\/p>\r\n\r\n\r\n\r\n
-b, --bytes\r\n equivalent to '--apparent-size --block-size=1'\r\n -s, --summarize\r\n display only a total for each argument\r\n -h, --human-readable\r\n print sizes in human readable format (e.g., 1K 234M 2G)<\/pre>\r\n\r\n\r\n\r\n