I have 20GB for my Mint-KDE 18 root partition. There is no extra home partition. I am doing nothing special, just Chrome, KRDC, Teamviewer and the partition was half empty. One thing I did was copying in Dolphin from webdavs repo on the internet to my network drive via samba. Nothing was stored on my PC.

Now I got the message that my disk is full. When I open my root or home directory in Dolphin it says 0 MB free.

What is the fastest way via terminal to view my directories and files, biggest first or newest etc?

  • 4
    Suggesting non-standard tools is somewhat unhelpful. Where would you install them ?!
    – MSalters
    Commented Oct 5, 2016 at 11:28
  • 5
    @MSalters: in the few MB you free up after deleting some low-hanging fruit like your browser cache, /var/tmp, or something else that some variation on du | sort | less finds. Once you start tidying up, you might want to continue tidying beyond the point where your system is barely usable, GUI tools can make that easier if the sorted du output is messy. Commented Oct 5, 2016 at 12:52
  • 1
    Filelight is also a great GUI option. Not a valid answer here, though. It's useful for installing before you run out of disk space :)
    – stanri
    Commented Oct 5, 2016 at 13:09
  • 1
    @MSalters So maybe then Baobab is a better choice, it looks like it comes bundled with Mint by default, so no need to install anything.
    – Fiksdal
    Commented Oct 5, 2016 at 14:59
  • 1

11 Answers 11

du -h -d 1 /

This will display the size for all of the top-level directories in your root directory in 'human readable' format. You can also just do

du -h -d 1 / | grep '[0-9]\+G' 

to only see the ones taking a couple GB or more.

For a more granular level of detail, do something like

ls -R -shl / | grep '^[0-9.]\{4,12\}\+[KG]'

which will show all files in and below your root directory that are 1G or over in size.

** note that you might need to prepend sudo to the commands above.

edit -- just saw you want them sorted by newest or largest

Try this

du -h -d 1 / | grep '[0-9]\+G' | sort -h
  • 3
    With a 20GB root partition including home, du -h / might also be of relevance. Some old boot images might take up to a GB and probably temporary files are overcrowding.
    – FelixJN
    Commented Oct 5, 2016 at 7:05
  • 4
    You may want to add the -x option which keeps on one file system; there is no need to count the size of /run, /proc/, /sys, or whatever you have on virtual filesystems (or possibly even distinct real filesystem, like the /home partition, even though this OP is not the case). Commented Oct 5, 2016 at 7:48
  • 2
    You should run du -h -d 1 /home/user/.cache | grep '[0-9]\+G' | sort -h to see what's taking up so much space, then figure out if it's okay to clear it. But generally, yes, it's fine to delete your cache. You only put stuff in there if you know it's okay to lose. Commented Oct 5, 2016 at 8:11
  • 1
    On RedHat 6 (maybe other older distros?) the -d option doesn't work, however du --max-depth=1 will work. Commented Oct 5, 2016 at 14:37
  • 1
    Personally I use du -k / | sort -nr - thus showing directories in order of size. I may also pipe it further to head, to show just the top 10 - du -k / | sort -nr | head. If I know where the problem lay (cough /home cough), I may just check that directory du -k /home | sort -nr. I also use for to for example check all home-directories - cd /home : for i in * ; do du -k | sort -nr > /tmp/home-${i}.usage ; done. Commented Oct 5, 2016 at 15:13

Instead of all the manual commands in the other answers, I recommend a tool specifically built for this purpose: ncdu, install with the package manager of your choice.

It only is a small command line utility, so you should be able to install, when you just make a little bit space.

Then, just run

$ ncdu /

to analyze the entire system.

See https://dev.yorhel.nl/ncdu/scr for screenshots: enter image description here

  • 8
    It's hard to install anything if you are 0MB space left ;)
    – Hrvoje T
    Commented Oct 5, 2016 at 12:49
  • 3
    ncdu needs 0.081 MB, that space should be easily obtainable, for example by deleting some files from Chrome's application cache.
    – knub
    Commented Oct 5, 2016 at 15:03
  • @HrvojeT on Archlinux it only needs 40KB to download and 100KB after installation. Commented Oct 5, 2016 at 16:34
  • 2
    @knub You forgot to mention: the best way to run ncdu systemwide is ` $ ncdu / ` Commented Oct 5, 2016 at 16:36

My favorite command for this purpose is

du | sort -nr | head -20

du without options lists all subdirectories and their sizes.
sort sorts by size. n asks for a numerical sort. r reverses the result to largest first.
head -20 limits the output to 20 lines.

By listing directories instead of files, you will find directories that contains a large number of small files.

For sort to work properly we can't use human-readable output, but the largest is the largest even if you can't quite parse its size.

The output for a directory will include its subdirectories, so you will see .cache listed before .cache/chromium (or whatever)

  • Hey thanks! After this command I saw that a .recoll directory which I deleted via Dolphin is still in .local/share/Trash/files/.recoll. Why is this file still there? Is it save to remove everything from `.local/share/Trash/'?
    – Hrvoje T
    Commented Oct 5, 2016 at 12:14
  • Nevermind, I removed it with rm -r
    – Hrvoje T
    Commented Oct 5, 2016 at 12:27
  • 3
    You can sort human-readable sizes using sort -h.
    – benvd
    Commented Oct 5, 2016 at 12:30
  • I used to use du -m | sort -n, to get all sizes in the same units (MB), but sort -h is probably a lot better now that numbers in megabytes are long enough to make your eyes glaze over. There are graphical equivalents, e.g. k4dirstat is quite good. Commented Oct 5, 2016 at 12:49

What is the fastest way via terminal to view my directories and files, biggest first or newest etc?

You can use the command find to display files with their sizes in human readable format :

find / -type f -size +300000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

adjust the +300000k value.

  • 1
    Could you explain this command to me? What does {} and $9 and $5 do? They are placeholders?
    – Hrvoje T
    Commented Nov 13, 2017 at 12:56
  • 1
    @HrvojeT to see the difference , run find / -type f -size +300000k -exec ls -lh {} \; you will get 9 columns , we need just to see the path to file and the size of the file , we use $9 (the clumun that indicate the path) and $5 (column that indicate the size) .
    – GAD3R
    Commented Nov 13, 2017 at 13:11
  • 1
    @HrvojeT To get more info The GNU Awk User’s Guide
    – GAD3R
    Commented Nov 13, 2017 at 13:23

Before running the more time-consuming du -h command suggested by others, have a look at some folders you can clear easily and often contain junk. You might want to du -h in each of them if they contain a lot of files, before the global du -h.

  1. /tmp
  2. /var/tmp; but more careful here before, see this page here on the site about how it differs from /tmp.
  3. /home/your_user_name - your home directory: you may very well have downloaded some large files here and forgotten about them, or built something which pulls/generates a huge amount of data and doesn't delete it etc. Of course, the files here are mostly ones you placed, so you should know what's safe to delete and what isn't.
  4. /opt and /usr/local - not relevant in your specific case, since you indicated you haven't installed anything special, but for other people reading this question - these are typical destinations for installing software that's not part of your Linux distribution. Make sure you actually need that software and are not just keeping it lying around.
  • 1
    If things are installed via the /usr/local path, also running make clean in source directories can reclaim considerable space. Commented Oct 5, 2016 at 10:55

Use du with the -h --max-depth= parameters (settings of 1 to 3 are useful) to drill down on where space is used. If these numbers do not add up, try stopping non-essential services like web servers, log daemons, nfs (or just reboot) - running processes can take space on the filesystem too by keeping an already unlinked file open (often happens with logging services) and check if the space usage decreases.


There is a nice piece of cross-platform freeware called JDiskReport which includes a GUI to explore what's taking up all that space.

Example screenshot:
JDiskReport screenshot

Of course, you'll need to clear up a little bit of space manually before you can download and install it, or download this to a different drive (like a USB thumbdrive).


I think baobab comes standard on Linux Mint. It should let you zero in visually on which directories use the most space.

enter image description here

There is a pretty good chance that a lot of it is browser cache. The visual tool will let you interactively see exactly where most of it is.


You can use standard tools like find and sort to analyze your disk space usage.

List directories sorted by their size:

find / -mount -type d -exec du -s "{}" \; | sort -n

List files sorted by their size:

find / -mount -printf "%k\t%p\n" | sort -n

I'm late to the party. It seems like everybody has their own favorite version of du | sort with different flags.

I've always found it easy to remember "ducks":

du -cks * | sort -rn | head -11

From the du manpage:

   -c, --total
          produce a grand total

   -k     like --block-size=1K

   -s, --summarize
          display only a total for each argument

I got the tip from the book "Linux Server Hacks: 100 Industrial-Strength Tips and Tools" by Rob Flickenger (O'Reilly, 2003).

In Hack #15 (Playing Hunt the Disk Hog), the author recommends adding this one-liner to your .profile:

alias ducks='du -cks |sort -rn |head -11'

In practice, though, I generally don't get around to aliasing the command because I've used it so many times that I have memorized it.

  • I agree. It's better for a beginner not to use aliases. Could you explain what cks does? Is it in MB or?
    – Hrvoje T
    Commented Oct 6, 2016 at 5:51
  • I added the info (from man du) to my answer above -- but honestly, what it really does for me is serve as a mnemonic device to help me remember the command! ;)
    – Matt Obert
    Commented Oct 6, 2016 at 10:45

I think the below command will show u the detailed info motion

cd /

du -hs * | sort -n

Not the answer you're looking for? Browse other questions tagged .