Science and technology

Check disk utilization in Linux

Knowing how a lot of your disk is being utilized by your recordsdata is a vital consideration, irrespective of how a lot storage you may have. My laptop computer has a comparatively small 250GB NVME drive. That’s okay more often than not, however I started to discover gaming on Linux a few years in the past. Installing Steam and some video games could make storage administration extra crucial.

The du command

The best technique to look at what’s left for storage in your disk drive is the du command. This command line utility estimates file area utilization. Like all Linux instruments, du may be very highly effective, however realizing easy methods to use it in your explicit wants is useful. I at all times seek the advice of the person web page for any utility. This particular software has a number of switches to provide the absolute best snapshot of file storage and the way a lot area they devour in your system.

There are many choices for the du command. Here are a few of the frequent ones:

  • -a – write counts for all recordsdata and never simply directories
  • --apparent-size – prints obvious sizes somewhat than disk utilization
  • -h – human-readable format
  • -b – bytes
  • -c -grand whole
  • -k – block dimension
  • -m – dimension in megabytes

Be positive to test the du man web page for an entire itemizing.

Display all recordsdata

The first possibility you could possibly select is du -a. It offers a readout of all recordsdata in your system and the directories they’re saved in. This command lets me know I’ve acquired 11555168 bytes saved in my dwelling listing. Using du -a offers a fast recursive take a look at my storage system. What if I need a extra significant quantity, and I wish to drill down into the directories to see the place the large recordsdata are on my system?

I believe there are some huge recordsdata in my Downloads listing, so I enter du -a /dwelling/don/Downloads to get a very good take a look at that Downloads listing.

$ du -a ~/Downloads
4923    ./UNIX_Driver_5-0/UNIX Driver 50
4923    ./UNIX_Driver_5-0
20     ./epel-release-latest-9.noarch.rpm
12    ./rpmfusion-free-release-9.noarch.rpm
2256    ./PZO9297 000 Cover.pdf
8    ./laptop.md
2644    ./geckodriver-v0.31.0-linux64.tar.gz
466468  

The numbers on the far left are the file sizes in bytes. I need one thing extra useful to me so I add the swap for the human-readable format to my du -h /dwelling/don/Downloads command. The result’s 4.8 G(igabytes) which is a extra helpful quantity format for me.

$ du -ah ~/Downloads
4.9M    ./UNIX_Driver_5-0/UNIX Driver 50
4.9M    ./UNIX_Driver_5-0
20K    ./epel-release-latest-9.noarch.rpm
12K    ./rpmfusion-free-release-9.noarch.rpm
2.2M    ./PZO9297 000 Cover.pdf
8.0K    ./laptop.md
2.6M    ./geckodriver-v0.31.0-linux64.tar.gz
456M    .

As with most Linux instructions, you may mix choices. To take a look at your Downloads listing in a human-readable format, use the du -ah ~/Downloads command.

[ Read also: 5 Linux commands to check free disk space ]

Grand whole

The -c possibility offers a grand whole for disk utilization on the final line. I can use du -ch /dwelling/don to show each file and listing in my dwelling listing. There is a number of info, and I actually simply need what’s on the finish, so I’ll pipe the disk utilization command to tail. The command is du -ch /dwelling/don | tail.

(Don Watkins, CC BY-SA 4.0)

The ncdu command

Another possibility for Linux customers enthusiastic about what’s saved on their drive is the ncdu command. The command stands for NCurses Disk Usage. Depending in your Linux distribution, you might have to obtain and set up it.

On Linux Mint, Elementary, Pop_OS!, and different Debian-based distributions:

$ sudo apt set up ncdu

On Fedora, Mageia, and CentOS:

$ sudo dnf set up ncdu

On Arch, Manjaro, and related:

$ sudo pacman -S ncdu

Once put in, you should utilize ncdu to research your filesystem. Here is a pattern output after issuing ncdu inside my dwelling listing. The man web page for ncdu states that “ncdu (NCurses Disk Usage) is a curses-based version of the well-known du, and provides a fast way to see what directories are using your disk space.”

(Don Watkins, CC BY-SA 4.0)

I can use the arrow keys to navigate up and down and press the Enter key to enter a listing. An fascinating word is that du reported whole disk utilization in my dwelling listing as 12GB, and ncdu reviews that I’ve whole disk utilization of 11GB. You can discover extra info within the ncdu man web page.

You can discover a selected listing by pointing ncdu to that listing. For instance, ncdu /dwelling/don/Downloads.

(Don Watkins, CC BY-SA 4.0)

Press the ? key to show the Help menu

(Don Watkins, CC BY-SA 4.0)

Wrap up

The du and ncdu instructions present two completely different views of the identical info, making it straightforward to maintain observe of what is saved in your laptop.

If you are not comfy within the terminal or simply in search of yet one more view of this sort of info, take a look at the GNOME Disk Usage Analyzer. You can simply set up and use it if it isn’t already in your system. Check your distribution for baobab and set up it if you would like to experiment.

Most Popular

breakingExpress.com features the latest multimedia technologies, from live video streaming to audio packages to searchable archives of news features and background information. The site is updated continuously throughout the day.

Copyright © 2017 Breaking Express, Green Media Corporation

To Top