Linux shell BASICS (5) and Linux shell Basics
V. bash operations and startup script 01. history of bash commands # history ...... # Set (show all variables) | grep HISHISTFILE =/root /. bash_historyHISTFILESIZE = 1000 (number of historical files) HISTSIZE = 1000 (historical file size) # vi/root /. bash_history ...... (1016) # exit (Save the latest 1000 commands) # Save the respective bash commands in different consoles of history-c (Clear history command) # vi. bash_logout #~ /. Bash_logoutclearhistory-c (after exiting the console, completely clear the bash command): wq # Ctrl + r (reverse-I-search) 'mount-t ': mount-t proc none/mnt enter the first few letters in the impression to display the entire line of command # history ...... #! 213 #!! (Previous command) 02. bash variable type # AA = aaaaaa # set | grep AAAA = aaaaaa # env AA (display the environment variable of AA) # export AA (change the environment variable of AA) # set | grep AAAA = aaaaaaao alias # export ooo = HHHHHHHH # echo oooHHHHHHHH03.bash operator #! 20. Execute 20th commands #!! Run the previous command #! $ The last parameter of the previous command # $ obtain the value of a variable # * indicates the file name of any number of characters # echo ??? A part of the file name contains three characters # name of the file starting with echo [abc] * abc # tauch {a, B, c}-{a, B, c} (enumerative) # ls-ltouch 36-rw-r -- r -- 1 root 0 jul 2 a-1-rw-r -- r -- 1 root 0 jul 2 a-2-rw-r -- r -- 1 root 0 jul 2 a-3-rw-r -- r -- 1 root 0 jul 2 b-1-rw-r -- r -- 1 root 0 jul 2 b-2-rw-r -- r -- 1 root 0 jul 2 b-3-rw-r -- r -- 1 root 0 jul 2 c-1-rw-r -- r -- 1 root 0 jul 2 c-2-rw-r- -R -- 1 root 0 jul 2 C-3 # & (drop the command in the background )#~ Main directory # cd ~ Byf [root @ byf] # aaa ()> {> echo this is aaa> ls> cd/tmp> touch/tmp/ddd/a >}# aaa # touch a B (spaces between a and B, if, when B is not added with double quotation marks, the parameter ends.) # ls aa bb # touch "a B" # lsa B # touch 'a B $ user' (all symbols are blocked in single quotation marks) # ls-la B $ USER # touch "a B $ USER" # ls-la B root # echo 'which ls' alias ls = 'ls -- color = try'/bin/ ls # echo which lswhich ls # touch log 'date + % y % m % d' (year, month, day) # ls log160310 # rm a \ (Escape Character) B (delete a single file "a B") # echo $? Whether the previous command is false # [-f/etc/passwd] & (when the frontend command is true, execute the following command) echo OK # [-f (file) passwd/etc/passwddddd] | echo okok # [-d (not a directory)/orical] & echo begin the install (if the specified file exists, the returned result begin the install) #-l (Link)-B (block)-c (character)-x (execution)-r (read)-w (write) # [$ USER = root] & echo hello roothello root0.4 custom bash/etc/profile (all member configurations )~ /. Bash_profile (Personal Configuration )~ /. Bashrc (Personal Configuration)/etc/bashrc (all member configurations) # ifconnfigcannot find :...... # Vi/etc/profile (add new statement) PATH = $ PATH:/sbin (add environment variable) # ifconfigcannot find :...... # Exit # su byf # ifcongfigeth0: lo :( remember to restore after modification) # vi/etc/bashrc # exit (execute ~ /. Bash_logout) # vi ~ /Bashrc add export LANG = "zh_CN.UTF-8" export LC_ALL = "zh_CN.UTF-8" alt + f1 # su root # echo $ LANGzh_CN.UTF-8 # start --: 1 (switch to the Chinese version of linux) ctrl + f7 back to the original interface # vi/exc/sysconfig/i18n can also achieve the above function, modify the entire system # export LANG = zh_CN.UTF-8