初识Linux .bash_profile, .bash_logout, and .bashrc 文件
.bash_profile非常重要,你每次登录shell的时候都要去读这个文件(并且只在登录时读取)。查看该文件,可能是如下内容:
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
SHELL=/bin/bash
MANPATH=/usr/man:/usr/X11/man
EDITOR=/usr/bin/vi
PS1='\h:\w\$ '
PS2='> '
export EDITOR
你可以用vi或者emacs对其进行编辑(建议不要更改原来的内容,只要把你要写的内容添加在后面就行,或者在进行编辑之前对其进行备份)。修改完并不会立即生效,系统必须re-read一下才行。你可以退出并重新登录系统,或者用source .bash_profile命令使之生效。
.bash_logout相反,每次退出shell的时候才去读这个文件(并且只在退出时读取)。如果你需要在退出系统的时候执行一些命令,比如清除一些临时文件,清除一些日志,你可以把命令写入该文件。该文件并不是必须存在的,当你发现你的账号没有这个文件,那么意味着你退出系统的时候,没有指定的额外的命令需要执行。
各种版本的shell命名.bash_profile这个文件的方式有所不同。所以当你看到.bash_login,它就对应前文所提的.bash_profile。如果你使用bash登录,bash首先回去寻找.bash_profile文件,如果该文件不存在,则会自动寻找.bash_login,如果还是不存在,则自动再去寻找 .profile 文件。
.bashrc,The difference between this script and .bashrc is that .bash_profile runs only when you log in. It was originally designed so that you could separate interactive shells from those run by background processors such as cron.But it is not very useful on modern computers with the X Window System because when you open a new terminal window, only .bashrc runs. If you start up a window with the command xterm -ls, it will run .bash_profile too.
转载于:https://www.cnblogs.com/starspace/archive/2009/02/23/1396250.html
初识Linux .bash_profile, .bash_logout, and .bashrc 文件相关推荐
- linux终端更改bashrc文件,linux .bashrc文件修改和生效
linux .bashrc文件修改和生效 cd home ==>选择用户文件夹=>ll -la .bashrc 使用man bash命令查看到的联机帮助文件中的相关解释如下: .ba ...
- linux启动 profile,Linux 启动时profile、bashrc、~/.bash_profile、~/.bashrc、~/.bash_profile执行顺序以及文件说明...
Linux 启动时profile.bashrc.~/.bash_profile.~/.bashrc.~/.bash_profile执行顺序以及文件说明 一.执行顺序 登录linux时,/etc/pro ...
- linux下的环境变量/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc文件
/etc/profile 此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从 /etc/profile.d 目录的配置文件中收集 shell 的设置.如果你有对 /etc/pr ...
- linux shell 执行多个文件,/etc/profile、~/.bash_profile等几个文件的执行过程
关于登录linux时,/etc/profile.~/.bash_profile等几个文件的执行过程. 在登录Linux时要执行文件的过程如下: 在 刚登录Linux时,首先启动 /etc/profil ...
- 【转】Linux 之 /etc/profile、~/.bash_profile 等几个文件的执行过程
原文网址:http://blog.csdn.net/ithomer/article/details/6322892 在登录Linux时要执行文件的过程如下: 在刚登录Linux时,首先启动 /etc/ ...
- linux终端出现bash: setup.bash: No such file or directory,和.bashrc文件的问题
前段时间linux中打开终端时,总是出现bash: /opt/ros/indig/setup.bash: No such file or directory的问题.此问题跟每次终端打开时要加载的bas ...
- 关于登录linux时,/etc/profile、~/.bash_profile等几个文件的执行过程
关于登录linux时,/etc/profile.~/.bash_profile等几个文件的执行过程. 在登录Linux时要执行文件的过程如下: 在刚登录Linux时,首先启动 /etc/profile ...
- LINUX下配置bashrc文件/ PATH环境变量修改/别名/提示符
1) .bashrc文件 在linux系统普通用户目录(cd /home/xxx)或root用户目录(cd /root)下,用指令ls -al可以看到4个隐藏文件, .bash_history 记 ...
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文件的作用
转载自:http://blog.csdn.net/u013968345/article/details/21262033 /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登 ...
最新文章
- linux 内核模块加载错误 disagree about version of symbol module_layout
- 健康研究总结摘录专题
- Bitmap 索引 vs. B-tree 索引:如何选择以及何时使用?——4-5
- 移动pc常用Meta标签
- Ubuntu中安装python3
- pptx库ppt演示 python_Python自动化操作PPT看这一篇就够了
- 命名 —— 函数、类的命名
- Unity多个场景叠加或大场景处理方法小结
- vue 导出excel
- GPS-GGA数据格式
- Chm 文件资源编辑软件
- iPad谷歌浏览器怎么开摄像头_谷歌浏览器网页截图的步骤_谷歌浏览器怎么截图...
- Medusa学习Medusa参数使用
- 在x86下交叉编译mips程序
- Markdown表格中换行、合并单元格
- sequoia的架构
- 自动驾驶(四十七)---------超声波雷达简介
- android 颜色 数组,在Android中声明维数,颜色,资源ID或其他非标准数据类型的数组?...
- 最新PHP开源采集器/蓝天采集器系统源码
- [转]Unix下针对邮件,搜索,网络硬盘等海量存储的分布式文件系统项目(关于GFS、MogileFS分布式文件系统邮件列表)