day03 Bash的特性
1. tab补全(*********)
1.
[ root@localhost ~]
useradd userdel usermod usernetctl users
[ root@localhost ~]
Display all 220 possibilities? ( y or n)
2.
yum install -y bash-completion
[ root@localhost ~]
--all
--almost-all
--author
--block-size=
--classify
[ root@localhost ~]
start status stop
文件或者目录的补全
[ root@localhost ~]
ifcfg-ens33 ifcfg-ens36 ifcfg-lo
2.命令行快捷键(主要通过xshall)
ctrl + c :
ctrl + d :
ctrl + z :
ctrl + l :
ctrl + a :
ctrl + e :
ctrl + u :
ctrl + y :
ctrl + k :
ctrl + ← :
ctrl + → :
ctrl + w :
ctrl + r :
delete
esc + . :
! $
! ls
ctrl + s
ctrl + q
3.history(历史记录)
1.history== == = 历史记录
[ root@localhost yum.repos.d]
1 ping 192.168.100.0
2 ping 192.168.0.100.
3 ping 192.168.96.0
4 ping192.168.100.100
5 ping 192.168.100.100
6 ip a
2.选项:
[ root@localhost yum.repos.d]
[ root@localhost yum.repos.d]
[ root@localhost yum.repos.d]
[ root@localhost yum.repos.d]
4.别名
[ root@localhost ~]
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'
[ root@localhost ~]
[ root@localhost ~]
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 test= 'ping baidu.com'
alias which= 'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[ root@localhost ~]
PING baidu.com ( 220.181.38.148) 56( 84) bytes of data.
64 bytes from 220.181.38.148 ( 220.181.38.148) : icmp_seq= 1 ttl= 128 time= 29.6 ms
64 bytes from 220.181.38.148 ( 220.181.38.148) : icmp_seq= 2 ttl= 128 time= 28.3 ms
64 bytes from 220.181.38.148 ( 220.181.38.148) : icmp_seq= 3 ttl= 128 time= 29.7 ms
[ root@localhost ~]
[ root@localhost ~]
[ root@localhost ~]
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'
[ root@localhost ~]
/etc/bashrc
[ root@localhost ~]
/root/.bashrc
[ root@localhost network-scripts]
[ root@localhost network-scripts]
TYPE= Ethernet
PROXY_METHOD= none
BROWSER_ONLY= no
BOOTPROTO= none
DEFROUTE= yes
IPV4_FAILURE_FATAL= no
IPV6INIT= yes
IPV6_AUTOCONF= yes
IPV6_DEFROUTE= yes
IPV6_FAILURE_FATAL= no
IPV6_ADDR_GEN_MODE= stable-privacy
NAME= ens33
UUID= b68194c8-0b5b-4792-b121-407e0999640a
DEVICE= ens33
ONBOOT= yes
IPADDR= 192.168.100.100
PREFIX= 24
GATEWAY= 192.168.100.2
DNS1= 114.114.114.114
IPV6_PRIVACY= no
\
[ root@localhost network-scripts]
[ root@localhost ~]
[ root@localhost ~]
[ root@localhost ~]
-bash: network: command not found
5.关机重启及注销命令
同步时间:
yun install -y ntpdate
ntpdate ntp.aliyun.com
关机:
shutdown -h 10
shutdown -c
立即关机
shutdown -h now
shutdown -h 0
shutdown -h 11:00
init 0
poweroff
halt
halt,-p
5.1重启的相关命令
shutdown -r 10
shutdown -r 0
shutdown -r now
shutdown -r 11:00
reboot
5.2注销的相关命令
logout
ctrl+d
exit
6.显示IP地址的命令
ip a
ip address
ip a s eth0
ifconfig
yum install -y net-tools
ifconfig eyh0
hostname
hostname -i
hostname -I
curl ifconfig.me
curl cip.cc
7.修改主机名
方法一:
[ root@local-work ~]
方法二:
[ root@local-work ~]
[ root@local-work ~]
string