![]() ![]() It would also be ideal to only report on the top-level directories in the directory being checked and then drill down even further from there. With larger result sets, it would be preferable to make those disk usage values more easily recognizable. In this simple example, these results are better than the first set you can see that the /home/hellfishmedia/media directory takes up a lot of the space. it does not return the total summary for the entire home directory.The first change we can make is to add the wildcard ( *) character to the end of the directory being summarized: sudo du /home/hellfishmedia/* So we want to start filtering the results so that they are more valuable. It doesn’t order the results in any meaningful wayĪs you can imagine, running this on the server root ( /) or inside your /sites/ directory on a SpinupWP managed instance will output a much longer and confusing list of directories and files.It shows all files and directories, including dot-files, which are usually not disk space culprits.It shows the size estimates in bytes, which is not helpful when looking for large files.It then shows the total summary of the disk usage for the home directory.It traverses through the directory tree for the home directory, showing the path to each directory it finds and summarizes the total disk usage of that directory.In this example, we’ve added two additional directories, logs, and files, which we’ll use later to explain how to customize the du command. sudo duīelow is an example of the output you might get running the command to check the disk space on the home directory of a user on a SpinupWP server: sudo du /home/hellfishmedia/ To ensure that the disk usage command has the required root user permissions to read the directories you are pointing it to, you can prefix any du command with sudo. Running the du command on a specific directory without any arguments will display the summary for that directory. Knowing how to use this command with a specific set of options will help you isolate the disk space culprits. It does this by first summarizing any directory tree (the hierarchy of directories) in the given directory, followed by a usage summary of all the files in that directory. This command-line tool estimates the disk usage in a specified directory. The Disk Usage CommandĪll Ubuntu distributions have a disk usage ( du) command. For these reasons, the du command is much more helpful. However, you will generally only need to examine the / mount when searching for disk space hogs. The df command is excellent for listing all available hard drive mount points or if you know where the problem is. I’ve added the -h switch, so the space usage is showing in a human-readable format. Here’s an example of the output generated when running the df command on an Ubuntu server. You can use this command to show disk usage and free disk space for a specific file system. Many online tutorials recommend the df command to use when checking for disk space usage on a Linux system. The disk space usage could often be unrelated to your website’s files and instead caused by software update caches, large log files, or other server-level related data.įortunately, with a bit of command-line knowledge, it can be pretty straightforward to hunt down what’s taking up space on your hard disk, whether you’re on a desktop or server version of Ubuntu. If you’re managing a server, there’s no graphical user interface (GUI) tool like the Disk Usage Analyzer that shows you which specific directories, subdirectories, or files take up space on your file system. Also, because it’s run as the currently logged in user, it doesn’t have access to all directory locations, so the disk usage problem could be in a place the tool can’t access. The problem with this tool is that if you have a larger hard drive to check, it can take a long time to run. If you are on a desktop install of Ubuntu, you can use the Disk Usage Analyzer tool. Whether you’re on a server or desktop, perhaps you saw a notification warning of your hard drive space running low or received a message from your server provider about disk space problems. There are often situations where you need to perform a disk space check on your Linux operating system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |