This note records the most basic vim and shell operations.
What can shellscript do?
Shellscript similar to Windows batch processing, you can put a lot of instructions together, so it is easy to execute multiple commands through an operation. Very light weight, efficient.
Write in Vim
Vim/vi Editor is very powerful, very many functions, shortcut keys, instructions more, just need to know the most commonly used is enough.
VI has 3 modes of operation
1. Command mode
The default mode after entering is the command mode. The command can be accepted but not shown in clear text.
2. Input mode
Command mode press the a key to enter input mode (also press I, O, S, etc.). Press ESC to return to command mode.
3. Colon mode
Enter a blur in command mode to enter the command line.
VI exit
1. Command mode
: q! Quit without saving
: Wq Save and then exit
2. Command mode
ZZ/ZQ Save/Do not save exit
VI Configuration
Synon Syntax highlighting
SETNU Display Line numbers
VI Edit (command line mode)
YY copy entire row
P paste
x Delete cursor characters
DD Delete cursor entire line
U undo
. Repeat
Write a shell script
The shell has a lot of script interpreters here, with bash
#!/bin/bash#asimple shell Script Example#afunctionfuncitonsayhello () function {echo "Enter Your Name:" Readname Read the variable from keyboard input echo "Hello $name"}echo "programme starts here ..." main process Sayhelloecho "programme ends."
Hit ZZ to save the exit.
Shell execution
1.sh command execution
shhello.sh
2. Add execute permissions to the script, and then use the./Command to execute
chmod755 hello.sh
./hello.sh
Add 2 most common Linux commands by the way
CD Replacement directory: CD [DirName]
1.cd/usr/bin/
2.cd~ Back Home
chmod changing properties
where r=4;w=2;x=1
chmod*** represents User/group/other permissions respectively
Chmod777 is all right.
Welcome to participate in the discussion and follow This blog Weibo personal home Subsequent content continues to update Oh ~
reproduced please respect the author's labor, complete reservations The above text as well article links , thank you for your support!