If you need to know how much space remains on those drives connected to your server, the information is but a quick command away. Jack Wallen shows you how.
How much space remains on your Linux server hard drives? It’s not a trick question, and it’s one you should immediately know how to answer.
Of course, if you use a web-based tool like Cockpit, which gives you a quick heads up as to how much local storage space has been used, the task is very straightforward. Or maybe you’ve installed a GUI on your servers and can use a file manager to discover this information.
SEE: The best programming languages to learn–and the worst (TechRepublic Premium)
But what if your servers don’t use a GUI and you’ve not set up a web-based control panel? Where then do you turn to uncover the details on how much drive space has been used? Fortunately, there’s an easy-to-use command that will present this information to you in a simple format.
The command is df and reports file system disk space usage. Df stands for “disk free,” and makes it easy for you to see how much space is in use on all of your connected disks or a specific disk.
When you issue the df command you’ll see six columns: Filesystem (which is the location of the drive in question), Size (which is the total storage space on the drive), Used (which is the amount of space used on the drive), Use% (which is the percentage of the space used on the drive), and Mounted on (which is the directory the drive is mounted on).
The command is simply df. If you run it as such, it’ll display everything in 1K blocks, which isn’t all that understandable. If, however, you issue the command df -h, everything will be in a human-readable format.
Or, if you only want to view the stats for a specific drive, you’d issue a command like df -h /media/jack/TOSHIBA (substituting the Mounted on location for the drive in question).
Listing out a single drive can make it much easier when you have a server filled with drives. The df command is simple to use, but if you need a bit more power, make sure to read the man page (by issuing the command, man df) to find out what more it can do for you.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.