Check File Sizes of Current Folder Items on Linux

If you need to find out which folders or files are taking up the most space in your current directory, du (disk usage) is the go-to tool.

List All Items in Current Directory

This command shows the size of each folder and file one level deep in a human-readable format (KB, MB, GB):

du -h --max-depth=1 .
Code language: Bash (bash)

Alternative: Sort by Size

If you want to see the largest items at the bottom of the list, you can pipe the output to the sort command:

du -h --max-depth=1 . | sort -h
Code language: Bash (bash)

Summary of Flags

  • -h: (Human-readable) Prints sizes in MB or GB instead of raw bytes.
  • --max-depth=1: Prevents the command from listing every single sub-file, keeping the output clean.
  • .: Refers to the current directory.

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.