Tag Info

Hot answers tagged


Don't go straight to du /. Use df to find the partition that's hurting you, and then try du commands. One I like to try is du -h <dir> | grep '[0-9\.]\+G' because it prints sizes in "human readable form". Unless you've got really small partitions, grepping for directories in the gigabytes is a pretty good filter for what you want. This will ...


Adding up numbers is easy. The problem is, there are many different numbers to add. How much disk space does a file use? The basic idea is that a file containing n bytes uses n bytes of disk space, plus a bit for some control information: the file's metadata (permissions, timestamps, etc.), and a bit of overhead for the information that the system needs to ...


If you have GNU coreutils (common in most Linux distributions), you can use du -sh * | sort -h. The -h option tells sort that the input is the human-readable format (number with unit). This feature was added to GNU Core Utilities 7.5 in Aug 2009.


du can be depth-restricted: du -d 5 Will only recurse to depth 5. /EDIT: This counts only for the display; the tool will still determine the total size of the whole directory tree but this is still much faster than running a full du.


Saving space for important root processes (and possible rescue actions) is one reason. But there's another. Ext3 is pretty good at avoiding filesystem fragmentation, but once you get above about 95% full, that behavior falls off the cliff, and suddenly filesystem performance becomes a mess. So leaving 5% reserved gives you a buffer against this. Ext4 ...


check with lsof if there are files held open, space will not be freed until they are closed sudo /usr/sbin/lsof | grep deleted will tell you which deleted files are still held open


If you can't kill your application, you can truncate instead of deleting the log file to reclaim the space. If the file was not open in append mode (with O_APPEND), then the file will appear as big as before the next time the application writes to it (though with the leading part sparse and looking as if it contained NUL bytes), but the space will have been ...


The block size of the file system must be 4 kB. When data is written to a file that is contained in a file system the operating system must allocate blocks of storage to contain the data that will be written to the file. Typically, when a file system is created the storage contained in that file system is segmented into blocks of a fixed size. This ...


If you want a command-line tool, I prefer ncdu, an ncurses version of du. It scans the disk (or a given folder) and then shows the top-level space usages; you can select a given directory to get the corresponding summary for that directory, and go back without needing to reanalyze: If you're ok with a GUI program, Filelight is the closest thing to ...


du == Disk Usage. It walks through directory tree and counts the sum size of all files therein. It may not output exact information due to the possibility of unreadable files, hardlinks in directory tree, etc. It will show information about the specific directory requested. Think, "How much disk space is being used by these files?" df == Disk Free. Looks at ...


Symbolic links do take room, of course, but just the room it takes to store the name and target plus a few bytes for other metadata. The space taken by a symbolic link does not depend on the space taken by the target (after all, the target is not even required to exist). Plain du reports the space taken by a directory tree on the disk. du -L reports the ...


Based on your issues in installing ncdu my recommendation would be to use du and sort on together. For instance: du /home | sort -rn (will search all files/directories under /home and sort them by largest to smallest. du -h /home | sort -rh (same but will show it in MB/KB/etc) - Note this requires coreutils 7.5 or newer (sort --version to check) You can ...


You can also run the following command using du : ~# du -Pshx /* 2>/dev/null The -s option makes a summerize. h prints Mio, Gio, etc. x = stay in one filesystem (very useful). P = don't follow symlinks (which could cause files to be counted twice for instance). Be careful, the /root directory will not be shown, you have to run ~# du -Pshx /root ...


Take a look at ionice. From man ionice: This program sets or gets the io scheduling class and priority for a program. If no arguments or just -p is given, ionice will query the current io scheduling class and priority for that process. To run du with the "idle" I/O class, which is the lowest priority available, you can do something like this: ionice ...


du -sh is a good place to start. The options are (from man du): -s, --summarize display only a total for each argument -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G) To check more than one directory and see the total, use du -sch: -c, --total produce a grand total


If you allow others to log on to your system, via ssh, for example, having these 5% blocks reserved ensures external users cannot fill the disk. Even if you don't allow others to log in to your system, the reserved blocks prevents programs not running as root from filling your disk.


find -maxdepth 1 -type d | while read -r dir; do printf "%s:\t" "$dir"; find "$dir" -type f | wc -l; done Thanks to Gilles and xenoterracide for safety/compatability fixes. The first part: find -maxdepth 1 -type d will return a list of all directories in the current working directory. This is piped to... The second part: while read -r dir; do begins a ...


Try using the -k flag to count 1K blocks intead of using human-readable. Then, you have a common unit and can easily do a numeric sort. du -ck | sort -n You don't explictly require human units, but if you did, then there are a bunch of ways to do it. Many seem to use the 1K block technique above, and then make a second call to du. ...


Try: find / -xdev -type f -size +100M It lists all files that has size bigger than 100M. If you want to know about directory, you can try ncdu. If you aren't running Linux, you may need to use -size +204800 or -size +104857600c, as the M suffix to mean megabytes isn't in POSIX. find / -xdev -type f -size +102400000c


The --inodes option to df will tell you how many inodes are reserved for use. For example: $ df --inodes / /home Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sda1 3981312 641704 3339608 17% / /dev/sda8 30588928 332207 30256721 2% /home $ sudo find / -xdev -print | wc -l 642070 $ sudo find /home -print | wc ...


You've almost found it :) du -ch --exclude=./relative/path/to/uploads Note no asterisk at the end. The asterisk means all subdirectories under "upload" should be omitted - but not the files directly in that directory.


Easiest is to run wajig large. The package should be an apt-install-away. Here's two links for other ways of doing it: List your largest installed packages (on Debian/Ubuntu) LIst all installed packages in size order Also remember that the installed size is just part of the space taken up by packages. The compressed version is probably still in the ...


Try doing this : du -s dir or du -sh dir needs -h support, depends of your OS. See man du


I usually use the -exec utility. Like this: find . -type f -exec du -a {} + I tried it both on bash and ksh with GNU find. I never tried AIX, but I'm sure your version of find has some -exec syntax. The following snippet sorts the list, largest first: find . -type f -exec du -a {} + | sort -n -r | less


It will happen if you have sparse files: $ mkdir test; cd test $ truncate -s 1000000000 file-with-zeroes $ ls -l total 0 -rw-r--r-- 1 gim gim 1000000000 03-08 22:18 file-with-zeroes A sparse file is a file which has not been populated with filesystem blocks (or only partially). When you read a non-populated zone of a sparse file you will obtain zeros. ...


Most probably this is ext2, ext3 or ext4 file system which reserve a few percent of disk space (by default 5%) to be used only by specified users (usually root). If you create file system with mke2fs then -m option is what you are looking for: -m reserved-blocks-percentage Specify the percentage of the filesystem blocks reserved for the ...


tar -c data_dir | wc -c without compression or tar -cz data_dir | wc -c with gzip compression or tar -cj data_dir | wc -c with bzip2 compression will print the size of the archive that would be created in bytes, without writing to disk. You can then compare that to the amount of free space on your target device. You can check the size of the data ...


The easiest way (without installing extra packages) is: dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n which displays packages in size order, largest package last.


Try this for "diskfree": df -h The "-h" option makes the output "human-readable".

Only top voted, non community-wiki answers of a minimum length are eligible