---
title: "/etc/profile和/root/.bash_profile有什么区别"
author: "nethub2"
date: "2017-11-19T21:37:40Z"
tags: []
categories: ["编程语言"]
slug: "etc-profile-root-bash-profile"
draft: false
lastmod: "2017-11-19T22:36:32Z"
id: 2400212
url: "https://nethub2.iteye.com/blog/2400212"
---

**/etc/profile**,优先级最高,是全局的，是私有的,用于整个系统所有用户，

**~/.bashrc**和 ~/.bash\_profile, ~/.profile 用于各个用户，这里的"~"符号就是各当前用户的$HOME

~/.bash\_profile 和 ~/.profile 只在登陆时读取一次。

**~/.bashrc 每次都读取**

 

**~/.bash\_profile 和 ~/.profile 的区别在于**

bash 只读取~/.bash\_profile；而对于 ~/.profile 来说，不光bash, 其他shell 也读 ~/.profile