How do you find the top space consuming directories and files?

How do you find the top space consuming directories and files?

Find Top 10 Space Consuming Directories and Files

  1. du -h : Display sizes in human readable format.
  2. du -s : Show total for each argument.
  3. du -x : Skip directoried on different file system.
  4. sort -r : Reverse the result of comparisons.
  5. sort -h : Compare human readable numbers.
  6. head -10 : Display the first 10 lines.

How do I find the largest files in a folder in Unix?

Type du -a /dir/ | sort -n -r | head -n 20. du will estimate file space usage. sort will sort out the output of du command. head will only show top 20 largest file in /dir/

How to find the largest file in a directory?

Linux find largest file in directory recursively using find. The procedure to find largest files including directories in Linux is as follows: Open the terminal application; Login as root user using the sudo -i command; Type du -a /dir/ | sort -n -r | head -n 20; du will estimate file space usage; sort will sort out the output of du command

How to find size of directory with du command in Linux?

Brief: The du command in Linux is used for checking the size of directory. Here are various ways you can find the size of directory in Linux with the du command. Knowing the size of a file is easy in Linux. All you have to do is to use the -l and -h option with the ls command…

How to find the top 10 files in Linux?

du command : Estimate file space usage. sort command : Sort lines of text files or given input data. head command : Output the first part of files i.e. to display first 10 largest file.

How big is a directory in ls command?

A directory is essentially a file that has the information about all the location of all the files it ‘contains’. So, when you use the ls command, it treats the directory as a file and shows its size which is one memory block and thus the size displayed is 4KB.