Difference: 1. fdisk can output partition contents, delete or add partitions, while df can only output the usage of partitions; 2. fdisk is more operable, while df is a command for viewing and browsing; 3 When viewing a project, the content viewed by fdisk focuses on the information of the partition table, while df focuses on displaying the information of all file systems in the current system.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
The difference between linux df and fdisk:
fdisk is a partition tool that can output the contents of all partitions of the device. You can also delete or add partitions; df is used to check the usage of the file system (partition).
fdisk is an operational command, df is for viewing and browsing
fdisk also has viewing items, and the viewing content focuses on the information of the partition table , also serves disk partitions; while df focuses on displaying information about all file systems in the current system;
1. df lists the overall disk usage of the file system
Since the data read by df is almost for the entire file system, the read range is mainly the information in the Superblock, so this command displays the results very quickly!
Supplement: Easy-to-read capacity format, such as K, M, G;
2. fdisk: Output all partition contents and operation partitions of the device (delete, Newly added)
1) fdisk outputs the contents of all partitions of the device;
No matter what actions you perform, as long as you press "q" when leaving fdisk, all actions will not take effect! 』On the contrary, pressing "w" means that the action takes effect.
fdisk -l View all partitions
Supplement: The printing effect is the same as fdisk /dev/ sda;
2) Operation partition (delete, add)
The following is the partition demonstration content, only screenshots, no actual operation;
2.1) Delete partition:
2.2) New partition:
2.3) New extended partition
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of What is the difference between linux df and fdisk. For more information, please follow other related articles on the PHP Chinese website!