修改shell默认设置

看惯了用户名@主机名 路径的命令行前缀,可能就不喜欢-bash开关的了。
下面是三种如何修改这种设置的方法:

我要修改的/etc/profile
1:临时修改 export PS1='[\u@\h:$PWD]#',或declare -x PS1='[\u@\h:$PWD]#'
2:永久的修改 用vi编辑器进入/etc/profile
vim /etc/profile
增加变量export PS1='[\u@\h:$PWD]#',
然后再运行source /etc/profile,不然要等到下次重启之后才能有效,
这种方法对所有的用户都有效
3:对单一用户永久有效
再用户目录下的.bash_profile文件中添加变量
vim /home/guok/.bash.profile
再.bash.profile中添加export PS1='[\u@\h:$PWD]#',
然后再运行source /home/guok/.bash.profile

猜你喜欢

转载自chembo.iteye.com/blog/1187433