Check hard disk usage in linux (check disk usage in linux)

WBOY
Release: 2024-02-12 18:18:16
forward
1020 people have browsed it

Check hard disk usage in linux (check disk usage in linux)

In Linux systems, you can use the following command to check the hard disk space usage:

1. df -h: Check the space usage of the entire disk.

bashdf -h
Copy after login

The output result is similar to:

Filesystem      Size  Used Avail Use% Mounted on/dev/sda2        20G  2.8G   17G  15% //dev/sda1       477M   61M  416M  13% /boot/dev/sda3       905G  116G  744G  13% /home 
Copy after login

The meaning of each column is:

– Filesystem: Partition name
– Size: Total partition space
– Used: Already Used space
– Avail: Available space
– Use%: Used percentage
– Mounted on: Mount point

2. du -sh: View the disk space occupied by the specified directory.

For example, to view the space usage of the /home directory:

bash du -sh /home
Copy after login

3. du -h –max-depth=1 /home: View the space occupied by each subdirectory under /home, only one layer is counted subdirectory.

bashdu -h --max-depth=1 /home 
Copy after login

4. du -sh *: View the space occupied by each file and subdirectory in the current directory.

bashdu -sh *
Copy after login

5. ncdu: A simple CLI disk space usage analysis tool. Visualization shows the space occupied by each subdirectory, and can be interactively analyzed in more detail.

Installation method:

bashsudo apt install ncdu     # Ubuntusudo yum install ncdu     # CentOS
Copy after login

Usage method:

bashncdu /home  # 分析/home目录空间使用
Copy after login

Summary:

This article introduces several commonly used disk space analysis methods and commands in Linux. Including:

– df -h: View the space usage of the entire disk
– du -sh: View the disk space occupied by the specified directory
– du -h –max-depth=1 /home : Check the space occupied by each subdirectory under /home, only one level is counted
– du -sh *: Check the space occupied by each file and subdirectory under the current directory
– ncdu: A simple CLI disk space usage analysis tool

The above is the detailed content of Check hard disk usage in linux (check disk usage in linux). For more information, please follow other related articles on the PHP Chinese website!

source:jingfakeji.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template