♥️Author : Xiao Liu at Station C
♥️Personal homepage: Xiao Liu's homepage
♥️ Share cloud computing network operation and maintenance classroom notes every day, hard work may not necessarily pay off, but there will be gains, come on! Work hard together for a better life!
♥️Under the setting sun, it is the most beautiful bloom, the tree is thousands of feet high, and the fallen leaves return to the roots. Life is not easy, and the true love in the world
Table of contents
4.alias command: set and display command alias
5.du command: count the size of the disk space occupied by the specified directory (or file)
6.mkdir command: create an empty directory
7.touch command: Create an empty file or update the time stamp of the file
8.ln command: Create a link file for a file or directory, similar to a shortcut under windows
9.cp command: copy files or directories
10.rm command: delete files or directories
11.mv command: move and rename
13. find command: find files or directories recursively
foreword
This chapter explains the Linux shell, thank you for watching, it is full of dry goods.
1. What is Linux
Linux, the full name of GNU/Linux, is a free-to-use and freely disseminated UNIX-like operating system. Its kernel was first created by Linus Benedict Torvalds on October 5, 1991. Released, which is mainly inspired by the ideas of Minix and Unix , is a POSIX -based multi-user, multi-tasking , multi-threading and multi- CPU operating system . It supports 32-bit and 64-bit hardware and can run major Unix utilities, applications and network protocols.
2) Wildcards:
?: matches a character
*: match any character
4.alias command: set and display command alias
① Set the alias: alias command alias = "command"
② Display alias: alias
5.du command: count the size of the disk space occupied by the specified directory (or file)
Format: du [options] [file or directory...]
-a Include all files when counting disk space usage, not just counting directories |
-h shows the size of the directory or file (K, M), the default size unit is byte (KB) |
-s only counts the total size of the space occupied by each parameter, not the size of each subdirectory and file |
6.mkdir command: create an empty directory
Format: mkdir [option] directory name 1 directory name 2 ..........
-p: Create nested directories
7.touch command: Create an empty file or update the time stamp of the file
Format: touch filename 1 filename 2 ...
8.ln command: Create a link file for a file or directory, similar to a shortcut under windows
- Soft link: The soft link file contains another file name path
- Hard link: equivalent to a new file, directly pointing to the physical location of the file
- Format: ln [-s] source file or directory... link file or target location
-s: create a soft link
If no link file name is specified, it is the same as the source file name
Create hard links by default
9.cp command: copy files or directories
① Format: cp [option]... source file or directory... target file or directory
② Commonly used options
-f Do not remind when overwriting the target file or directory with the same name, directly force copy
-i Prompt the user to confirm when overwriting the target file or directory with the same name
-p Keep the permissions, ownership and timestamp of the source file unchanged when copying
-r This option must be used when copying a directory, which means recursively copying all files and subdirectories ※
10.rm command: delete files or directories
Format: rm [options] File or directory to delete...
-r: delete directory ※
11.mv command: move and rename
- Move the specified file or directory to the location
- If the target location is the same as the source location, it is equivalent to performing a rename operation
- Format: mv [options] ... source file or directory ... target file or directory
12. Which command: Find the path where the command or file is located, and the search range is the path contained in the PATH variable
Format: which option command or file
By default, the search will stop at the first one
-a search in all paths
13. find command: find files or directories recursively
①Format: find [search scope] [search condition expression]
②Common search types
lookup type _ |
keywords |
illustrate |
find by name |
-name |
Search based on the name of the target file, allowing the use of "*" and "?" wildcards |
Find by file size |
-size |
Search according to the size of the target file Generally use "+" and "-" to set the size greater than or less than the specified size as the search condition Common capacity units include kB (note that k is lowercase), MB, GB |
Find by file owner |
-user |
Find files based on whether they belong to the target user |
Find by file type |
-type |
Find by file type File types include ordinary files (f), directories (d), block device files (b), character device files ( c), etc. A block device refers to a device that reads data in blocks (such as a hard disk, memory, etc.) A character device refers to a device that reads data by a single character (such as a keyboard, mouse, etc.) |
③find implements multiple search conditions
"-a" means and (and)
"-o" means or (or)
④ Example
Example 1: Recursively find files in the /etc directory whose names start with "resol" and end with ".conf"
find /etc –name "resol*.conf“
Example 2: Find all folders (type d) in the /boot directory, ignoring other types of files
find /boot -type d
Example 3: Find files in the /boot directory that are larger than 1024KB and whose name starts with "vmlinuz"
find /boot -size +1024k -a -name "vmlinuz*“
Example 4: Find files in the /boot directory whose size exceeds 1024KB or whose name starts with "vmlinuz"
find /boot -size +1024k -o -name "vmlinuz*"
♥️Following is the driving force for my creation
♥️Like, is the greatest recognition for me
♥️This is Xiaoliu, I am inspiring to do every article well, thank you everyone