[20150925] Linux file system and shell-Zhu Xiaoyang

Source: Internet
Author: User
Tags cpu usage

Introduction to Linux file system and Shell file system Ext2/ext3/ext4

EXT2 is the standard file system in the Gnu/linux system. This is the most used file system in Linux, which is designed specifically for Linux, with extremely fast speeds and minimal CPU usage. The EXT2 can be used for standard block devices, such as hard disks, and also on removable storage devices such as floppy disks.

EXT3 is the next generation of EXT2, which retains the EXT2 format plus the log function. Ext3 is a journaled filesystem (Journal file System), and the biggest feature is that it records the entire disk's write action on a region of the disk so that it can be traced back when needed. When a process is interrupted, the system can backtrack directly from these records and reorganize the interrupted parts, and the reorganization is fairly fast. This partition format is widely used in Linux systems.

In EXT4, the support file is written continuously, that is, when the file is created, it is created a contiguous storage space, so that if you want to write something in the file, you can write in the contiguous space, which means that the file fragmentation and improve the performance of the drive.

This feature is not only present in EXT4, but is already in the REISER4 and IBM JFS file systems, and is used in Linux and Aix. Like many other modern file systems, EXT4 is also a log file system that plays an important role in performance, backup, and disaster recovery. EXT4 compatible with EXT3 standard, that is, you can put EXT4 partition to ext3 load, but you will lose its continuous write function.

Fat16/fat32

As a file name, FAT (file Allocation table, allocation table) has become a computer term since its inception in 1981. For the time being, most operating systems, including Windows, MacOS, and a variety of UNIX versions, support fat.

This is the disk partition format used in MS-DOS and the earliest Windows 95 operating system. It uses a 16-bit file allocation table, is currently the most supported by the operating system disk partition format, almost all operating systems support this partition format, from DOS, Windows 95, Windows OSR2 to the current Windows 98, Windows Me, Windows NT, Windows 2000, Windows XP support FAT16, but only 2GB of hard disk partitioning is a big drawback. Another disadvantage of the FAT16 partition format is the low efficiency of disk utilization (see Related Materials for specific technical details). To solve this problem, Microsoft introduced a new disk partition format--fat32 in Windows OSR2.

This format uses a 32-bit file allocation table, the ability to manage the disk greatly enhanced, breaking through the FAT16 under the capacity of each partition only 2GB limit. Due to the lower production cost of hard disk now, its capacity is increasing, after using FAT32 partition format, we can define a large capacity hard disk as a partition without dividing into several partitions, which greatly facilitates the management of the disk. Furthermore, FAT32 can significantly reduce disk waste and increase disk utilization compared to FAT16. Currently, this partition format is supported by Windows OSR2 after the operating system. However, this partitioning format also has its drawbacks. The first is the disk that is partitioned in FAT32 format, which is slower than the disk with FAT16 format because of the expansion of the file allocation table. In addition, because DOS and Windows 95 do not support this partitioning format, you will no longer be able to use DOS and Windows 95 systems with this partitioning format.

Ntfs

To compensate for the fat's functional flaws, Microsoft has created a file system technology called NTFS. It has the advantage of being very good at security and stability, and it is not easy to produce file fragments in use. And the user's operation can be recorded, through the user's rights are very strict restrictions, so that each user can only follow the system-assigned permissions to operate, and fully protect the system and data security. This partitioning format is supported by Windows 2000, Windows NT, and Windows XP.

VFAT

VFAT is called the long file name System, which is a Linux file system compatible with the Windows system, supporting long filenames, which can be used as partitions for Windows and Linux swap files.

Disk access

EXT2 File System Structure

Figure 1 Ext2 File system

Super BLOCK: Records the overall information of this file system, including the total amount of inode/block, usage, and amount remaining. and the format of the file system and related information.

Inode: Records the properties of a file, a file occupies an inode, and records the number of the block where the file's data resides;

Block: The actual record of the contents of the file, if the file is too large, will occupy more than block.

Ext2 file reads:

Figure 2 Ext2 data access

FAT file reads:

Figure 3 Fat data access

Shell-bash

Figure 4 Hardware, kernel and user affinity

Key Benefits of Bash

History: As long as we press the up and down keys on the command line, we can find the previous input command. In many distribution, the default command memory function can be up to 1000. However, it is important to note that/.bash_history records the previous command executed before the login, and this time the command executed by the login is temporarily in the temporary memory, when the system is logged off, the command memory will be recorded in the. bash_history.

Command and file Completion (Tab key Benefits): Press TAB to have the function of automatic completion of the command and file name, tab after the first word of a string of commands, the command completion; tab after the second word of a string of commands, the file is complete.

Command alias setting function (alias): You can use your familiar short command to replace the system's original complex long command.

Common shortcut keys in bash:

How scripts are executed

1. Execute bash shell script as an absolute path: The change method takes a layer of access to the file directory, first need to have the Read permission of the directory, but also to execute the file execution permissions.

2. Execute bash shell script directly using bash or SH: This method calls bash directly to execute the script file, does not need to have execute permission of the executed file, and does not need to get the absolute path from the directory where the files are executed.

[20150925] Linux file system and shell-Zhu Xiaoyang

Related Article

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.