How to check disk usage in Linux

How to check disk usage in Linux

1. Use the df command to view the overall disk usage

The df command is used to view the mount point of the hard disk and the corresponding hard disk capacity information. Including the total size of the hard disk, the size already used, and the remaining size. And the percentage of space used, etc.

The most commonly used command format is:

df -h

Or use:

df -lh

Output:

Filesystem refers to the hardware device files on the system, and Size refers to the total size of the hard disk or partition. Used indicates the size that has been used, and Avail indicates the size that can be used. Use% indicates the percentage of used space. The final "mounted on" indicates the directory where the hard disk is mounted.

Description: Parameters that can be added after the df command

● -a: List all file systems, including system-specific file systems such as /proc

● -k: Display the capacity of each file system in KB

● -m: Display the capacity of each file system in MB

● -h: Display in GB, MB, KB format which is easier for people to read

● -H: Replace M=1024K with M=1000K

● -T: Display the file system type

● -i: Display the number of inodes instead of the hard disk capacity

● -l: only display the file system of the local machine

2. Use the du command to view the usage of the specified directory

Use the du command to view the directory or file information inside the hard disk. The du command usually needs to be executed with parameters at the end. The general format is:

du option File/directory

For example, if I want to check the capacity of the python3 directory in the current directory, the command is:

du -sh python3

The result is shown in the figure below. You can intuitively see that the size of this directory is 206M. If there is no file name or directory name behind it, the size of the current directory will be displayed.

You may also be interested in:
  • Linux view disk space size command

<<:  CocosCreator ScrollView optimization series: frame loading

>>:  Solution to the problem that the MySQL database cannot be accessed by other IP addresses

Recommend

Detailed process of using Vscode combined with docker for development

Preface Using Docker and VS Code can optimize the...

How to implement one-click deployment of nfs in linux

Server Information Management server: m01 172.16....

How to build a MySQL high-availability and high-performance cluster

Table of contents What is MySQL NDB Cluster Preli...

Detailed explanation of Nginx status monitoring and log analysis

1. Nginx status monitoring Nginx provides a built...

CSS shadow animation optimization tips

This technique comes from this article - How to a...

Detailed explanation of dynamically generated tables using javascript

*Create a page: two input boxes and a button *Cod...

How to configure user role permissions in Jenkins

Jenkins configuration of user role permissions re...

Vue3 based on script setup syntax $refs usage

Table of contents 1. Vue2 syntax 2. Use of Vue3 1...

Do you know how to use the flash wmode attribute in web pages?

When doing web development, you may encounter the...

In-depth analysis of JDBC and MySQL temporary tablespace

background Temporary tablespaces are used to mana...

MySQL 5.7.27 installation and configuration method graphic tutorial

MySQL 5.7.27 detailed download, installation and ...

MySQL 8.0.15 winx64 installation and configuration method graphic tutorial

This article shares the installation and configur...

How to configure Java environment variables in Linux system

Configure Java environment variables Here, the en...