Linux Study Notes - Part 9
Command:
df (disk filesystem): used to view the total capacity, used capacity, remaining capacity of the mounted disk, no parameters can be added
-i: means to view the usage of inodes
Example: df -i | grep -v tmpfs (grep filter)
-h: Indicates display in appropriate units
例:df -h | grep -v tmpfs
-k, -m: Display in kb and mb units respectively
Example: df -k | grep -v tmpfs or df -m | grep -v tmpfs
du (disk usage): used to view the size of the space occupied by a directory or file
Format: du [-abckmsh] [file name or directory name]
-a: Indicates that the sizes of all files and directories are listed (if no unit is specified, the default display unit is "kb")
-b: Indicates that the listed values are output in units of B
-k: Indicates output in kb, which is consistent with the default output without any options
-m: means output in mb
-h: Indicates that the system automatically adjusts the unit
-c: add up at the end
-s: only list sums
fdisk: It is a partition tool for hard disks under Linux, but it can only divide partitions smaller than 2TB
Format fdisk [-l] [device name] List all disk devices directly without the device name
If you do not add -l, you will enter the partition mode. The commonly used options in this mode are:
a: start boot mode
b: Edit the system disk label
c: start dos compatibility mode
d: delete partition
g: Create an empty globally uniquely identified partition table
G: List known partitions
l: List known partitions
m: list menu
n: New partition
o: Create a new dos partition table
p: print the current partition status
q: quit without saving
s: Create a Sun identifier
t: Modify the partition system id
u: Modify display/entry unit
v: Verify partition table
w: save
x: other functions
mke2fs, mkfs.ext2, mkfs.ext3, mkfs.ext4, mkfs.xfs: used to create filesystems on disk partitions
Common options:
-b: Indicates the size of the space occupied by each data block when partitioning
-i: Indicates the size of the set inode
-N: Indicates the number of set inodes
-c: Indicates to check whether the disk has problems before formatting
-L: Indicates the label to preset the partition
-j: Indicates to create a partition in ext3 format
-t: Used to specify the type of file system, which can be ext2, ext3, or ext4.
e2label:
Labels for viewing or modifying partitions