Home > Operation and Maintenance > Linux Operation and Maintenance > How to check the hard disk size in Linux system

How to check the hard disk size in Linux system

清浅
Release: 2022-01-12 15:00:37
Original
117973 people have browsed it

How to check the hard disk size under Linux system: First open the terminal in the Linux system; then enter the "df -h" command in the terminal to check the hard disk size and get how much space is occupied by the hard disk. Currently, How much space is left and other information.

How to check the hard disk size in Linux system

[Recommended course: Linux Tutorial]

Commands to view hard disk size

df -h
Copy after login

The df command can obtain information such as how much space is occupied by the hard disk, how much space is currently left, etc. It can also display all file systems Usage of inodes and disk blocks.

The Df command is a Linux system that views the file system in units of disk partitions. You can add parameters to view the remaining disk space information. The command format is: df -hl

The display format is:

  • ##Filesystem Size Used Available Use% Mounted on

  • ##Filesystem Size Used Available Use% Mounted on
  • /dev/hda2 45G 19G 24G 44% /
  • /dev/hda1 494M 19M 450M 4% /boot
  • #/dev/hda6 4.9G 2.2G 2.5G 47% /home
  • /dev/hda5 9.7G 2.9G 6.4G 31% /opt
  • none 1009M 0 1009M 0% /dev/shm
  • ##/dev/hda3 9.7G 7.2G 2.1G 78% /usr/local
  • /dev/hdb2 75G 75G 0 100% /
  • ##/dev/hdb2 75G 75G 0 100% /

  • or above Take the output above as an example. It means:

  • The second hard disk (b) of the HD hard disk interface, the second partition (2), the capacity is 75G, 75G is used, and the available value is 0, so The utilization rate is 100% and it is mounted on the root partition directory (/).

Explanation of related commands

df -hl 查看磁盘剩余空间
df -h 查看每个根路径的分区大小
du -sh [目录名] 返回该目录的大小
du -sm [文件夹] 返回该文件夹总M数
du -h [目录名] 查看指定文件夹下的所有文件大小(包含子文件夹)
Copy after login

For more functions, you can enter the command to view:

df --help
du --help
Copy after login
Other functions


View hard disk partitions#sudo fdisk -l

  • View IDE hard disk information#sudo hdparm -i /dev/hda


  • View STAT hard disk information #sudo hdparm -I /dev/sda or #sudo apt-get install blktool #sudo blktool /dev/sda id

  • Check the remaining space on the hard disk#df -h #df -H

  • Check the space occupied by the directory#du -hs directory name

  • The USB flash drive is not there How to uninstall #sync fuser -km /media/usbdisk

  • Summary: The above is the entire content of this article, I hope it will be helpful to everyone.

The above is the detailed content of How to check the hard disk size in Linux system. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template