linux bash shell command aliases Command substitution globbing

linux bash shell command aliases Command substitution globbing

1.bash shell command aliases:

##### alias CMDALIAS = 'COMMAND [options] [arguments]'
##### Shell aliases defined only valid in the current shell life cycle; effective range of only the current    shell process alias:
 eg. [root@levi ~]# alias cls=clear
Cancel command aliases:
[root@levi ~]#unalias CMDALIAS
the same alias command name as the original command name, to call the original command need to add a '\' before the command
eg. [root@levi ~]# \command name
view the system in the presence of command aliases
[root@levi ~]# alias
 alias cp='cp -i'
 alias egrep='egrep --color=auto'
 alias fgrep='fgrep --color=auto'
 alias grep='grep --color=auto'
 alias l.='ls -d .* --color=auto'
 alias ll='ls -l --color=auto'
 alias ls='ls --color=auto'
 alias mv='mv -i'
 alias rm='rm -i'
 alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

2.bash shell command substitution

A sub-command of the command execution result for the replacement process
$(COMMAND) or `COMMAND`

eg. 
[levi.zhong@localhost ~] $ echo "The current directory is $(pwd)."
The current directory is /home/levi.
[Levi.zhong@localhost ~] $ touch ./fiel-$(date +% F-% H-% M-% S) .txt
bash Supported quotes:
``: Command substitution
"": Weak references, you can achieve variable substitution
'': Strong references, do not complete variable substitution

3.globbing

*: Any character of any length
?: Any single character
[]: Any single character within the specified range
eg. [abc], [a-m], [A-Z], [0-9], [a-z0-9]
Matches any single character outside the specified range: [^]
[: Space:]: whitespace characters
[: Punct:]: Punctuation
[: Lower:]: lowercase letters
[: Upper:]: uppercase
[: Alpha:]: uppercase and lowercase letters
[: Digit:]: number
[: Alnum:]: numbers and uppercase and lowercase letters

Pingbacks are closed.

Trackbacks

Comments are closed.