File Operations
Get directory content
Ls
Getconf ARG_MAX
Determine whether a file exists
Create a file
Create a general file:
Create a file
1 use the redirection output:> text.txt
2. Use the NULL command:> test. xtx to increase script portability. Sometimes, "> file" May cause syntax errors.
3. Create a hidden file:> .test.txt
4. Run the touch command: touch test.txt.
5. Specify the initialization content when creating the file: echo 'hello'> test.txt
6. Use the ln command to create a copy of another file: ln test1.txt test2.txt
Delete an object
1 rm.test.txt
2 rm-I test.txt will ask whether to delete
3 rm-f test.txt delete without asking whether to delete it.
Create a directory:
Mkdir test
Mkdir-m 711 test-m specifies the directory permission value of 0711
Mkdir-m 700. test hide directory
Mkdir-p t1/t2/t3 multi-level directory. Can be used with-m
Delete directory:
Rmdir test
Rmdir-p t1/t2/t3 multi-layer empty directory
Rm-Rf test non-empty directory
Create a block Device File
Create a character Device File
Create a FIFO file
Create a Socket File
Create a symbolic link file
Get file attributes
In linux, each file has 13 attributes: Device number, inode number, file mode, number of connected files, file owner number, file owner group number, device identifier, and file size, use the file time atime, modify the file content time mtime, change the file Mode Time ctime, block size, and configure the number of blocks
Stat-f/dev/sda1
Stat File
File Format code
Format code for file systems (I .e. partitions)
Chattr lsattr command usage:
Chattr + attribute code file
Chattr = Property Code File
Chattr-attribute code file
Lsattr File
Available Property Code
Chattr.
Compare file differences
Diff and patch commands
Search for file content
Grep-q keyword file-q indicates that no information is generated during search.
Create temporary files
Mktemp command
Example
Case-insensitive file name Interchange
Conversion Encoding
In short, you should be familiar with the usage of these shell commands. Check more manuals and practice. Remember that it is unlikely ..