Find large files Linux

If your hard drive run out of space, the easiest way to free him is to find and remove the large and unnecessary files. Such a problem may occur on the server or on your home computer, so there are easy solutions for both situations. Ways to find large files, there are many.

As you know, in this small tutorial we will look at how to find large files Linux using GUI or console utilities. We will move from the simple to the more complex.

  • Find large files Linux
    • 1. GDMap
    • 2. Ncdu utility
    • 3. Utility du
    • 4. Utility find
  • Insights

Find large files Linux

1. GDMap

Despite the fact that the graphical tools there are about a dozen, all of them I do not really like. For example in Gnome you can use GDMap and KDE – fileslight. Both utilities scan the file system and display all files in the graph. The block size depends on the size of the file. The more a file or folder, the more the unit. To install GDMap in Ubuntu, run:

sudo apt install gdmap

Then run the utility from the main menu. By default it displays the home folder. Here you can evaluate which files are the most weighty.

2. Ncdu utility

This menu-based utility that works in Linux terminal. It displays a list of files and directories by volume, and most interesting, it also allows you to delete unnecessary files. To install the utility, run:

sudo apt install ncdu

Then run the tool, passing it as a parameter to the folder you need to scan. You can check the same home directory:

ncdu /home

Utility has very simple controls. To move through the list use the arrow buttons up and down to open a folder, press Enterand remove file button d. You can also use this to move a button in Vim – style h, j, k, l.

3. Utility du

If you are not able to install new tools can help installed by default in all distributions, the utility du. Using following command you can display 20 largest files and folders in the correct folder, for example again take home folder:

sudo du -a /home/ | sort -n-r | head -n 20

We can’t use the option -h to display size in human readable format, because then it will not work sorting.

4. Utility find

With the command find you can also search for large files on Linux. To do this, use the option -size. For example, let’s find files that are more than 500 megabytes in the same home folder:

sudo find /home-xdev -type f-size +500M

You can go even further – to bring the size of these files and sort them by size:

find / -xdev -type f-size +100M-exec du -sh {} ';' | sort -rh

The largest files Linux will be on top and smaller below.

Insights

In this small article we have understood how to manually search for large Linux files. Once you have found them, need to choose junk and deleted, if this happens on the server, usually it’s a log of the various services or cache. Please note that after deleting files in the file system may not be available. To fully reclaim space is to restart your computer. It’s a pretty common problem on the servers and VPS.

Source: losst.ru

(Visited 4 times, 1 visits today)