zoukankan      html  css  js  c++  java
  • 【原创】linux shell中不显示路径了,显示为-bash-4.1#的两种解决办法

    出现这个问题的原因是因为没有配置.bash_profile的问题,或者是我们不小心清空或删除了.bash_profile文件。

    办法一:修改 ~/.bash_profile文件

    步骤如下:

    vim ~/.bash_profile

    (不用管.bash_profile这个文件有几个,自己新建一个也是可以的)

    在最后加上

    export PS1='[u@h W]$'

    然后执行

    source ~/.bash_profile

    这样shell就可以显示路径了。

    方法二:拷贝新用户到root用户

    -bash-4.1# ll -a
    total 84
    dr-xr-x---.  5 root root  4096 May  7 08:55 .
    dr-xr-xr-x. 23 root root  4096 May  7 16:45 ..
    -rw-------.  1 root root  1182 Apr 19 03:20 anaconda-ks.cfg
    -rw-------.  1 root root  1638 May  7 16:56 .bash_history
    -rw-r--r--.  1 root root    18 May 20  2009 .bash_logout
    -rw-r--r--.  1 root root     0 May  7 16:56 .bash_profile
    -rw-r--r--.  1 root root   177 May  5 03:26 .bashrc
    -rw-r--r--.  1 root root   100 Sep 23  2004 .cshrc
    -rw-r--r--.  1 root root 22179 Apr 19 03:20 install.log
    -rw-r--r--.  1 root root  5890 Apr 19 03:18 install.log.syslog
    -rw-r--r--.  1 root root   129 Dec  4  2004 .tcshrc
    -rw-------.  1 root root   721 May  7 08:55 .viminfo
    -bash-4.1# cp -r /etc/skel/.bash* /root
    -bash-4.1# chown root.root .bash*
    -bash-4.1# logout    <==退出重新登录就可以正常显示路径了
    
    
    Last login: Sat May  7 16:56:04 2016 from 10.0.0.1
    [root@oldboyedu ~]# 
  • 相关阅读:
    封装好的AFN网络请求框架和MBProgress
    iOS定时器的使用
    iOS去除导航栏和tabbar的1px横线
    移动端加解密
    改变字符串中部分字符传的字体大小和颜色
    关于NSLog
    ipad开发:二维码扫描,摄像头旋转角度问题解决办法
    iOS-图文表并茂,手把手教你GCD
    计算富文本的高度
    jsp打印
  • 原文地址:https://www.cnblogs.com/crystal523100/p/5467733.html
Copyright © 2011-2022 走看看