Linux File System Management commands (version 2) and linux System Management

Source: Internet
Author: User
Tags touch command

Linux File System Management commands (version 2) and linux System Management
Common commands for Linux File System Management commands

1. Run the df command to view partition usage

Common options

-H: user-friendly

-M: Display partition usage in megabytes

Display Information:

Mounted on: mount point

Filesystem: The specific hardware name.

 

2. Run the du command to view the file/directory size. The default value is K.

Common options:

-H [humanity]

Du-h/home/xiaofang

-S [statistics]

Du-sh/etc # view the directory size, which is commonly used

 

3. check and repair file system fsck [file system check] And e2fsck

Function: similar to Windows blue screen detection, fsck is automatically called to detect and repair the file system in case of abnormal power outages. However, it must be executed in single-user mode.

Usage: e2fsck # common options are listed directly.

 

4. file determines the file type

File/etc/services

File newfile

 

Use optical drive

1. Mount the optical drive

Mount/dev/cdrom/mnt/cdrom mounting Optical Drive

Df view mounting information

 

Cd/mnt/cdrom

 

2. Uninstall the optical drive

Umount/mnt/cdrom # Note:

Or eject/mnt/cdrom # the CD-ROM drive is displayed when you detach it.

 

Df-h

 


Expansion-Block devices and character Devices

 

Add a hard disk or partition

1. Add a hard disk. Generally, the system will be powered off on the Real Server]

2. restart the system

3. Enter the CMOS/BIOS mode to check whether the new hard disk can be detected.

4. You can also check whether this hard disk can be detected after Linux is started.

Dmesg | grep sdb # If the following information is displayed, it indicates that [but no partition] has been recognized. If there is no information, it indicates that it is not recognized.

 

You can also use fdisk-l/dev/sdb to view the disk information.

5. partitions

Fdisk/dev/sdb # partition command for the new Hard Disk

M for help [the most important]

P prints the current partition information and displays the Partition Table

N Add a new partition

 

 

Click n to display the following information:

 

You can add (1) e1 extended partitions and several logical partitions.

(2) p1-4 primary partitions

Then, follow the prompts to perform step-by-step partitioning.

 

Other commands in fdisk

T. Change the file system type of the new partition.

Commonly used are 83Linux and 82 Linux swap/



File System Types supported by Linux

 

D. Delete the system partition.

W save and exit, and write to the partition table

Q: Do not save and exit

 

6. [best] After restarting, create a file system [similar to Windows formatting]

Note: If you want to save data in any partition, you must use a data management method. This method is called a file system. For example, if you use Windows, NTFS [supports disk quotas, file compression] Or FAT32; Linux is ext3

For the ext3 File System: mkfs. ext3 [or mkfs-t ext3]

Mkfs. ext3/dev/sdb1 # note that the partition name is written, not the hard disk name.

Option:-B indicates the size of the data block.

Other options: You can view them through man mkfs. ext3/mkfs. ext4.

 

7. mkdir/test # create an empty directory [mount point]. The directory is empty. Otherwise, all data will be cleared.

 

8. Mount

Mount/dev/sdb1/test

 

9. Check. If the following information is displayed, the disk is mounted successfully.

 

10. How to enable the hard disk to be automatically mounted every time the system is started is described in the following article...


What file management and disk management commands are available in Linux? Write 5 each and write 3 specific functions

File Management:
Vi/touch/cp/mkdir/rm
Vi: edit text files in linux
Vi
This command can create a file named a and edit it.
Touch: You can change the file timestamp or create a new file.
Touch
If the file a does not exist in the current directory, Create File a. If the file already exists, change the file creation timestamp to the time when the touch command is executed.
Mkdir: command used to create a directory
Mkdir mulu
This command can create a directory named mulu
Disk:
Df/du/mkfs/fdisk/mount
Df: displays the current disk space usage
Df-m
Displays disk space usage in megabytes
Du: displays the usage of directories.
Du-sh
Displays the usage details of the current directory.
Mount: attach a disk or some storage devices.
Mount-t ext3/dev/sda2/root/sda
Mount the second sda partition (the partition file type is ext3) to the/root/sda directory.

How does one view the file system type in linux?

The file system is the method and data structure used by the operating system to clarify the files on the disk or partition; that is, the method to organize files on the disk. It also refers to the disk or partition used to store files, or the type of file system. The software organization responsible for managing and storing file information in the operating system is referred to as the file management system. A file system consists of three parts: software related to file management, managed files, and data structures required for implementing file management. From a system perspective, a file system is a system that organizes and allocates the file storage space, stores and protects and searches stored files. Specifically, it creates files for users, stores, reads, modifies, and dumps files, controls file access, and revokes files when users no longer use them.
. From Baidu.
In linux, you can view the file system by using the following methods:
1. mount command # mount/dev/sda1 on/type ext4
Indicates that the file system of sda1 is of the ext4 type.
2. Command df # df-ThFilesystem Type Size Used Avail Use % Mounted on
/Dev/sda1 ext4 13G 7.6G 4.2G 65%/
The-T parameter of df can display the type of the file system. The-h Parameter makes the display more user-friendly.
3. Commands
More/etc/fstab #
View more/etc/fstab in the configuration file
It is good to find the file system of a partition. I will not explain it too much here.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.