LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 06-22-2010, 03:18 AM   #1
hari85
LQ Newbie
 
Registered: Jun 2010
Posts: 18
Blog Entries: 1

Rep: Reputation: 0
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~]#
.......................................
 
Old 06-22-2010, 03:24 AM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,503

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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
[\u@\h \W]\$
 
Old 06-22-2010, 03:37 AM   #3
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,245
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
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/*.
 
Old 06-22-2010, 04:10 AM   #4
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
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
127.0.0.1       myhostname localhost.localdomain   localhost

# more /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=myhostname
Post the contents of these files.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
passing parameters from a unix shell prompt into a windows cmd.exe prompt nano2 Programming 1 09-01-2009 11:26 AM
df -h show incorrect information ryanjliles Linux - Networking 2 07-25-2007 04:26 PM
[SOLVED] SENDMAIL EHLO replies with incorrect hostname! PLZ HELP! Whatever123 Linux - Networking 4 05-23-2005 10:56 AM
configure bash to not show what you type until the prompt juanbobo Linux - Software 1 04-01-2005 01:55 PM
changing the BASH shell prompt 24jedi *BSD 12 03-01-2005 03:11 AM


All times are GMT -5. The time now is 04:03 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration