有两个步骤可以完成此操作。
步骤 1)确保您的用户正在使用 bash shell。查看 /etc/passwd 中每个用户的条目并确保它以 /bin/bash 结尾。例如,如果你看到这个:
joeuser:x:1234:1234:Joe User:/home/joeuser:/bin/sh
Run Code Online (Sandbox Code Playgroud)
然后将其更改为:
joeuser:x:1234:1234:Joe User:/home/joeuser:/bin/bash
Run Code Online (Sandbox Code Playgroud)
使用 bash 应该可以解决向上箭头问题,并将启用下一步。
步骤 2)如果您仍然没有看到当前工作目录的提示,请告诉 bash 这就是您想要的。有两种方法可以做到这一点。添加以下行:
export PS1='\w> '
Run Code Online (Sandbox Code Playgroud)
要么
.bash_profile文件;或者/etc/profile文件这一行分配了PS1代表主 shell 提示的变量。我建议把它放进去,/etc/profile因为这更容易,并为所有用户提供有用的提示。如果用户想要其他提示,他们可以随时编辑自己的.bash_profile文件。
注意:如果您的系统有 ,/etc/bash.bashrc则将行放在那里而不是/etc/profile.
| 归档时间: |
|
| 查看次数: |
1378 次 |
| 最近记录: |