Home >System Tutorial >LINUX >How to query the number of partitions in Linux system
How to query the number of partitions in a Linux system requires specific code examples
Linux is a widely used operating system with strong flexibility and customizability. In Linux systems, partitioning a hard disk is a common operation. Different partitions can be used to store different types of data or install different operating systems. Therefore, it is very important to know how to query the number of partitions in the system. The following will introduce how to query the number of partitions in a Linux system and provide specific code examples.
1. Use the fdisk command
fdisk
command is a tool for processing disk partitions and can be used to query the partitions that exist in the system quantity. The following are the specific steps to use the fdisk
command to query the number of partitions:
sudo fdisk -l
2. Use the lsblk command
lsblk
command is a tool for listing block device information, which can help us query Information about each disk and partition in the system. The following are the specific steps to use the lsblk
command to query the number of partitions:
lsblk
3. Use the df command
df
command is a tool used to query the disk space usage of the file system. By viewing The mount point information can tell the number of partitions in the system. The following are the specific steps to use the df
command to query the number of partitions:
df -h
Through the above method, you can easily query the number of partitions in the Linux system. Choose the method that suits you for querying, and view the corresponding information as needed. Hope the above content is helpful to you!
The above is the detailed content of How to query the number of partitions in Linux system. For more information, please follow other related articles on the PHP Chinese website!