Ubuntu defragmentation command summary

  

Linux disk management is mainly implemented by commands. Today, Xiaobian will sort out the commands for Ubuntu disk management, so that you can have a detailed understanding of the commands for managing disks. Interested friends. Let's take a look.

1 df -h for reporting the total capacity of the file system, the amount of the remaining capacity.

2 du -b /home View the capacity (k) of the current /HOME directory and the capacity (k) of the subdirectory.

3 fdisk -l View system partition information

4 fdisk /dev/sda Partition a new SCSI hard disk

5 mkfs.ext3 /dev/sda1 The first primary partition of a SCSI hard disk is formatted into an ext3 file system

# mkfs.ext2 /dev/sda2 Formatted into an ext2 file system

6 mount -t File System Type Device Path Access road

# File system type ISO9660 CD-ROM file system vfat Fat file system (windows) Mount CD-ROM drive

# mount –t iso9660 /dev/cdrom /mnt/cdrom Mount FAT

# mount –t vfat /dev/hda5 /mnt/cdrom Hang the fifth logical partition of the first ide

7 umount /mnt/cdrom Uninstall /mnt/cdrom is empty

8 chmod u+s file Add special permissions to the owner of the file

# chmod g+r file Add read permission to the file group sdb

# Chmod o+w file Add write permission to other users of file

# chmod ax file Subtract execution permission for all users of file

# chmod 765 file is a file genus The main set is full permission, the group is set to read and write rights, other users have read and hold permissions

9 chown root /home Change the owner of /home to root user

A common tool for partial disk space management is given:

df: Query the available or used storage space of the file system and the number of file information nodes.

du: Query the disk space occupied by each file or directory in the specified (or current —) directory.

find -size: Search for files of the specified size in the specified directory.

ls -s: Displays the size of the file in units of 1 KB data blocks.

cpio: used to create, dump or restore cpio archive files, to achieve backup and recovery of files or file systems, can also be used to achieve the replication of the overall directory hierarchy.

tar: Used to create, dump or restore tar archive files for backup and recovery of files or file systems.

dd: Used to implement raw data copying. You can copy files or even file systems (that is, entire disk partitions).

You can find out which directory is taking up the most space by using the du -h --max-depth=1 command.

My friendship: df du These two commands are very useful (see System The home Linux df command uses instance summaries).

The above is a summary of the Ubuntu disk management commands. With these command tools, we can view, organize, and access the disk. Have you learned?

Copyright © Windows knowledge All Rights Reserved