解决shell命令行只显示-bash-4.1#不显示用户和路径方法

今天使用远程ssh连接NAS服务器的时候,发现不显示用户和路径,需要进行设置:

1. bashrc
在当前目录下新建.bashrc文件:
# touch ~/.bashrc
# vim ~/.bashrc
并输入以下数据(注意:[]中有空格)
# .bashrc
 
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
# User specific aliases and functions
source以下使得其生效:
# source ~/.bashrc
2. bash_profile
在当前目录下新建.bash_profile文件:
# touch ~/.bash_profile
# vim ~/.bash_profile
并输入以下数据
# .bash_profile
 
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
source以下使得其生效:
# source ~/.bash_profile
3.如果此时还是不能正常显示,请看下面:
步骤如下:
vi ~/.bash_profile
(不用管.bash_profile这个文件有几个,自己新建一个也是可以的) 
 
在最后加上
export PS1='[\u@\h \W]\$'
然后执行
source ~/.bash_profile
这样shell就可以显示路径了。


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值