Two ways shell script calls
One is to give permission to use absolute paths
Another need only have read access, call the script using bash
history command
-c Clear History command
-w the cache write history command history command to save the file. If not manually specified history commands to save the file, then save the file into the default history command ~ / .bash_history
The default command history is saved 1000, which is to be set by the environment variable HISTSIZE, we can then environment variable configuration file / etc / profile and to modify
Because the command history is stored in ~ / .bash_history in, rather than memory, so if there is a need to change a large number of historic command bar
Each user's command history is saved separately for each user's home directory, the command history file has ./bash_history
Saved using the history command to see the history command and ~ / .bash_history history file commands are different. That's because current landing operation command is not written directly into ~ / .bash_history file
But after stored in the cache, you need to log off the current user, etc., cache command will write ~ / .bash_history file.
If you need to re-write memory command to write directly to the ~ / .bash_history file, without waiting for the user logs off, you need to use the -w option
Call history command
1. Use the up and down arrows
2.! N n th command repeatedly performed
3. Repeat the last command !!
4. Use! $ Repeat the last command of the last parameter
Multi-command execution order
; Command 1; Command 2 sequentially perform a plurality of commands, there is no relationship between the logical command
&& command && command 2 1 1 if the command executed correctly ($? = 0), the command will execute 2, 1 if the command execution is incorrect, the command will not be executed 2
|| 1 || command command 1 command 2 if not performed correctly ($?) Will execute the command 2, 1 execute the command if the command does not execute 2
Grep command line extract
grep option to search the contents of a file name
-A listed qualifying rows, and lists the subsequent row n
-B listed qualifying rows and n lines listed earlier
The number of qualified -c string of statistics found
-i ignore case
-n output line number
-v reverse lookup
With total command of instances ignored
Wildcards
? Matches any character, can not be empty
* Matches zero or more of any character, that is, it can match any content
[] Matches any character in brackets, e.g., [ABC] character representative of a certain match or a, or B, or c
[-] matches any character in brackets, - represent a range. For example, [az] Representative matches a lowercase
[^] Logical negation, represents a character in brackets not match. For example, [^ 0-9] represents a numeric character not match
Examples on a slightly