In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian for you a detailed introduction of the "Linux file system types and commonly used commands are what", detailed, clear steps, details handled properly, I hope that this "Linux file system types and commonly used commands are what" article can help you solve doubts, the following editor's ideas slowly in-depth, together to learn new knowledge bar.
2.8.1 Linux file system type
When we use the Windows system, we sometimes format hard drives, USB drives and other storage devices, which will be required when formatting.
We choose the type of file system, such as exFAT, FAT32, NTFS. Similarly, Linux systems also support different types of file systems.
For example: ext2, ext3, ext4, yaffs, FAT32, NTFS and so on. Here we mainly talk about several commonly used file systems.
FAT32 file system:
FAT32 means that the file allocation table is a disk file management mode that uses 32-bit binary record management, because the core of the FAT file system is
File allocation table, from which the name is derived. FAT32 is developed from FAT and FAT16. It has the advantages of good stability, good compatibility and full compatibility.
Win 9X and previous versions, and easy to maintain. The disadvantage is that the security is poor, and the maximum can only support 32GB partitions, and a single file can only support the maximum.
4GB .
3 ext3 file system
EXT3 is the third generation extended file system (English: Third extended filesystem, abbreviated to ext3), which is a journaling file system
Commonly used in Linux operating systems. It is the default file system for many Linux distributions. The kernel of Stephen Tweedie in February 1999
The mailing list first shows him using the extended ext2, which was merged into the kernel mainline starting with version 2.4.15 of the kernel.
Ext4 file system
4 EXT4 is the fourth generation extended file system (English: Fourth extended filesystem, abbreviated to ext4) is the log under the Linux system
File system, which is the successor to the ext3 file system. Ext4 is implemented by a development team led by Theodore Tso, a maintainer of Ext3
And introduced into the Linux2.6.19 kernel. The reason for Ext4 is that developers have added new advanced features to Ext3.
The above file systems are often used under Linux, so which file system is used under the Ubuntu system we installed?
What about the format? We can enter the "df-T" command at the terminal to view it, as shown in the following figure:
The file in the red box above is the disk on which we installed Ubuntu. Under Linux, everything is a file. "/ dev/sda1" is me.
In our disk partition, we can see that his type is ext4. We have the concept of C, D, E disk in Windows system, but through the above
We can see that the disk management under Linux is different from that of Windows, and there is no concept of C, D, E disks. Linux
The system only has a directory "/". We can open the "File" application on the desktop of Ubuntu, and we can see the open file path.
Not in the root directory, this is because Ubuntu supports multiple users and each user is assigned a root directory, such as my Ubuntu
If the user logging in is topeet, the default entry is the root directory "home" of the topeet user, as shown in the following figure:
In the image above, we click "computer" on the left, as shown in the following figure:
The above picture is the root directory of UBuntu, so the Ubuntu we mentioned earlier will create a root directory for each user, so this root directory
Where is the exact location of the recording? When we create a user, Ubuntu will also create a text with the same name as the user name under the "/ home" directory
Folder, this folder is the root directory of the user. For example, the user name I logged in here is topeet, then the user root corresponding to the topeet user
The directory is "/ home/topeet". Users can read and write to the files under their user's root directory at will. We can
To open the terminal, use the "cd /" command, go to the system root directory, and then enter the "ls" command to see where it is in the system root directory.
Some files, as shown in the following figure:
From the figure above, you can see which folders are in the root directory of the system. Let's take a look at the specific functions of these folders:
/ bin stores some binary executable command files
/ boot stores Ubuntu kernel and system startup files
/ dev storage device node
/ etc stores the configuration files required for system management
/ home the default directory for ordinary users, and each user has a folder named after this user name under the changed directory
/ lib / lib64 stores the library files needed for the operation of the system program
/ media stores the device files automatically mounted by the Ubuntu system
/ mnt the mount point of the file system used to mount
/ opt directory where optional files and programs are stored
/ proc is usually used to save system information and process information
Root directory file of / root superuser root
/ sys system device and file hierarchy, and provide detailed kernel data information to user programs
Temporary files for / tmp storage systems and users
/ usr includes files and directories that are directly related to the system user
/ var stores some constantly changing files, such as log files
2.8.2 File Operation Command
Create File Command touch
When we learned vim earlier, we can create a text file through vim, and "touch" can not only be used to create a text file.
You can also create other types of files in the following format:
Touch [parameter] [file name]
Parameter description:
-an only change the access time
-c does not create any files
-d create a file using the specified date
-t creates a file using the specified time
When we use the "touch" command to create a file, if the created file does not exist, it will be created directly, if the created file
If it already exists, the last modification date of the following file (changed to the system date when the command was run) is modified. Now we use the command "cd"
~ "go to the user's root directory, and then use the" touch "command to create a file called ceshi. The running result is as follows:
Folder creation command mkdir
Mkdir is a command used to create a folder. When using this command, the current user is required to have write permission in the current directory, and create
The folder name cannot be another directory in the current directory. The command format is as follows:
Mkdir [options] directory.
The options are described as follows:
-m / / set permissions (similar to chmod)
-p / / can be a path command, and if the directories in the path do not exist, create them in turn
-v / / displays information every time a new directory is created
-- help / / display help information
-- version / / output version information
We can use mkdir to create a folder called "test". We run the command "mkdir test" on the terminal, and the result is as follows
As shown:
File deletion command rm
The rm command can delete files and folders. When using this command, the current user is required to have write permission under the current directory. The command format is as follows:
Rm [options]... Catalogue.
The options are described as follows:
-d / / Delete directories that may still have data (superuser root only)
-f / / skip files that do not exist and do not display any information
-I / / you must confirm before performing any deletion operation
-r / / delete all directory layers under this directory at the same time
-v / / show the steps in detail
-- help / / displays help and exits
-- version / / displays version information and exits
We use the "rm" command to delete the previously created file "ceshi". We type "rm ceshi" in the terminal, and then enter to delete it.
The file "ceshi" has been dropped, and the running result is shown below:
The "rm" command can also delete the folder. We delete the test directory created earlier, and we execute "rm-rf test" on the terminal to run the result.
As shown in the following figure:
File copy command cp
The command to copy files under Linux is "cp", and the command format is as follows:
Cp [parameters] [source file] [target file]
The parameters are described as follows:
-d / / when copying files with symbolic connections, retain the original connection
-f / / forcibly copy the file, regardless of whether the file to be copied already exists in the target directory
-r / / Recursive processing, processing the files and subdirectories in the specified directory together
We use the mkdir command under the user and directory to create two folders: ceshi1 and ceshi2, as shown in the following figure:
Then go to the "ceshi1" folder and create a file in the ceshi1 folder, as shown in the following figure:
We copy the file a to the ceshi2 folder under the user's root directory, and the result is shown in the following figure:
After copying the files, let's copy the folder. First, we return to the user's root directory, and then change the ceshi1 folder
Copy to the ceshi2 folder, and the result is shown below:
Move files command mv
The command for moving files under Linux is mv, and the command format is as follows:
Mv [parameters] [source file] [target file]
Parameter description:
-b / / backup before overwriting if you want to overwrite the file
-f / / if the target file or directory duplicates with the current file, directly overwrite the destination file or directory
-I / / if the target file exists, it will be asked whether to overwrite
-u / / if the target file already exists and the source file is relatively new, it will be updated
We created two folders before: ceshi1 and ceshi2. We created the file an in the ceshi1 folder. We renamed the file a to text.
Piece b, and then move the file b to the ceshi2 folder, and the result is shown in the following figure:
File compression command tar
There are two common compressed package formats under Linux: .bz2 and .gz. We can use the tar command to extract or compress the compressed packages in both formats.
The format of the command is as follows:
Tar [necessary parameters] [Select parameters] [File]
The necessary parameters are described as follows:
-A / / add compressed files to existing compressed files
-B / / set the block size
-c / / create a new compressed file
-d / / differences in record files
-r / / add a file to a compressed file
-u / / add changed and existing files to existing compressed files
-x / / extract files from compressed files
-t / / display the contents of the compressed file
-z / / support gzip to extract files
-J / / support bzip2 to extract files
-Z / / supports compress decompression of files
-v / / display the operation process
-k / / keep the original file unoverwritten
-m / / keep the file from being overwritten
-W / / confirm the correctness of the compressed file
The optional parameters are as follows:
-b / / set the number of blocks
-C / / switch to the specified directory
-f / / specify the compressed file
-- help / / display help information
-- version / / displays version information
We use the tar command to compress and generate .bz2 and .gz packages, and the results are shown in the following figure:
In the figure above, we compressed the compressed packages in .bz2 and .gz formats respectively, in which the parameters we used for the compressed packages in .bz2 format
Is-jcvf, while the parameter used by compressed packages in .gz format is-zcvf. Let's learn about the tar decompression file, as shown in the following figure:
In the figure above, we unzipped the compressed packages in .tar.bz2 and .gz formats respectively. The-jxvf parameter used by the .tar.bz2 package
While compressed packages in .gz format use the-zxvf parameter to extract them. We will stop here with more details on the commands of tar.
You can go to the Internet to find the relevant documents.
File Lookup Command find
File lookup is also very common in our daily use, for example, in the Linux kernel source code, we need to find the path of a file, which
Yes, you will use the file lookup find command in the following format:
Find [path] [parameter] [keyword]
The path identifies the directory from which to start looking for files, and if you don't write, it starts from the current directory where find is executed by default.
The parameters are described as follows:
-name searches by file name to find files that match filename
-depth starts with the deepest subdirectory under the specified directory
-size finds files that match the specified file size
-type finds files that match the specified file type
-user finds files or directories that match the specified owner
-gid finds files or directories that match the specified group identification number
-group finds files or directories that match the specified group name
There are many parameters to this command, except for some commonly used ones. Let's use the find command to look in the directory "/ etc"
For the file that starts with "host", we enter the "find / etc-name host*" command on the terminal, and the result is shown in the following figure:
From the image above, we can see that all the files starting with the "host" keyword have been found in the "/ etc" directory.
Text search command grep
Sometimes we need to search for files that contain specific keywords, so we use the command grep, which is in the following format:
Grep [parameters] keyword file list
The parameters are described as follows:
-b / / the bit number of the first character of the column at the mark before the column that matches the keyword is displayed
-a / / Don't ignore binary data
-c / / calculate the list that matches the template style
-I / / ignore the case of characters
-n / / Mark the column number of the column before the column that matches the sample paradigm
-r / / look up recursively in the specified directory
-v / / reverse lookup, showing only lines that do not match
For example, we recursively look for the text containing the character "topeet" under "/ etc", and the result is shown in the following figure:
Read here, this article "what are the types of Linux file systems and commonly used commands" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.