This is the seventh day of my participation in the August More text Challenge. For details, see:August is more challenging
Ls: lists directories
Ls-a Displays hidden files
Ls -l Displays long files (displays details) is the same as ll
The file size is shown in bytes
Ls-lh Converts the file size to the corresponding unit
Ls-lrt is sorted by time
Mkdir: creates a new directory
Creating the China directory
Mkdir -p Creates a recursive directory
CD: Switch the directory
CD Directory Go to the directory
. Indicates the parent directory. Indicates the current directoryCopy the code
PWD: Displays the current directory
Rmdir: deletes an empty directory
Cp: copies files or directories
== You can copy multiple files or change the file name == == Focus on -r -p==
Mv: Move files and directories, or modify the name of files and directories (cut)
== You can cut multiple files, or you can cut and change the file name ==
Rm: removes a file or directory
rm source target
Copy the code
Options and Parameters:
- -f: indicates force. The file that does not exist is ignored and no warning message is displayed.
- -i: interactive mode. Before deleting, it will ask the user whether to take action
- -r: Delete recursively! Most commonly used in directory deletion! Very dangerous option!!
== Do not run the rm -rf command on the server. The command will delete all files. Delete library run command. Don’t remember it. = =
Rm -rf * : deletes all files in the current directory
Touch creates a command with Spaces (not recommended)
How to delete files with Spaces in the filename? Double quotation marks are required, which is why creating files with Spaces is not recommended
Cat tac more less tail Refer to Blog.csdn.net/lingyiwin/a…
Tac is the reverse of CAT. Tac is the reverse of cat. When NL is displayed, the line number is output by the way! Less is similar to more, but better than more, it can turn the page forward! Head Look only at the first few lines. Tail Look only at the tail lines. You can run the man [command] to view the usage document of each command, for example, man cp.
Linux soft link and hard link ln command
Ln [parameter][Source file or directory][Destination file or directory]Copy the code
Necessary parameters:
- -b Deletes and overwrites the previously established link
- -d Allows the superuser to make hard links to directories
- -f Indicates mandatory execution
- -i Indicates the interactive mode. If the file exists, the system prompts the user whether to overwrite the file
- -n Treats symbolic links as general directories
- -s soft link (symbolic link)
- -v Displays the detailed processing process
Soft links: Acts as shortcuts
- 1. Soft links exist in the form of paths. This is similar to the shortcut in Windows
- 2. A soft link can cross file systems, but a hard link cannot
- 3. A soft link can link to a file name that does not exist
- 4. Soft links link directories
Hard links: Can be thought of as backups
- 1. A hard link exists as a copy of a file. But it doesn’t take up real space.
- 2. Do not create hard links for directories
- 3. A hard link can be created only in the same file system
- 4. Synchronize updates
- 5. You cannot create hard links across partitions
== Hard link Sharing an I node Run the ls -i command to view the functions of the hard link and source file on the same I node. = =