Shell Introduction
The shell is a command interpreter that provides interaction between the user and the machine, supports specific grammars, such as logical judgments, loops, and each user can have their own specific shell
CentOS7 default shell is bash (Bourne Agin Shell)
and zsh, Ksh and so on.
Command history
View history Commands
[email protected] ~]# cat. bash_history
Modify History Bar Number:
Vi/etc/profile
histsize=1000
To modify the format of viewing history:
New in/etc/profile:
histtimeformat= "%y/%m/%d%h:%m:%s"
Source/etc/profile
841 2017/10/20 06:01:05 Vi. bash_history
842 2017/10/20 06:02:03 Vi/etc/profile
843 2017/10/20 06:03:23 Source/etc/profile
844 2017/10/20 06:03:27 History
Add Permission control:
[Email protected] ~]# chattr +a. bash_history
[Email protected] ~]# > Bash_history
-bash:. Bash_history:operation not permitted
!! : Indicates the execution of the previous command
! 844: Represents a command that executes 844 rows
!his: Represents the command that executes the start of his, which is the last executed
Command completion and aliases
1.Tab Completion
2, Parameter Complete installation bash-completion
Alias aliases
[email protected] ~]# alias wo= ' Ls/root ' #临时有效
[email protected] ~]# wo
2.txt 2.txt.bz2 anaconda-ks.cfg
Permanently valid:
[Email protected] ~]# Vi. BASHRC
#. BASHRC
# User specific aliases and functions
Alias wo= ' Ls/root '
Wildcard characters
1, [[email protected] ~]# ls *.txt
2.txt David.txt
2.
[email protected] ~]# ls?. Txt
2.txt
[email protected] ~]# ls??. Txt
23.txt
[[email protected] ~]# ls [0-9].txt
2.txt
[[email protected] ~]# ls [0-9][0-9].txt
23.txt
[[email protected] ~]# ls {2,23}.txt
23.txt 2.txt
Redirect:
Cat 1.txt >2.txt
Cat 1.txt >> 2.txt
[[email protected] ~]# cat 23.txt >> 2.txt &>/dev/null
This article is from the "Discover new things" blog, make sure to keep this source http://shenj.blog.51cto.com/5802843/1978471
Shell Introduction, Command history, command completion and aliases, wildcard characters, input and output redirection