


Linux command manual view (linux view hard disk usage command)
php editor Xiaoxin introduces to you the command to check the hard disk usage in the Linux operating system. In Linux systems, we often need to understand the usage of hard disks in order to reasonably manage storage space. Fortunately, Linux provides some convenient and practical commands to check hard disk usage. Through these commands, you can easily understand the total capacity, used capacity, available capacity and other information of the hard disk, so that you can clean up and manage the space in a timely manner. Next, let's learn about these commands.
df comes from the coreutils software package and comes with it when the system is installed; we can use this command to check the disk usage and the location where the file system is mounted;
[root@localhost ~ ]# df -l
File system capacity used available used% mount point
/dev/sda3 4956316 3565088 1135396 76% /
tmpfs 241320 12 241308 1% /dev/shm
/ dev/sda6 4806904 2523708 2039012 56% /media/disk
/dev/sda1 4956284 3529796 1170656 76% /media/_
/dev/sda5 4845056 2581484 2019388 57% /media/disk-1
You can see that the system is hung on sda3, and there are also three systems hanging on sda6/sda1/sda5.
2. fdisk -l command
fdisk is a powerful disk operation tool from the util-linux software package. Here we only talk about how to view the disk partition table and partition structure; Through the -l parameter, you can obtain the partition status of all hard disks in the machine;
[root@localhost ~]# fdisk -l
Disk /dev/sda: 40.0 GB, 40000000000 bytes
255 heads, 63 sectors/track, 4863 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x62a9f8d0
Device Boot Start End Blocks Id System
/dev/sda1 * 1 637 5116671 83 Linux
/dev/sda2 638 891 2040255 82 Linux swap / Solaris
/dev/sda3 892 1528 5116702 83 Linux
/dev/sda4 1529 2744 9767520 5 Extended
/dev/ sda5 1529 2136 4883728 83 Linux
/dev/sda6 2137 2744 4883728 83 Linux
sda1 is the partition where the MBR (Master Boot Record) is located, sda2 is the swap partition, and sda4 is the extended partition, including sda5 and sda6 two logical partitions. When the system is divided into partitions, it can only be divided into four primary partitions (extended partitions are also considered primary partitions). In my setup, I divided 3 primary partitions and 1 extended partition, so numbers like sda1.2.3.4.5.6 appeared. If only one primary partition and one extended partition are divided, then the logical partition will start from sda5, followed by sda5.6.7...
3. cfdisk -Ps command (note that P is capitalized)
cfdisk is also a good partitioning tool; in some distributions, this tool has been removed from the util-linux package; cfdisk is simple and easy to use;
View the usage of disk partitions cfdisk -Ps disk device name You can also use cfdisk -Ps
if you have only one hard disk. Example 1: [root@localhost ~]# cfdisk -Ps
Partition Table for /dev/sda
First Last
# Type Sector Sector Offset Length Filesystem Type (ID) Flag
— ——- ————– ————– —— ————– ——————– ——————-
1 Primary 0 10233404 63 10233405 Linux (83) Boot
2 Primary 10233405 14313914 0 4080510 Linux swap / So (82) None
3 Primary 14313915 24547319 0 10233405 Linux (83) None
4 Primary 24547320 44082359 0 19535040 Extended ( 05) None
5 Logical 24547320 34314839 63 9767520 Linux (83) None
6 Logical 34314840 44082359 63 9767520 Linux (83) None
Logical 44082360 78124094 0 34041735 Free Space None
Example 2 :[root@localhost ~]# cfdisk -Ps /dev/sda
Partition Table for /dev/sda
First Last
# Type Sector Sector Offset Length Filesystem Type (ID) Flag
— ——- ————– ————– —— ————– ——————– —-
1 Primary 0 10233404 63 10233405 Linux (83) Boot
2 Primary 10233405 14313914 0 4080510 Linux swap / So (82) None
3 Primary 14313915 24547319 0 10233405 Linux (83) None
4 Primary 24547320 44082359 0 19535040 Extended (05) None
5 Logical 24547320 34314839 6 3 9767520 Linux (83) None
6 Logical 34314840 44082359 63 9767520 Linux (83) None
Logical 44082360 78124094 0 34041735 Free Space None
4. parted command
parted is a partitioning tool with good functions; in Fedora 8 There is a tape, you can install it yourself; the calling method is simple, the default device opened by parted is /dev/hda, you can also specify it yourself; such as parted /dev/hda or /dev/sda, etc.; the exit method is quit
It will take a while after entering the parted command before the following content will appear:
[root@localhost ~]# parted
GNU Parted 1.8.6
Use /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
Enter p under the cursor and press Enter. The following content will appear:
Model: ATA Maxtor 5T040H4 (scsi )
Disk /dev/sda: 40.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End S ize Type File system flag
1 32.3kB 5240MB 5239MB Primary partition ext3 boot
2 5240MB 7329MB 2089MB Primary partition linux-swap
3 7329MB 12.6GB 5240MB Primary partition ext3
4 12.6GB 22.6GB 10.0GB Extended partition
5 12.6 GB 17.6GB 5001MB Logical partition ext3
6 17.6GB 22.6GB 5001MB Logical partition ext3
(parted)
Enter quit after the cursor to exit.
5. sfdisk -l
[root@localhost ~]# sfdisk -l
Disk /dev/sda: 4863 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/sda1 * 0 636 637- 5116671 83 Linux
/dev/sda2 637 890 254 2040255 82 Linux swap / Solaris
/dev/sda3 891 1527 637 5116702 83 Linux
/dev/sda4 1528 2743 1216 9767520 5 Extended
/dev/sda5 1528 2135 608 - 4883728 83 Linux
/dev/sda6 2136 2743 608- 4883728 83 Linux
6. You can also use Applications>System Tools>Disk Usage Analyzer to view disk usage
The above is the detailed content of Linux command manual view (linux view hard disk usage command). For more information, please follow other related articles on the PHP Chinese website!

Valorant has encountered a connection error when gaming? What will you do when that happens on PC? Take it easy. Every problem has a fix. Valorant is also no exception. In this article on php.cn Website, I bet you must find satisfying solutions.

What to do if you see a message saying that PUA:Win32/FlashHelper was located on your PC? Do you know what it is? This is a potentially unwanted software and might threaten your data and system. Once your computer is infected by it, follow this guide

In this post, php.cn Software lists some common Chrome connection errors you might encounter when browsing a webpage and introduces some easy methods to solve these issues. You can find the error you encounter and use the corresponding solutions to h

Cookies may not sound new to you because you encounter them almost every day when you browse web pages. But do you know what exactly cookies are? This guide on php.cn Website will show you detailed information about them.

If you want to print photos from iPhone, what should you do? The operation is not difficult as long as you follow three ways in this post. php.cn will show you a detailed guide on how to print from iPhone to HP printer. Now, let’s go to see them.

Xbox is very popular among people since it offers a large variety of games. Users can download the games they like and then start to play them directly. However, one of the common problems related to Xbox is the slow download speed. Users want to fin

If you are a developer, you may enable Developer Mode in Settings to do some tests. However, if you can’t turn on Developer Mode in Windows 11, what should you do? Take it easy and you can find some effective ways from this post written by php.cn Sol

Microsoft has released a new cumulative update for Windows 10 and it is Windows 10 KB5011543. This update contains some new features like Search highlights and some fixes. You can read this php.cn post to get some related information. Besides, you ca


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver CS6
Visual web development tools
