The Expert Crew

Menu
  • Home
  • Android
  • Apple
  • Linux
  • Windows
  • Reviews
  • How To
  • Gaming
    • Xbox
    • PS
    • Nintendo Switch
  • Web

Binance: Buy BTC & 600+ Crypto Ethereum, USDC, XRP and Altcoins with USD Securely

Join Now & Claim Free Bitcoin
Home
How To
Using du to Free Up Disk Space in Linux

Using du to Free Up Disk Space in Linux

September 29, 2021

If you’re new to Linux, you might be asking how to make more space on your hard drive. It’s not usually as straightforward as deleting a few apps. This is especially true if you have a large number of files dispersed over your whole disk. While there are a variety of ways to free up disk space in Linux, keep reading to learn about one of the quickest: du and a few basic terminal commands.

Using du to Free Up Disk Space in Linux

What is du?

In Linux, du is a typical command that displays information about disk utilization fast. The command’s name literally means “disk usage.” While this may appear to be a simple command, du has a variety of parameters and functions that make it a useful tool for both novice and advanced Linux users.

How to Start Using du

You might be unsure how to get started with du. Using the command without any parameters is, of course, the simplest and most basic method:

du
Using du to Free Up Disk Space in Linux

This, on the other hand, isn’t especially relevant knowledge. Other programs and scripts frequently use the output provided here, but we’ll need to add some parameters to make it usable for the typical user.

Converting the size outputs to a format you can read is one possibility. You’ll need to use the -h or –human-readable flags to accomplish this.

du -h
Using du to Free Up Disk Space in Linux

The size of the files on the left is more easier to interpret as a result of this. However, there is still a lot to sort through. Other solutions, fortunately, make this easier.

The -s flag displays a summary of the disk utilization of the specified directory. This is frequently used in conjunction with the -h switch to provide a quick and easy-to-read overview of the directory.

du -hs
Using du to Free Up Disk Space in Linux

Depending on which folders you’re inspecting with du, you might need to use sudo or something similar to boost your rights. When you want to see how much disk space the root directory takes up, for example.

While du has many other useful options, the -h and -s flags are the only ones we need to free up disk space.

Related: How to Clean Up and Make Space on Your Windows “C” Drive

How to Free Up Linux Disk Space with du

You may use du to free up disk space on your computer now that you know how to use it.

Finding out what is taking up the most space on your disk is the quickest approach to clean it up. This can be accomplished by allowing du to scan the entire system. To accomplish this, append an asterisk to the directory path. The asterisk acts as a wildcard, instructing the command to look through the entire directory.

sudo du -hs /*

This displays the directory in the filesystem that takes up the most space. Then, in each directory, use the same command to see which sub-directories and files are using up the most space.

In most circumstances, you’ll be looking in your home directory, as this is where your personal files are kept. This can be done by searching for ~/, which stands for your home directory.

du -hs ~/*

Repeat these commands as many times as necessary to determine which directories are using up the most space.

For example, if your home folder has a subfolder called “Storage” that is using up a lot of space, du can help you figure out which files in it are the largest.

du -hs ~/Storage/*

Using the rm command, you can simply delete the files you don’t want.

rm -rf ~/Storage/big-file

To free up the desired quantity of storage space, repeat the process for any other files you no longer want on your drive.

Related: How to Combine PDF Files on Windows and Linux

Frequently Asked Questions

1. Is there a way to sort by file size?

Yes, you can pipe the output from du into sort in order to sort by file size.

du -hs ~/* | sort -hr

2. How do I see how much free disk space I have?

To view how much free disk space you have, you’d use df, a whole separate tool with a very easy usage:

df -h

3. Should I use du to remove programs from my computer?

No, this method only works with files that you have saved yourself. If you want to uninstall a program, utilize the package manager or software center in your distribution.

Related: How to Set Process Priority in Task Manager on Windows 10

Final Thoughts

As you can see, utilizing the command line to free up disk space in Linux is pretty straightforward. You’ll discover that using du and all of its capabilities is considerably faster and easier than most other ways once you get the hang of it.

Share
Tweet
Pinterest
Reddit
Tumblr
Vkontakte
Prev Article
Next Article

Related Articles

How to Fix Flash drive files become shortcuts
USBs are an excellent way to transport files and transfer …

How to Fix Flash drive files become shortcuts

How to Install or Update Windows 11 WiFi Driver
Learn all the ways in which you can install or …

How to Install or Update Windows 11 WiFi Driver

How to Automatically Turn Off Wi-Fi Upon Ethernet Connect in Windows 11
When you connect an ethernet cable to a computer that …

How to Automatically Turn Off Wi-Fi Upon Ethernet Connect in Windows 11

How to Clear YouTube Watch History
In order to provide better video suggestions, YouTube will track …

How to Clear YouTube Watch History

How to Change Which Apps Siri Uses to Play Audio in iOS
It is rare to see Apple add options to iOS …

How to Change Which Apps Siri Uses to Play Audio in iOS

No Responses

  1. Pingback: How To Play Old DOS Games on macOS with DOSBox - The Expert Crew
  2. Pingback: What Is Win32:BogEnt and How to Remove It - The Expert Crew

Related Posts

  • How to Factory Reset Windows 10 to Its Default Settings
    How to Factory Reset Windows 10 to Its Default Settings

Featured Products

  • Hostinger Web Hosting Review
    Hostinger Web Hosting Review
  • HostGator Web Hosting Review
    HostGator Web Hosting Review
  • Bluehost Web Hosting review
    Bluehost Web Hosting review
  • Best Web Hosting Services: The Top Web Hosts of 2022
    Best Web Hosting Services: The Top Web …
  • Binance Review 2022 – Should You Use It?
    Binance Review 2022 – Should You Use …

The Expert Crew

Linux & Windows 10/11 & Android Tips, Tricks, Help, Support, Downloads, Features
Copyright © 2023 The Expert Crew
About us | Contact Us | Disclaimer | Privacy Policy | Terms of Service