Quantcast
Channel: linux
Viewing all articles
Browse latest Browse all 81

How to show the largest files under a directory on Mac OS X (Unix)

$
0
0
How to show the largest files under a directory on Mac OS X (Unix)alvinDecember 23, 2017 - 1:00pm

Here’s an example that shows how to find the largest files under a directory on MacOS and Linux/Unix systems.

A du/sort command to show the largest files under a directory on Mac OS X

The Unix/Linux command that worked for me on my MacOS system is this:

$ du -a * | sort -r -n | head -10

du is the disk usage command, and the -a flag says, “Display an entry for each file in a file hierarchy.” Then I use the sort command to sort the du output numerically and in reverse. After that, head -10 shows only the first ten lines of output. In the Music folder on my Mac the command and output look like this:


Viewing all articles
Browse latest Browse all 81

Latest Images

Trending Articles



Latest Images