Logout and login using vim
Shutdown / Reboot
We shut down daily operations are carried out using the mouse to click on restart shutdown and other operations on their own computer, but when you use Linux, we must get used to command operations.
Shutdown restart
- the shutdown
the shutdown -h now: represent an immediate shutdown
shutdown -h 1: represents off after one minute
shutdown -r now: immediately restart - halt: direct use, the shutdown operation
- reboot: direct use, perform the restart operation
- sync: synchronize data to the RAM disk
User login logout
- Try to avoid using root user logon time, because the highest root user authority, to avoid operational errors, losses, generally using ordinary user login, when you need to use the root user, use the su username switch
- logout to log out users
- In the graphics logout operation level is invalid, the valid operation level 3 (level after running order description)
vi / vim
Basic introduction of vi and vim
- vi text editor is all Linux systems will be built-in text editor.
- vim function with a program to edit, on the basis of real vi iterative, can take the initiative to identify the grammatical correctness font color for easy programming code to add, compile and error to find jumps and other functions, is widely used in Linux in programming.
vi and vim of three modes
1) Normal mode
- In normal mode, we can use a text editor that comes with shortcut keys, the default mode is to get this in our open a vi editor when using this mode, the arrow keys to move the cursor, you can use copy, paste, delete, etc. to see fast to process the file.
2) insert mode / edit mode
- after entering vi editor, among arbitrary i, I, o, O, a, A, r, R a can be switched to the edit mode, the most used is based on I ( insert)
3) command line mode
- In the normal mode, pressing ESC may switch to command mode; In this mode, you can provide relevant instructions to complete the read, store, alternatively, to save and exit Vim, line numbers and other operations
Vi editor practical
Some vi / vim in common shortcut keys, more self-seeking inquiry
- Write a add.py program.
- Use vim editor go, when there is a party files, the files are edited, when the file does not exist, it will create a new file.
Save and exit the command mode
to run the program
shortcuts use (normal mode)
1). copy the current line yy p, n copies of the current row down, i.e. n YY, then press p (paste)
2) delete current row dd, supra delete multiple rows, not too much presentation
3) set the line number input in command mode: set number
removal line number: set nonumber
4) Find the next one in the file mode command keyword / keywords, the transport lookup, to find the next input n is
5). Quickly to the last line (G) and the first line (GG), both in use normal mode
6) the cursor to the first current line (^), to the end of the current line ($).
7) move the cursor to the specified line number, first step: a display line number; and a second portion: enter move to line number; the third step: enter the shift + g enter to
study while recording, if deficiencies welcome message pointing ...