Skip to main content
Corrects wording
Source Link
kenorb
  • 22.1k
  • 18
  • 149
  • 172

The following command not only find you the top 50 largest files (>100M) on your filesystem, but also sort (GNU sort) by the biggest:

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

-xdev Don't descend directories on other filesystems.

On BSD find use -x which is equivalent to the deprecated -xdev primary.

For all files and directories, it's even easier:

du -ahx / | sort -rh | head -20

(the -x flag is what's required to constrain du to a single filesystem)

If you're not using GNU sort (from coreutils), use it without -h:

du -ax / | sort -rn | head -20

For currentlycurrent directory only (for quicker results), replace / with ..

The following command not only find you the top 50 largest files (>100M) on your filesystem, but also sort (GNU sort) by the biggest:

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

-xdev Don't descend directories on other filesystems.

On BSD find use -x which is equivalent to the deprecated -xdev primary.

For all files and directories, it's even easier:

du -ahx / | sort -rh | head -20

(the -x flag is what's required to constrain du to a single filesystem)

If you're not using GNU sort (from coreutils), use it without -h:

du -ax / | sort -rn | head -20

For currently directory only (for quicker results), replace / with ..

The following command not only find you the top 50 largest files (>100M) on your filesystem, but also sort (GNU sort) by the biggest:

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

-xdev Don't descend directories on other filesystems.

On BSD find use -x which is equivalent to the deprecated -xdev primary.

For all files and directories, it's even easier:

du -ahx / | sort -rh | head -20

(the -x flag is what's required to constrain du to a single filesystem)

If you're not using GNU sort (from coreutils), use it without -h:

du -ax / | sort -rn | head -20

For current directory only (for quicker results), replace / with ..

The following command not only find you the top 50 largest files (>100M) on your filesystem, but also sort (GNU sort) by the biggest:

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

-xdev Don't descend directories on other filesystems.

On BSD find use -x which is equivalent to the deprecated -xdev primary.

For all files and directories, it's even easier:

du -ahahx / | sort -rh | head -20

(the -x flag is what's required to constrain du to a single filesystem)

If you're not using GNU sort (from coreutils), use it without -h:

du -aax / | sort -rn | head -20

For currently directory only (for quicker results), replace / with ..

The following command not only find you the top 50 largest files (>100M) on your filesystem, but also sort (GNU sort) by the biggest:

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

-xdev Don't descend directories on other filesystems.

On BSD find use -x which is equivalent to the deprecated -xdev primary.

For all files and directories, it's even easier:

du -ah / | sort -rh | head -20

If you're not using GNU sort (from coreutils), use it without -h:

du -a / | sort -rn | head -20

For currently directory only (for quicker results), replace / with ..

The following command not only find you the top 50 largest files (>100M) on your filesystem, but also sort (GNU sort) by the biggest:

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

-xdev Don't descend directories on other filesystems.

On BSD find use -x which is equivalent to the deprecated -xdev primary.

For all files and directories, it's even easier:

du -ahx / | sort -rh | head -20

(the -x flag is what's required to constrain du to a single filesystem)

If you're not using GNU sort (from coreutils), use it without -h:

du -ax / | sort -rn | head -20

For currently directory only (for quicker results), replace / with ..

Added -x as per comment.
Source Link
kenorb
  • 22.1k
  • 18
  • 149
  • 172

The following command not only find you the top 50 largest files (>100M) on your filesystem, but also sort (GNU sort) by the biggest:

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

-xdev Don't descend directories on other filesystems.

On BSD find use -x which is equivalent to the deprecated -xdev primary.

For all files and directories, it's even easier:

du -ah / | sort -rh | head -20

If you're not using GNU sort (from coreutils), use it without -h:

du -a / | sort -rn | head -20

For currently directory only (for quicker results), replace / with ..

The following command not only find you the top 50 largest files (>100M) on your filesystem, but also sort (GNU sort) by the biggest:

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

For all files and directories, it's even easier:

du -ah / | sort -rh | head -20

If you're not using GNU sort (from coreutils), use it without -h:

du -a / | sort -rn | head -20

For currently directory only (for quicker results), replace / with ..

The following command not only find you the top 50 largest files (>100M) on your filesystem, but also sort (GNU sort) by the biggest:

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

-xdev Don't descend directories on other filesystems.

On BSD find use -x which is equivalent to the deprecated -xdev primary.

For all files and directories, it's even easier:

du -ah / | sort -rh | head -20

If you're not using GNU sort (from coreutils), use it without -h:

du -a / | sort -rn | head -20

For currently directory only (for quicker results), replace / with ..

Source Link
kenorb
  • 22.1k
  • 18
  • 149
  • 172
Loading