

Head -n 10 will limit the number of results to the top ten largest directories. The pipe (“|”) character pipes the results to the head command. Sort -nr will display the largest directories at the top of the list. The pipe (“|”) character pipes the results to the sort command. var tells du to scan the /var directory. a is the “all” switch to show all items.

I COULD go into /var and rerun du – sh * to take a look at the size of the directories underneath, but since there are lots of subdirectories of varying sizes this may not be helpful since I’d have to rerun the same command numerous times. You can easily see which directories contain the largest amount of data the usr directory holds 15 Gb, tools has 7.1 Gb and var has 3.9 Gb. However, this may produce a glut of information difficult to parse.Īdding the switches -sh (“s” means “summarize” and again, “h” means ” human readable format”) to run du – sh * at the root volume will produce a cleaner /]# du -sh * The du command is short for “disk usage.” In its most basic usage, if you simply run “du” at the root volume, it will show you the size of all the directories on your system.

IMAGED DISK YOU NEED TO FORMAT THE DISK SSH LINUX FREE
Now that I’ve established how we can determine free space, how can we actually figure out what’s using space? The “df -Th” command will display the same output as in the previous command but also includes file system usr]# df -T -hįilesystem Type Size Used Avail Use% Mounted onĭevnfs:/tools nfs 584G 156G 399G 29% /tools For instance, the ext4 file system in Linux has a maximum file system size of 16 Tb and can support files up to 2 Tb. When figuring out disk space issues it can be important to know what type of file system you’re dealing with to plan accordingly. My root volume is 73 Gb with 45 Gb of free space. This shows you the raw statistics regarding disk usage in bytes, but to make it more “human readable” run df with the -h switch:įilesystem Size Used Avail Use% Mounted on Here’s what it will return when ~]# dfįilesystem 1K-blocks Used Available Use% Mounted on This is the most basic command of all df can display free disk space. Linux turns 30: Celebrating the open source operating system (free PDF) Kali Linux 2022.1 is your one-stop-shop for penetration testing

KDE Plasma might soon be the best Linux desktop on the market Please note these examples are run on a Red Hat Linux system (but should suffice if you are on a different distribution) and you should have sudo access to run these as root for maximum efficiency.Ĭhecking free space Open source: Must-read coverageīecome a Linux expert just in time for the 2022 boom While QDirStat, GdMap, xdiskusage and Gnome’s Disk Usage Analyzer are all useful examples of graphic-based utilities to measure disk space usage, I have a toolkit of my own commands which I use from the command line and it’s safe to say they’re indispensible to me. Maintenance of our servers requires extensive knowledge of various helpful (yet complex) commands to keep them healthy.ĭisk space is frequently a headache with systems that store and write a lot of data (some useful, and some not). As a system administrator, I operate a few hundred Linux servers and most of them don’t even utilize a graphical user interface such as KDE or Gnome. The Linux operating system is well known for its powerful command line functionality. Use these eight command-line utilities to reclaim space on your Linux machines.
