layout: post
title: bash的配置文件,以及读取的顺序
date: 2017-11-26
tags: [“Linux”,”系统的启动和内核的管理”]


全局配置:

/etc/profile

/etc/profile.d/*

/etc/bashrc

个人配置:

~/.bash_profile

~/.bashrc

交互式登录读取配置文件的顺序:

/etc/profile —> /etc/profile.d/*.sh —>~/.bash_profile —> ~/.bashrc —> /etc/bashrc

非交互式登录读取配置文件的顺序:

~/bashrc —> /etc/bashrc —> /etc/profile.d/*.sh

 

 

为用户添加别名可以在~/.bashrc内进行添加

添加环境变量可以在~/.bash_profile内进行添加

如果要添加全局的别名可以在/etc/bashrc内添加

如果要添加全局变量,则可以在/etc/profile 或/etc/profile.d/*.sh 内进行添加(/etc/profile.d/这个目录下可以自己创建脚本文件,但是不要忘了加执行权限)

 

 

文档更新时间: 2018-12-13 18:26   作者:张尚