Linux profile、bashrc、bash_profile
一、profile 文件
1、profile 文件的作用
profile(/etc/profile),用于设置系统级的环境变量和启动程序,在这个文件下配置会对所有用户生效。当用户登录(login)时,文件会被执行,并从/etc/profile.d目录的配置文件中查找 shell 设置。
2、在profile中添加环境变量
一般不建议在/etc/profile文件中添加环境变量,因为在这个文件中添加的设置会对所有用户起作用。当需要添加时,我们可以按以下方式添加,添加一个 HOST 值为 test.com 的环境变量:
export HOST=test.com
添加时,可以在行尾使用;号,也可以不使用。一个变量名可以对应多个变量值,多个变量值使用:分隔。
添加环境变量后,需要重新登录才能生效,也可以使用source命令强制立即生效:
source /etc/profile
查看是否生效可以使用echo命令:
$ echo $HOST
test.com
二、bashrc 文件
这个文件用于配置函数或别名。bashrc 文件有两种级别:系统级的位于/etc/bashrc、用户级的~/.bashrc(比如用户root进入系统路径就是/root/.bashrc),两者分别会对所有用户和当前用户生效。
bashrc文件只会对指定的shell类型起作用,bashrc 只会被 bash shell 调用。
三、bash_profile 文件
bash_profile 只对单一用户有效,文件存储于~/.bash_profile(/root/.bashrc),该文件是一个用户级的设置,可以理解为某一个用户的 profile 目录下。这个文件同样也可以用于配置环境变量和启动程序,但只针对单个用户有效。
和 profile 文件类似,bash_profile 也会在用户登录(login)时生效,也可以用于设置环境变量。但与 profile 不同,bash_profile 只会对当前用户生效。
Linux profile、bashrc、bash_profile的更多相关文章
- linux的/etc/profile、~/.profile、~/.bashrc、~./bash_profile这几个配置文件
在添加环境变量的时候,我们会去修改配置文件 如果留意过,网上博文,有些在/etc/profile文件中配置的,有些是在~./bash_profile文件中配置的,等等 那么,/etc/profile. ...
- Linux 启动时profile、bashrc、~/.bash_profile、~/.bashrc、~/.bash_profile执行顺序以及文件说明
Linux 启动时profile.bashrc.~/.bash_profile.~/.bashrc.~/.bash_profile执行顺序以及文件说明 一.执行顺序 登录linux时,/etc/pro ...
- linux关于profile 、bashrc 、.bash_profile、.bashrc的区别
linux关于profile .bashrc ..bash_profile..bashrc的区别 - /etc/profile /etc/bashrc ~/.bash_profile ~/.bashr ...
- linux下/etc/profile、/etc/bashrc、~/.bashrc 和~/.bash_profile文件的区别
这个一定要理解登录式shell和非登录式shell的区别,前者是完全切换用户,后者是不完全,就算切换过来了,你pwd时家目录还是之前的家目录,所以 登录式顺序为:/etc/bashrc---/etc/ ...
- Linux-profile、bashrc、bash_profile之间的区别和联系
为使Bash更好地为我们服务,我们需定制bash shell环境. ~/.bash_profile.~/.bashrc.和~/.bash_logout 上面这三个文件是bash shell的用户环境配 ...
- Linux系统profile、bashrc、bash_profile等环境设置文件的使用
一.前言 关于bash的环境设置文件,分为系统设置和个人设置,一般来说建议用户直接修改个人的设置. 本文测试环境为:centos6.5. 二.系统设置值 1. /etc/sysconfig/i18n ...
- Linux profile1,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part1
profile,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part 1 by:授客 QQ:103355312 ...
- Linux中profile、bashrc、bash_profile之间的区别和联系
/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集shell的设置. 英文描述为: # /etc/pr ...
- (转) Linux中profile、bashrc、bash_profile之间的区别和联系
原文地址:http://blog.csdn.net/chenchong08/article/details/7833242 /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登 ...
- 【转】Linux中profile、bashrc、bash_profile之间的区别和联系
/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登陆时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集shell的设置. 英文描述为: # /etc/pr ...
随机推荐
- vue打印图片
element 中图片打印 [vue element 如何打印弹窗里的内容 无效](https://segmentfault.com/q/1010000015097252) vue element 如 ...
- react 01基础 样式
一,react 特点 1. 声明式设计 2.虚拟dom 3.jsx 4.组件化,模块化 5.单向数据流 二,脚手架 Create React App npm i -g create-react-app ...
- vue页面添加锚点后 点击不改变URL
html: <a @click="changeHash('#row')"> {{ $t("msg.desc1") }} </a> j ...
- KU060板卡设计资料原理图第636篇:基于FMC的KU060高性能 PCIe 载板
基于FMC的KU060高性能 PCIe 载板 一.板卡概述 板卡主控芯片采用Xilinx 公司的 Kintex UltraScale系列FPGA XCKU060-2FFVA1156.板载 2 组 64 ...
- vue实现全部防抖
// 全局注册防抖 Vue.component("ElButton").mixin({ data() { return { debounce: false ...
- 微积分 II 笔记
5.1 定积分的概念 定义 定积分是积分的一种,是函数 \(f(x)\) 在区间 \([a,b]\) 上积分和的极限 若 \(f(x)\) 在 \([a, b]\) 有界,在 \([a, b]\) 上 ...
- sync.Once
保证在 Go 程序运行期间的某段代码只会执行一次 func main() { o := &sync.Once{} for i := 0; i < 10; i++ { o.Do(func( ...
- (已解决)nginx+php 上传文件大小设置。
1. 问题 上传文件过大报错,413 Request Entity Too Large. 2. 解决方法 修改配置文件,在以下两处: a. php.ini文件(php目录) 在File Uploads ...
- wireshark抓包海康威视摄像头
1:不清楚海康威视摄像头IP地址:网线直连电脑,打开wireshark抓包 2:抓包在source能看到 Hangzhou类似 说明是摄像头.ARP协议 然后192.168.0.251 是摄像 ...
- PyTorch Live get started from Windows
〇. PyTorch Live https://pytorch.org/live/docs/tutorials/get-started-manually/ 以下 命令 建议都用 以管理员身份运行的 P ...