什么是shellhtml
[root@lixiang01 ~]# yum list |grep zsh autojump-zsh.noarch 22.3.0-3.el7 epel zsh.x86_64 5.0.2-25.el7_3.1 updates zsh-html.x86_64 5.0.2-25.el7_3.1 updates zsh-lovers.noarch 0.9.0-1.el7 epel [root@lixiang01 ~]# yum list |grep ksh ksh.x86_64 20120801-26.el7 base mksh.x86_64 46-5.el7 base
[root@ax-01 ~]# history
修改命令历史保存数量shell
[root@ax-01 ~]# echo $HISTSIZE //默认命令历史最大1000条 1000 [root@ax-01 ~]# vim /etc/profile //能够在此调整环境变量
[root@ax-01 ~]# source !$ source /etc/profile [root@ax-01 ~]# echo $HISTSIZE 5000
修改命令历史显示格式vim
[root@ax-01 ~]# HISTTIMEFORMAT="%Y/%m/%d %H:%M:%S" [root@ax-01 ~]# history 2 2017/08/30 09:51:25echo $HISTSIZE 3 2017/08/30 09:51:44vim /etc/profile 4 2017/08/30 09:53:37echo $HISTSIZE [root@ax-01 ~]# !vim vim /etc/profile
[root@ax-01 ~]# source /etc/profile [root@ax-01 ~]# !echo echo $HISTTIMEFORMAT %Y/%m/%d %H:%M:%S
命令历史永久保存bash
[root@ax-01 ~]# chattr +a .bash_history [root@ax-01 ~]# lsattr .bash_history -----a-------e-- .bash_history
叹号常见用法命令行
[root@ax-01 etc]# cd /etc/yum.repos.d/ [root@ax-01 yum.repos.d]# cd .. [root@ax-01 etc]# !! 再次执行上一条命令 cd .. [root@ax-01 /]# [root@ax-01 /]# cd [root@ax-01 ~]# history | tail -n4 1051 cd /etc/yum.repos.d/ 1052 cd .. 1053 cd 1054 history | tail -n4 [root@ax-01 ~]# !1051 //照history编号运行 cd /etc/yum.repos.d/
参数补全,rest
[root@ax-01 ~]# yum install -y bash-completion //安装参数补全包,须要重启 [root@ax-01 ~]# reboot [root@ax-01 ~]# systemctl restart network network-online.target network.service
alias别名code
[root@ax-01 ~]# alias renet='systemctl restart network' [root@ax-01 ~]# echo "alias renet='systemctl restart network'" >> .bashrc [root@ax-01 ~]# unalias renet 取消 [root@ax-01 ~]# vim .bashrc 删除定义别名
实验htm
[root@lixiang01 ~]# ls *txt* 1_heard.txt.bak 1.txt 22.txt 2.txt.bak test.txt word1.txt 记录.txt [root@lixiang01 ~]# ls 1* 123.tar.bz2 1_heard.txt.bak 1.txt 111: 22.txt [root@lixiang01 ~]# ls ?.txt 1.txt [root@lixiang01 ~]# touch 2.txt [root@lixiang01 ~]# touch 3.txt [root@lixiang01 ~]# ls ?.txt 1.txt 2.txt 3.txt [root@lixiang01 ~]# ls [0-3].txt 1.txt 2.txt 3.txt [root@lixiang01 ~]# ls [123].txt 1.txt 2.txt 3.txt [root@lixiang01 ~]# ls [0-9].txt 1.txt 2.txt 3.txt [root@lixiang01 ~]# ls [0-9a-zA-Z].txt 1.txt 2.txt 3.txt [root@lixiang01 ~]# touch d.txt [root@lixiang01 ~]# ls [0-9a-zA-Z].txt 1.txt 2.txt 3.txt d.txt [root@lixiang01 ~]# ls {1,3,d}.txt 1.txt 3.txt d.txt
> 输出重定向 >> 追加 2> 错误重定向,支持追加2>> &> 所有重定向,支持追加&>>
区分输出正确与错误信息内存
[root@ax-01 ~]# cat /etc/passwd nosuchthing.txt > right.log 2> err.log [root@ax-01 ~]# cat err.log cat: nosuchthing.txt: No such file or directory