shell基础——基础知识
查看本机shell 信息:
cat /etc/shells --查看本机支持的shell echo $SHELL --查看当前支持的shell
bash初始化顺序:
/etc/profile -> ~/.bash_profile -> /etc/profile.d/*.sh -> ~/.bashrc -> /etc/bashrc
bash退出时执行脚本:
~/.bash_logout
历史命令
查看: history cat ~/.bash_history 操作: !! 执行前一个命令 !n 执行第n号命令,如 !1023 !$ 表示的是上一次命令的最后一个参数 例:mkdir /abc ;cd !$ 相关设置 (/etc/profile) vim /etc/profile HISTSIZE=1000 --内存中保存的最大记录条目 HISTFILESIZE=1000 --历史文件中保留的最大记录条目 HISTFILE --指定命令历史文件 禁用命令历史: 1) HISTSIZE 设置为0 2) 把历史命令文件链接到/dev/null 如: ln -s /dev/null ~/.bash_history
子shell中执行
( ) 把命令括起来
例:(cd /etc/X11;ls)

浙公网安备 33010602011771号