现在的位置: 首页 > 综合 > 正文

federa修改用户设置后 .bashrc文件丢失

2013年09月01日 ⁄ 综合 ⁄ 共 762字 ⁄ 字号 评论关闭

关于.bashrc

使用man bash命令查看到的联机帮助文件中的相关解释如下:
.bashrc - The individual per-interactive-shell startup file.

这个文件主要保存个人的一些个性化设置,如命令别名、路径等。下面是个例子:
# User specific aliases and functions
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
LANG=zh_CN.GBK
export PATH LANG

alias rm='rm -i'
alias ls='/bin/ls -F --color=tty --show-control-chars'

例子中定义了路径,语言,命令别名(使用rm删除命令时总是加上-i参数需要
用户确认,使用ls命令列出文件列表时加上颜色显示)。

每次修改.bashrc后,使用source ~/.bashrc(或者 . ~/.bashrc)
就可以立刻加载修改后的设置,使之生效。

一般会在.bash_profile文件中显式调用.bashrc。登陆linux启动bash时首先会
去读取~/.bash_profile文件,这样~/.bashrc也就得到执行了,你的个性化设
置也就生效了。
丢失后,可以拷贝一份.bash_profile和.bashrc。注意,如果没有.bash_profile,.bashrc是不起作用的。
因为:
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

 

抱歉!评论已关闭.