按生效范围分为shell
全局配置bash
/etc/profileide
/etc/profile.d/*.sh函数
/etc/bashrcspa
我的配置:it
~/.bashrcclass
~/.bashrc_profile登录
shell登陆的方式决定了配置文件的启动选项?变量
交互式登陆:配置
(1). 直接经过终端输入帐号密码登陆
(2). su - UserName 切换用户
执行的顺序: /etc/profile-->/etc/profile.d/*.sh/~/.bash_profile-->~/.bashrc-->/etc/bashrc
profile和bashrc的顺序是相反的, profile是先去执行全局的配置, 而我的配置, 而bashrc偏偏相反, 先去执行我的的bashrc,再去执行全局的bashrc.
非交互登陆:
(1)su UserName
(2)图形化界面打开的终端
(3)执行脚本
执行的顺序:
~/.bashrc--->/etc/bashrc/--->/etc/profile.d/*.sh
交互式和非交互式登陆时, 配置文件的启动差异仍是比较大的。
profile类的做用(1). 用于定义坏境变量 (2). 运行命令或脚本
PATH变量在家目录下的.bash_profile文件中
bashrc类的(1). 定义命令别名和函数 (2). 定义本地变量
BASH退出任务 // 退出shell的时候想要作的操做能够写入到~/bash_logout
保存在~/.bash_logout文件中(用户)
在退出登陆shell时运行
用于
建立自动备份
清除临时文件