I. Linux BASIC instructions
Find |
-name: Search by file name |
- File Search
- When you do not set a parameter, find finds its subdirectories and files in the current directory by default, and displays all subdirectories and files found
|
-size: Search by file size, where + (greater than),-(less than), = (equals) |
-user: Search by user |
which |
|
- Search for the directory and alias information for your command
|
Whereis |
|
- Search for the directory where the command resides and its help document path
|
Locate |
|
- Find files in the file repository
|
Grep |
-I: Case insensitive |
- Searches the file for character-matching lines and outputs
|
-V: excludes the specified string |
Wc |
-C: Statistics of bytes |
- If the file name is not specified, the WC instruction reads the data from the standard input device
|
-W: Count words |
-L: Count rows |
-M: Count characters (cannot be used in conjunction with-c) |
-L: Print the line number of the longest line |
Cut |
-C: Divide by character |
|
-B: Divides in bytes and ignores multibyte-character boundaries -bn: Divides in bytes, cannot ignore multibyte-character boundaries |
-FD: Specify the display area |
Sort |
-B: Ignores whitespace characters that begin before each line |
- Sort compares each line of a file as one unit to another
- The principle of comparison: backward from the first letter, followed by ASCII code backwards, and finally they are output in ascending order
|
-C: Check that the files are sorted in order |
-F: Ignore case when sorting |
-M: Sort the first 3 letters according to the abbreviation of the month |
-N: Sort by numeric size |
-o< output File: Enter the sorted file into the specified file |
-t< split character;: Specifies the field separator to use when sorting |
-K: Choose which interval confidence to sort |
-r: Sort in reverse order |
Uniq |
-C: Add the number of times each row appears before the output line |
- To delete adjacent duplicate rows
|
-D: Show only duplicate rows |
-U: Show only rows that are not duplicates |
Tar |
-ZCVF: Compressing files |
|
-ZXVF: Unpacking the Compressed package |
Second, VIM editor
Vim is a text editor developed from VI.
- Vim's three modes of operation and conversion between each other
- Vim operation in different modes
Command mode:
The user has just started Vi/vim and entered command mode.
In this state, the keystrokes are recognized by VIM as commands rather than as input characters. For example, we press I at this time and do not enter a character, I is treated as a command.
Here are a few common commands:
-
- i switch to input mode to enter characters.
- x deletes the character at which the current cursor is located.
- : switch to baseline command mode to enter commands at the bottom of the line.
If you want to edit the text: Start vim, enter command mode, press I, switch to input mode.
Command mode has only some of the most basic commands, so you still have to rely on the bottom line command mode to enter more commands.
Input mode
Press I in command mode to enter the input mode.
In input mode, you can use the following keys:
-
- character keys and shift combinations , enter characters
- Enter, enter, line break
- Back SPACE, backspace key, delete the previous character of the cursor
- DEL, delete key, delete cursor after one character
- arrow keys , moving the cursor in text
- HOME/end, move cursor to beginning/end of line
- pageup/pagedown, top/Bottom page
- Insert, toggle cursor to input/Replace mode, the cursor will become a vertical bar/underline
- ESC, exit input mode, switch to command mode
Baseline Command mode
Press: (colon) in command mode to enter the baseline command mode.
The bottom line command mode can enter commands for single or multiple characters, and there are many commands available.
In the baseline command mode, the Basic command has (the colon has been omitted):
-
- Q Exit Program
- W Save File
Press the ESC key to exit the bottom command mode at any time.
- Basic commands commonly used by vim
Command mode
Edit mode
Baseline Command mode
Third, redirect (still not understand, do not write)
"2018.03.13" linux basic Directive +vim Editor + redirect + regular expression