sammlinux sammlinux
  • Ubuntu
    UbuntuShow More
    How To Install and Use Docker CE on Ubuntu 22.04
    26 Min Read
    How To Install and Secure phpMyAdmin on Ubuntu 22.04
    5 Min Read
    How To Secure SSH with Fail2Ban on Ubuntu 22.04
    8 Min Read
    How To Install Uptime Kuma on Ubuntu 22.04
    17 Min Read
    How To Install Ubuntu Server 22.04 LTS with Screenshots
    14 Min Read
  • Rocky Linux
    Rocky LinuxShow More
    How To Install phpMyAdmin on Rocky Linux 9
    15 Min Read
    How To Secure SSH with Fail2Ban on Rocky Linux 9
    12 Min Read
    How To Install Rocky Linux 9.2 Server with Screenshots
    12 Min Read
    How To Set Up a Firewall Using FirewallD on Rocky Linux 9
    8 Min Read
    How To Install Nginx on Rocky Linux 9: A Comprehensive Guide
    10 Min Read
  • Debian
    DebianShow More
    How To Secure SSH with Fail2Ban on Debian 11
    8 Min Read
    How To Install Debian 11 (Bullseye) Server with Pictures
    12 Min Read
    How To Install and Setup Node.js on Debian 11
    6 Min Read
    How To Install PHP 8.2 on Debian 11
    12 Min Read
    How To Install Nginx on Debian 11: A Comprehensive Guide
    9 Min Read
  • Linux
    LinuxShow More
    Best Practices Linux Server Security for System Administrator
    8 Min Read
    A Simple Guide: How To Manage Groups on Linux
    5 Min Read
    How To Manage Log Files Using Logrotate In Linux
    7 Min Read
    The Easy Ways to Check File Size in Linux
    7 Min Read
    How To Backup Files From Remote Linux VPS Using Rsync Script
    12 Min Read
  • CentOS
    CentOSShow More
    How To Secure SSH with Fail2Ban on CentOS 7
    9 Min Read
    How To Install PHP 8.2 on CentOS 7 / RHEL 7
    18 Min Read
    How To Install Apache Web Server on CentOS 7
    11 Min Read
    How To Set Up a Firewall Using FirewallD on CentOS 7
    5 Min Read
    Initial Setup CentOS 7 Server: Secure and Efficient
    9 Min Read
  • DevOps
    DevOpsShow More
    How To Create AWS CloudFront: A Step-by-Step Guide
    10 Min Read
Reading: The Easy Ways to Check File Size in Linux
Share
Font ResizerAa
Linux for BeginnersLinux for Beginners
  • Ubuntu
  • Rocky Linux
  • Debian
  • Linux
  • CentOS
  • DevOps
Search
  • Ubuntu
  • Rocky Linux
  • Debian
  • Linux
  • CentOS
  • DevOps
Follow US
Copyright © 2014-2023 Ruby Theme Ltd. All Rights Reserved.

The Easy Ways to Check File Size in Linux

Samuel Siahaan
By Samuel Siahaan
Last updated: November 9, 2023
SHARE

When it comes to navigating the intricate landscape of Linux, one of the fundamental skills is managing file sizes efficiently. Whether you’re a seasoned Linux user or a novice exploring the open-source world, understanding how to check file sizes or Linux disk usage is crucial. In this guide, we’ll walk you through various commands methods The Easy Ways to Check File Size in Linux.

Contents
Table of ContentsIntroductionMethod 1: Using the ls CommandMethod 2: Employing the du CommandMethod 3: Analyzing Total Disk Usage with dfMethod 4: Utilizing the stat CommandRecap: Reviewing Our MethodsConclusion

Table of Contents

  • Introduction
    • Method 1: Using the ls Command
    • Method 2: Employing the du Command
    • Method 3: Analyzing Total Disk Usage with df
    • Method 4: Utilizing the stat Command
    • Recap: Reviewing Our Methods
  • Conclusion

Introduction

To embark on this Linux adventure, let’s start by introducing The Easy Ways to check file size in Linux or Linux disk usage. Throughout this article, we’ll explore key methods and provide step-by-step instructions using familiar language to ensure you grasp the concepts effortlessly.

In Linux, you have several options to check file sizes: you can utilize the du, ls, stat, or find commands.

  • The du command provides space usage information for specific files or directories on your system.
  • With the ls command, you can view details about files, including their sizes.
  • The stat command offers in-depth information about a file, such as its size.
  • Additionally, the find command assists you in locating files based on their sizes.

In Linux, everything is regarded as a file. This classification encompasses not only text files, images, and compiled programs but also partitions, hardware device drivers, and directories.

- Advertisement -

The following Linux commands can be used to check file size.

CommandFunctionality
du -h filenamecheck size of the specified file
du -sh dircheck size of the specified directory including its sub directory
ls -lh filenamecheck size of the specified file
ls -lh *check size of all the files in the current directory
ls -alh *check size of all the files including hidden files in the current directory
ls -alh dir/check size of all the files including hidden files in the ‘dir’ directory

Method 1: Using the ls Command

Firstly, let’s delve into the widely used ‘ls’ command. This command not only lists files but also displays their sizes. To execute this command, open your terminal and type:

ls -l

This command will list files along with their sizes in a human-readable format. The ‘-l’ option stands for ‘long listing,’ providing detailed information about each file.

Now that we’ve covered the basic ‘ls’ command, let’s explore a more detailed method.

Method 2: Employing the du Command

For a more comprehensive approach, the ‘du’ (disk usage) command is your go-to tool. This command not only displays the file size but also calculates the disk space used by a file or directory. To use ‘du,’ enter the following in your terminal:

- Advertisement -
du -h filename

Here, the ‘-h’ option stands for ‘human-readable,’ providing file sizes in a more readable format. The du command provides a summary of disk usage for each file and recursively for every directory. It offers various helpful options, either individually or in the right combinations.

Moving on from individual file sizes, let’s discuss how to analyze sizes collectively.

Method 3: Analyzing Total Disk Usage with df

To get an overview of your system’s disk space, the ‘df’ command comes in handy. It displays information about disk space usage, including total, used, and available space. Execute the following command:

- Advertisement -
df -h

The ‘-h’ option here also ensures human-readable sizes, making it easier to understand the disk space distribution.

Now, let’s shift our focus to a more specialized method for checking file sizes.

Method 4: Utilizing the stat Command

For detailed information about a file, including its size, permissions, and modification dates, the ‘stat’ command is invaluable. Execute the following command:

stat filename

This command provides a wealth of information in a structured format, allowing you to pinpoint specific details about a file.

As we explore the ‘stat’ command, let’s recap the methods we’ve covered so far.

Recap: Reviewing Our Methods

In this guide, we’ve covered four distinct methods for checking file sizes in Linux: ‘ls’ for a quick overview, ‘du’ for disk usage analysis, ‘df’ for system-wide disk space details, and ‘stat’ for comprehensive file information.

Now that you’ve mastered these methods, let’s address some additional tips and considerations.

Additional Tips and Considerations

  • Wildcards for Multiple Files:
    If you want to check the sizes of multiple files simultaneously, you can use wildcards. For example:
   du -h *.txt

This command will display the sizes of all text files in the current directory.

As we wrap up, let’s summarize the key takeaways from our exploration.

Conclusion

In this comprehensive guide, we’ve navigated through various methods to check file sizes in Linux. From the basic ‘ls’ command to the detailed ‘stat’ command, you now have a toolkit to efficiently manage and analyze file sizes on your Linux system.

Also Read Our Other Guides :

  • How To Find Hard Disk Drive Information in Linux
  • How To Use Rsync to Sync Local and Remote Directories in Linux
  • How To Get Total Inodes and Increase Disk Inode Number in Linux
  • How To Backup Files From Remote Linux VPS Using Rsync Script

Finally, now you have a few commands The Easy Ways to Check File Size in Linux.

TAGGED:Check FIleFile SizeFind FileLinux

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article How To Backup Files From Remote Linux VPS Using Rsync Script
Next Article How To Manage Log Files Using Logrotate In Linux
Leave a Comment

Leave a Reply Cancel reply

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

How To Install and Secure phpMyAdmin on Ubuntu 22.04
Ubuntu
Install and Configure Docker Swarm Mode on Centos 7
CentOS
How To Install and Config Thumbor on Debian 10
Debian
How To Install MariaDB 10.6 on Debian 11 Server
Debian
How To Install MongoDB 6.0 on Debian 10 & 11
Debian

You Might Also Like

Linux

Best Practices Linux Server Security for System Administrator

8 Min Read
Linux

How To Manage Log Files Using Logrotate In Linux

7 Min Read
Linux

How To Create and Use Swap File on Linux System

9 Min Read
Linux

A Simple Guide: How To Manage Groups on Linux

5 Min Read
Linux

How To Install and Use Linux Screen with Commands

9 Min Read
Linux

How To Use Rsync to Sync Local and Remote Directories in Linux

8 Min Read
Linux

How To Configure SSH Key-based Authentication In Linux

7 Min Read
Debian

Initial Setup Debian 11 Server: Secure and Efficient

17 Min Read
Show More

Always Stay Up to Date

Subscribe to our newsletter to get our newest articles instantly!

sammlinux sammlinux

Providing beginner-friendly Linux tutorials and open-source guides to simplify your digital infrastructure.

www.sammlinux.com © 2026 | All Rights Reserved

Join Us!
Subscribe to our newsletter and never miss our latest news, podcasts etc.

Subscribe to our newsletter to get our newest articles instantly!

Zero spam, Unsubscribe at any time.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?