![]() |
bash shell prompt show incorrect hostname.
my bash shell prompt displays this station name @localholocalholocalhost.
i checked my system's /etc/hosts entry.. vi /etc/hosts ................. #not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost # ::1 localhost6.localdomain6 localhost6 192.168.10.18 localhost.localdomain ....................................................... still it shows... [root@localholocalholocalholocalhost ~]# ........................................ my company doesn't have a DNS. ip address is static. distro:centos 5.3 kernel 2.6 ........................... pls help me to show my prompt like [root@localhost~]# ....................................... |
The prompt format is controlled by the environment variable PS1. What is its value? Here's mine on CentOS box, having a prompt similar to what you require:
Code:
[root@linux ~]# echo $PS1 |
Everything's probably depending on how PS1 is generated by your profile/boot scripts with respect to bash. Also, sometimes like in Gentoo and Slackware, a normal user has a different prompt compared to a root user. If you can, you may check and read /etc/profile and ~/.bashrc.
This is very dependent on your distro's implementation though. Sometimes more scripts are related to the variable like /etc/env.d/*. |
If you're using a Red Hat like distro (RHEL, CentOS, Fedora etc) you would need your hostname configured in /etc/hosts and /etc/sysconfig/network:
Code:
# more /etc/hosts |
| All times are GMT -5. The time now is 06:12 PM. |