Shell IntroductionShell: Shell (different from: core)a shell in the ordinary sense is a program that can accept user input commands. It is called the shell because it hides the details of the lower operating system. Bourne-again Shell (bash): One of the most widely used shell tools, is a command processor, and bash is the default shell for most Linux systems.
Common shell Commands
Use of SHELL commands 1. MkDir made dirctory Create folder mkdir folder name mkdir img created an img folder mkdir img CSS JS once create multiple folders 2. The CD folder name goes into this folder using the CD 01-shell command to make this folder 3. LS View the contents of the folder ls-a see all the contents of the folder, including hidden content./indicates the current directory. /indicates the previous level of the directory Ls-l view or display the file as a list ls-a-l view or display all file Ls-al4 as a list. Touch Create a file touch index.html created an HTML file touch Aa.txt created a text file touch img/aa.png css/aa.txt js/index.js Create multiple files at once just write the path to the right 5. Cat View the contents of the file Cat file name display all the file content, if many are displayed the most later less file name is displayed from the beginning, press SPACEBAR to have the effect of page flipping press Q to exit the current file 6. RmDir Delete folder RmDir folder name Note: This can only delete the blank folder, if there is content, it is deleted, will prompt the deletion of the solution to the failure: 1. First go to this folder, delete the file and then back out to delete the current folder 2. Rm-r folder name-R means that recursive deletion is equivalent to first entering the folder inside, deleting the child files inside, and then deleting this folder 7. RM Remove Delete file RM file name delete file Rm-r-F recursively delete all files, including system files 8. MV Move file or folder is equivalent to cutting MV to move the file name/folder to move the folder name moved to the folders MV Index.html Css/aa.html moved and renamed 9. MV Rename MV index.html index.htm renamed equivalent 10.CP copy copy CP index.html css/index.html is the index.html file of the current folder is copied under the CSS folder, the name is unchanged CP index.html Js/index.js is the current folder under the Index.ht ml file copy is saved to the JS folder, but the name is changed to Index.js 11. Clear clears the contents of the screen instead of deleting the contents, starting from the top to show the contents of the previous reset delete, 12 from the new start. REDIRECT Echo echo Content > file name input content into this file, if there are multiple input, the following will overwrite the previous
VI Editor
VI Editor is usually referred to as VI, and VI is the abbreviation of Visual Editor. Its status on Linux is like the edit program on DOS. It can perform many text operations, such as output, delete, find, replace, block operations, and so on, and users can customize them according to their own needs, which is not available in other editing programs.
the basic concept of VIbasically VI can be divided into three states, respectively, is1)
command-line mode controls the movement of the screen cursor, the deletion of characters, words, or lines, moving and copying a section and entering insert mode, or to last line mode. 2)
insert mode you can do text input only under Insert mode, and press [ESC] key to return to command line mode. 3)
Bottom line mode Save or Exit VI, or you can set the editing environment, such as looking for a string, listing line numbers ... such as in general, however, we simplify the VI into two modes when we use it, that is, the bottom row mode (last line mode) is also counted as the command-line pattern. Basic operation of VIEnter VIafter the system prompt symbol to enter VI and file name, go to the VI Full Screen editing screen:
Note that after you enter VI, you are in command-line mode and you want to switch to insert mode to enter text.
If you want to edit a text file, the vi file name is advanced into this file at this time is a command mode i press i key, if there is a inster, then the current mode is an input mode, This mode allows you to enter or edit the content. After entering the content, remember to save, but this mode does not support saving the command ESC first switch back to the command line mode insert mode in command mode, enter I or a, you can edit the bottom line mode: The end mode or the bottom line mode : W save and save before exiting: Q exit: Wq can be used to save two pieces before exiting : q! Forced fallback, no save, the previously entered content will not be saved : Set nu setting line number in command mode operation yy: enter yy in command line mode is to copy the current line Yank p: in command-line mode, enter P paster paste u: undo the previous action can be repeated using a similar to the CTRL + Z undo Undo ZZ: in command-line mode , save and exit Ctrl+b: Flip forward to view the previous content back ctrl+f: page backward, just to see what's behind forward
Common shell commands and VI editors