Linux-basic concepts of file systems and linux-basic concepts of Files

Source: Internet
Author: User

Linux-basic concepts of file systems and linux-basic concepts of Files

In linux, all data is stored in a file and stored in a directory with a tree structure.

(1) file type

1. Common files

Including text files, source code files, and executable files. Linux does not distinguish between text and binary files.

2. Directory

Similar to the directory folder in windows.

3. Device Files

Character Device Files: Files starting with "c" can directly transmit data.

Block Device Files: Files starting with "B", read and write data blocks with memory buffer.


(2) viewing files

Command: ls-l

Drwxrwxr-x 2 Root Root 4096 DEC 12 0910: 10 Reader
File Type Number of Files File owner Group File Size Creation or modification time File or directory name
File Type: file attributes + 3 file owner permissions + 3 group permissions + 3 others Permissions

R: readable

W: writable

X: executable


(3) file editing

Command for creating or editing a file: vi filename

Vi editor mode: Command mode, edit mode, and end mode (you can enter the ex command)

Tip: After opening the file, enter I to enter the editing mode, click ESC to exit the editing mode, enter q to exit the file, and enter wq to save and exit the file.


(4) file operation commands

Cp: copy an object

Mv: Rename or move a file

Rm: delete an object



File System in linux

As you can understand, the file system in Linux is a tree. The root is/. All other directories are root subnodes. This entire tree can be in the same partition, it can also be that several shards occupy one partition separately, while the remaining Shard is in the same partition.

Regardless of whether a shard is in the same partition as the root or different partitions, access is the same for users. For users, there is only a path and no partition is required.

For example, if the/home directory does not exclusively occupy one partition, it is in the same partition as the root partition. If the/home directory is divided into separate partitions, that is, the entire/home directory is in another partition, but for users, the/home directory is the/home directory, no matter which partition, the access path is the same, that is,/home. The operating system is concerned about the details of all the partitions.

This is different from the c and D disks in windows. to access a file in windows, you need to specify the partition, that is, the disk, and then the directory, in linux, the partition details only need to be concerned when the system is installed to partition.

As mentioned above, partitions only need to be concerned during installation. This is not entirely true. When mounting a partition, you also need to care about partitions, point the original path to a directory to a partition.

For example, if/home is used in the same partition as the root partition,/home is just a directory. In some cases, you need to partition/home into a separate partition. In this case, mount it, mount a new partition, such as/dev/hda1, to the/home directory. At this time, the/home path no longer points to the original/home directory, instead, point to the/dev/hda1 partition again.

Generally, a very important process during system startup is mounting. The system file/etc/fstab records all automatic mounting information, after the system is started, you can manually mount the partition, or even the image file of the CD and CD.

After a CD or image file is attached to a file system, a new Shard is installed on the tree, with more shards and more leaves on it.

In addition to common files, all devices in linux are managed and accessed in the file system in the form of a file. For example, the partition mentioned above, I mean/dev/hda1, in fact, serial port Devices and network devices are also stored in the file system in the form of special files.

Remember the conclusion that the file system in linux is a tree, and all files and devices are a leaf.

Introduction to the "File System" in Linux

This is a little troublesome, but according to the directories mounted when ubuntu is installed in the partition, you can probably know:

The root partition is the system disk (always drive C, windows is the largest),/home is my document (also in the system disk, you have to use some means to move it out ), /swap is the virtual memory (hiding files in windows)./boot is like ntldr. It directs the system, and windows is also placed on the drive C ..., /usr is program files, and there is also a C drive in windows. /Var and/tmp are like the IE cache file in windows. winrar decompress the cache and so on./etc is the system configuration file, you should be the Registry in windows, but the registry is integrated into a file,

Others that are not commonly used cannot be remembered. In short, this is a bit absurd than itself. Mount is similar to the environment variable in windows ,,,.

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.