1. View Files
Command: LS
Path:/bin/ls
Permissions: All Users
Options:
LS-A displays all files in the directory, including hidden files (. beginning files)
Ls-l displaying file properties in long form
Ls-i Displays the inode number of the file
Ls-al displaying all files in a long form
LS-ALH displays all files in a long form, where the file size is a unit of
2. Create a Directory
Command: mkdir
Path:/bin/mkdir
Permissions: All Users
Options:
mkdir dirname Creating a directory
Mkdir-p Dirname1/dirname2 Recursive creation
3. Switch directories
Command: CD
Path:/BIN/CD
Permissions: All Users
Options:
CD dirname Switch Directory
CD ~ Home Directory
Cd.. Return to Parent Directory
CD/Back root directory
4. Deleting a directory
Command: RmDir
Path:/bin/rmdir
Permissions: All Users
Options:
rmdir dirname Delete Empty directory
Description: Only empty directories can be deleted
5. Copy (can be renamed at the same time during the copy process)
Command: CP
Path:/BIN/CP
Permissions: All Users
Options:
CP-RP [Original file or directory] [target directory]
-r Copy Directory (do not add this parameter when copying files)
-P Preserve file attributes, preserving last modified time
Description: The process of copying can be renamed at the same time, that is, in the target directory to specify
6. Move, rename
Command: MV
Path:/BIN/MV
Permissions: All Users
Options:
MV [original file or directory] [target directory]
7. deleting files
Command: RM
Path:/BIN/RM
Permissions: All Users
Options:
RM-RF [directory or file]
-R Recursive Delete
-F Force Delete
8. Create an empty file
Command: Touch
Path:/bin/touch
Permissions: All Users
Grammar:
Touch file name
Attention:
1. Create a file with a space file name: Touch "Program Files"
2. It is not recommended to play this way because spaces are separators in Linux
3. When using this file later, you need to enclose the quotation marks.
9. View the contents of a file
Command: Cat
Path:/bin/cat
Permissions: All Users
Options:
cat-n [File]
-N Display Line number
10. Pagination Display of file contents
Command: More
Path:/bin/more
Permissions: All Users
Options:
more [file]
Space page
Enter and turn.
q/q exit
Command: Less
Path:/bin/less
Permissions: All Users
Options:
more [file]
Space page
Enter and turn.
q/q exit
PageUp on the Upside
PageDown, turn down.
/xiaol Search Xiaol (press N to find the next search match line)
11. View the first few lines of a file
Command: Head
Path:/bin/head
Permissions: All Users
Options:
Head-n Digital [file]
-N not written, default 10
12. View the last few lines of the file
Command: Tail
Path:/bin/tail
Permissions: All Users
Options:
Tail-n Digital [file]
-N not written, default 10
Tail-f file
-F Dynamic Display, more for log files
Linux File processing commands