1. Legal shell and/etc/shells functions shell has multiple versions, including Bourne Shell (SH), C shell, K-Shell, tcsh, etc. Normally Linux uses the Bourne Again Shell (Bash), which is the enhanced version of SH can check/etc/shells to see how many shells are available. Writing a legitimate shell to a/etc/shells file is a way for some of the system's services to check the shells that the user is able to use during the run. When the user logs in, it gets a shell to work, which is recorded in the/etc/passwd file 2.bash Shell function command memory history, the default command memory function 1000. In the ~/.bash_history file command completion:tab alias:alias Job control, foreground, background (job control, foreground, background) shell script wildcard character (Wildcard) 3.bash Built-in command type: View commands from external commands or built-in commands type [-TPA] name -T: Display fields are: file, alias, builtin -P: Displays the full file name when the external command is followed, -A: In the path defined by path, List all commands that contain name. 4. Variable settings and display unset, echo variable rules: variables and variable contents with equals = link name= "Vbird" equals can not have space bar variable name can only be English letters and numbers, the beginning cannot be a number variable content If there are spaces, use "" or "to expand the variable, " "in special characters such as $ can be maintained in original features ' special characters are only general characters escape characters \ can be en ter, $, \ etc become general characters. If there are other commands in a sequence of commands, it can be executed with $ (comand) or comand. system default variable is usually uppercase, custom variable is lowercase Cancel variable with unset name5.bash command to open a sub-process s HELL6. Environment variables function  ENV command view the environment variables and common environment variable descriptions Hoem: Represents the Home folder  CD ~ & nbsp SHELL: currently used shell Histsize: Record count MA IL: Mailbox files read by the system using the Mail command at the time of delivery PATH: Directory of environment variables LANG: Language data random: Random number set command View all variables (environment variables and custom variables) &NBSP ; PS1 (prompt setting) $ (This shell PID): Echo $$ ? (Callback code for previous command) export: Convert custom variable to environment variable declare: Can convert environment variable to custom variable 7.locale language variable /etc/ Default/locale  /ETC/SYSCONFIG/I18N8. Variable keypad reads, arrays and declarations read, array, declare read [-pt] variable -P: Follow-up prompt -T: Number of seconds to wait after the next  DECL is [-AIXR] varibale -A: Declared array array -I: declared integer &NBS P -x: Declare export environment variable -r: Set Variable to readonly var[index]= content echo "${var[1],${var[2"}} " recommended ${} Reading array contents 9. Restrictions on file systems and programs: ulimit10. Deletion, substitution, substitution ${variable# keywords for variable contents}: Array matching keywords from the beginning, deleting the shortest data ${varibale# #keyword}: Match keywords from the beginning, remove the longest data ${variable%keyword} : matches the keyword from the end, Delete the shortest data ${variable%%keyword} : from the tailStart matching keywords, remove the longest data ${variable/old str/new str}: Match the contents of the variable to the old string, replace the first one with the new ${ Variable//old str/new str}: Replace All
#: The one with the shortest replacement text ##: The longest match for the replacement text 11. Test and content substitution for variables &NBSP;STR no setup str= " &NBSP;STR set to non-empty var=${str-expr} & nbsp;var=expr var= var= $str var=${s TR:-EXPR} var=expr var=expr var= $str &nbs P &NBSP;VAR=${STR+EXPR} var= var=expr &NBS P var=expr var=${str:+expr} var= &NB Sp var= var=expr var=${str=expr} str=expr, var=expr str unchanged, var=   str unchanged, var= $str var=${str:=expr} str=expr,var=expr str=expr,var=expr Str invariant, var= $str var=${str?expr} expr output to stderr var= &NBS P var=str var=${str:?expr} expr output to stderr expr output to stderr var= Str12. Historical aliases alias unalias ~/.BASHRC files set 13.bash operating environment path and command lookup order: 1. Execute commands in absolute relative path 2. The command is found by alias execution &NB Sp 3. Executed by bash built-in builtin command 4. The first command found in $path order is executed. bash Login with welcome information/ETC/ISSUE,/ETC/MOTD./etc/update-motd.d in Ubuntu 00-header 10- Help-text file in 14.bash config file read process with login shell:/etc/profile------------>~/.bash_ Profile--------------> Start bash Operations &NBSP ; ----->/etc/inputrc -------->~/.b ashrc &NBSP ; ----->/etc/profile.d/*.sh &NB Sp , &NB Sp --->/etc/sysconfig/i18n read ~/.bashrc /when Nologin-bash is obtained Data defined in ETC/BASHRC: Umask values according to the different UID. PS1 values based on different UID requirements. call/etc/profile.d/*.sh settings 15. Terminal Environment Configuration stty,set16. wildcard characters and special symbols wildcard characters: * represents 0 to infinity any character ? represents an arbitrary character &NBSP [] represents a character within brackets [-] represents a character within a bracket range [^] Non-bracket characters Special symbols: # comments & nbsp escape | Pipelines ; Command delimiter ~ User home folder $ &N Bsp Variable & Job control, background run ! non / directory symbols &NBS P >,>> Data flow redirection, replacement cumulative <,<< Stream redirection " no variable substitution function " " variable substitution function   ; &NBsp " commands that can be executed, also available in $ () () Middle for child shell start and end &N Bsp {} middle command block combination 17. REDIRECT standard input code 0, using <,<< StdOut Code 1, using >,>> stderr code 2, using 2>,2>> & nbsp, if the error and correct output to the same file, with find/home-name. BASHRC >list 2>&1 find/home-name. BASHRC &>list If you discard some of the error messages, use the 2>/dev/ Null18. Pipeline commands pick command:cut,grep Sort command:sort,wc,uniq bidirectional redirection:tee Character conversion command:tr,col,join,paste,expand Cut command:split parameter substitution:xargs About-: stdout of the previous command as stdin of the current command
Brother Bird's Linux private dish notes 6------11 Learn Bash