Shell Simple Understanding
View the current SHELL echo $SHELL
Try the first little script: Vim test.sh
1 #!/bin/bash
2 echo ' I'll be-back ';
Note: #!/bin/bash This sentence is bound to add, remember.
How to execute the script:
1. Give execute permission, chmod 755 test.sh, run directly./test.sh, note: To be executed with a relative or absolute path.
2. Execute script via bash call, e.g. bash test.sh
Basic features of Bash
Alias
View existing aliases in the system alias
command to modify aliases alias ls= ' ls--color:never '
Add name Other command alias Vi= ' Vim '
Commands to remove aliases Unalias VI
Note: The use of the alias command is temporary, and if you restart the server, these settings will become invalid. If you want the alias to take effect permanently, you can write the alias settings to the environment variable configuration file. Command: VI < home directory >/.BASHRC is written in the default format and location. However, this procedure requires a re-login in order to take effect, if necessary in time, but the use of the command: source. bashrc. This will call the file again and then take effect.
Command Effective Order:
1. First-order bit execution of commands executed with absolute or relative paths
2. Second sequential bit execution alias
3. Third sequential execution of bash internal commands
4. The IV sequence bit executes the first command found in the order of the directories defined by the $PATH environment variable.
2. Common shortcut keys
CTRL + C terminates ctrl+e cursor fast to end of line
Ctrl+l Clear Screen Ctrl + Z put commands into the background (not recommended)
Ctrl+u Delete full row ctrl+r search in history command CTRL + A cursor jumps to the beginning of the line
3. Historical order
History "Options" "Historical command Save File"
Option:-C clears the history command (not recommended to empty, anyway this will not occupy much space)
-W Write history command in cache to history command save file < home directory >/.bash_history
Note: The history command saves 1000 by default and can be modified in the environment variable configuration file/etc/profile. Find histsize=1000, modify it.
The most common two calls to historical commands are:
1. Use the up and down arrows to invoke the previous history command
2. Use "! String "To repeat the last command that starts with the string
4. TAB key Auto-complete function
Command completion: Depends on the environment variable.
File or directory Completion: The path of the dependent action.
learn PHP's small ant original blog http://my.oschina.net/woshixiaomayi/blog
Little Ant learns Linux (9)--shell Basics and bash basic features