首页 > 系统服务 > 详细

LinuxのユーザProfile

时间:2014-03-29 11:07:30      阅读:470      评论:0      收藏:0      [点我收藏+]

○Linuxでbashがログインシェルとして起動する場合

ユーザ環境の設定ファイルは次の順番で読み込まれます。

1./etc/profileを読み込む
2.~/.bash_profile, ~/.bash_login, ~/.profile
    の順でファイルを検索して、最初に見つかったファイルを読み込む


~/.bash_profileが見つかった場合

3.~/.bash_profileから~/.bashrcを読み込む
4.~/.bashrcから/etc/bashrcを読み込む


RedHat AS4のデフォルトの~/.bash_profile

$ cat ~/.bash_profile
# .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
unset USERNAME


RedHat AS4のデフォルトの~/.bashrc

$ cat ~/.bashrc
# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi



○bashをログイン時以外に起動した場合

1.~/.bashrcを読み込む
2.~/.bashrcから/etc/bashrcを読み込む



○設定ファイルの使い分け

/etc/profile:全ユーザに対して設定したい場合に使用。一回設定しておけば良い設定に使用。
~/.bash_profile:ユーザ個別に設定したい場合に使用。一回設定しておけば良い設定に使用。
~/.bashrc:エイリアス設定などシェル起動時に毎回設定する必要がある場合に使用。

LinuxのユーザProfile,布布扣,bubuko.com

LinuxのユーザProfile

原文:http://www.cnblogs.com/chenbai/p/3631005.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!