First, Linux common commands
-Has learned
CD (Path switching) RM (after-RF can delete files or folders) ls (view files and folders under current path) mkdir (Create folder) Touch (create file)
Cat (view file contents) MV (move or rename files) rmdir (delete empty folder) WhoAmI (view current user) PWD (view current path)
-/# root directory Linux system has no drive letter, only root directory/.
-CD # Directory jump
-CP # Copy file CP < current folder under File > < destination folder >/< filename >
# Copy Folder Cp-rf < Folders > < destination folder >
-Find # Lookup file Find/(path)-name ' *.py '
Find/(PATH)-size 1024 (+1024 greater than 1024;-1024 less than 1024)
sudo find ... # sudo get permissions
Second, the use of vim
-Three different modes
-Command mode Yellow-green
-Enter I in insert mode command mode, turn blue. Press ESC to exit insert mode and back to command mode
-Input in the last-line mode command mode:
-Access
-Vim < file name > # Enter or create file, all files can be opened with vim
-Exit
In the last line mode:
-Q Force Quit
-Wq Save and exit the input code, WQ save exit will go to the check interface, check whether the code conforms to the PEP8 specification, then: Q Exit directly.
-q! Do not save exit
-Move Cursor
Command mode:
-direction Key: H left J down K on L right keypad arrow keys can also
Command mode:
-GG back to the beginning
-G back to the end of the line
-^ non-whitespace header
-0 beginning of the line
-$ line End
-Input mode (insert)
Command mode:
-I insert at the beginning of the current non-space line before the cursor position;
-A begins at the beginning of the cursor position, a at the end of the current line, or as input
-O Add a row below the cursor line and enter the mode;
-Copy and paste
Command mode:
-yy copy entire line content 3yy copy 3 lines of content yw copy the current cursor to the end of the word 3yw copy 3 words
-Paste P
-Delete and Revoke
Command mode:
-DD Delete Row 6DD Delete 6 lines (below the cursor) DW Delete A word x Delete the location of the cursor
-U undo Ctrl+r anti-undo
-Block operation
Command mode:
-V Block Select Ctrl + v. Column selection (move cursor selection area after entering command)
-Multiline Comment Command mode: Ctrl + V Select the line you want to annotate, Shift+i # and then press ESC
-Search
Command mode:
-/Content forward search content (down)
-Content Backward Search content (UP)
-N Search down
-N Search up
-Replace
In the last line mode:
-: S/s1/s2 replaces the first S1 of the current line as S2
-: S/s1/s2/g replaces all S1 in the current line as S2
-:%s/s1/s2/g replaces all S1 in the text as S2
Third, the operation of the py file
-Python3 < file name >
-Quick Run Command mode F5
Iv. use of Python virtual environments
-View the current virtual environment Workon
-Enter virtual environment Workon < virtual environment name >
-Exit the virtual environment deactivate
-Create a virtual environment mkvirtualenv <myvir>
-Delete Virtual Environment rmvirtualenv <myvir>
Linux common commands and use of VIM