hostname command prints nothing a null value

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat hostname command prints nothing a null value
# 1  
Old 02-26-2012
Error hostname command prints nothing a null value

Hi ,

On my box everything works fine. But whenever I run command

Quote:
[root@(none) ~]#/bin/hostname
[root@(none) ~]#
It returns nothing as you see @(none) too.

Quote:
[root@(none) ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain
192.168.144.128 localhost localhost.localdomain

[root@(none) ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME="localhost.localdomain"
[root@(none) ~]#

[root@(none) ~]# printenv | less
HOSTNAME=
SELINUX_ROLE_REQUESTED=
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000


[root@(none) ~]# which hostname
/bin/hostname
[root@(none) ~]#


[root@(none) ~]# cat /etc/HOSTNAME
127.0.0.1 localhost localhost.localdomain

[root@(none) ~]# /bin/hostname localhost.localdomain
[root@(none) ~]# hostname

[root@(none) ~]#

Its very strange issue I have never noticed on any other system yet.

Any one have any idea about this.

Thank you

Last edited by pratapsingh; 02-26-2012 at 08:54 AM..
# 2  
Old 02-26-2012
Code:
system network restart

# 3  
Old 02-27-2012
Thanks for your reply I found the solution and it was nothing with my setting it was due to the rpm package "net-tool". I just upgraded it using yum and it got fixed .

Also I found that file "/bin/hostname" was an empty file.

Thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

[SOLVED] Issue with hostname command

Hi, i'm having issues with one of my db servers, each time i run the hostname command i get "-a" as result this is the only zone on this server where i have this issue. could any one help me with this issue (5 Replies)
Discussion started by: EduardoDiaz
5 Replies

2. Emergency UNIX and Linux Support

df command for listing 90% + dirs and hostname condition

df -k | grep -v dcs |grep -v Filesystem| awk -F" " '{if(substr($5,0,length($5)-1)>87)print $5" " $6}' >> sms.txt 1) Is it the correct way to list all the filesystems > 90% 2) Is there any way to print hostname in this command ? The hostname should get printed in sms.txt file only when there... (9 Replies)
Discussion started by: ajaypatil_am
9 Replies

3. UNIX Desktop Questions & Answers

hostname in command prompt

Hello, all. Running 11.04. Is there a way that, in an ssh or telnet session, that hostname will not appear in the command prompt? Not logged in yet, so not seeking a user shell environment. I just want to see something like 'login>', not 'ubuntu login>'. ---------- Post updated at 07:50 PM... (3 Replies)
Discussion started by: mfearer
3 Replies

4. Red Hat

Hostname command issue

Hi All, I am using redhat Linux 5.2.2 on vmware. I have created VM Machine using kickstart & rest 10 machines i created using vmware cloning. On the base machine which i installed from kickstart its showing FQDN using hostname --fqdn but cloned machines are showing hosts name i have chnaged... (1 Reply)
Discussion started by: ajaincv
1 Replies

5. AIX

Command last displays wrong hostname

I faced an interesting problem on my AIX servers. When I checked last logins with command last I saw that hostnames are wrong. Let say, I made login from workstation xxxxx and with the command last I saw: root pts/2 yyyyy 5 jan 15:38 still logged in Ping xxxxx and ping... (3 Replies)
Discussion started by: giovanni
3 Replies

6. IP Networking

gethostbyname_r returns NULL when hostname has dash

We have a code to find the DNS entry of a host that has a trailing '-' in its url (format example: mysite-.watch.com): if(gethostbyname_r(host,host_ent,host_buffer,host_buffer_size,&host_error)==NULL) { //failed } But when remove the '-' from the host name the code does not return... (12 Replies)
Discussion started by: uunniixx
12 Replies

7. Solaris

How to display hostname in command prompt

Anyone know How to configure solaris 8 to display hostname in command prompt , everytime when you open a terminal screen . (3 Replies)
Discussion started by: civic2005
3 Replies

8. Linux

Command that prints content of line5, or similar?

Hello all; I've been having trouble completing a script (bash) because I can't get past the issue of finding a line in a file. For example, I have a file like this: ddmmmyyyy Lon Lat 24may2003 -100.0 24.1 25may2003 -100.1 24.0 28may2003 -99.5 23.2 ....etc... (4 Replies)
Discussion started by: lunchtime
4 Replies

9. UNIX for Dummies Questions & Answers

Solaris - unknown hostname - how can I change hostname?

Hello, I am new to Solaris. I am using stand alone Solaris 10.0 for test/study purpose and connecting to internet via an ADSL modem which has DHCP server. My Solaris is working on VMWare within winXP. My WinXP and Solaris connects to internet by the same ADSL modem via its DHCP at the same... (1 Reply)
Discussion started by: XNOR
1 Replies

10. UNIX for Advanced & Expert Users

Cisco Router command to get hostname

Hi All, I am connected to a cisco router and I want to know the hostname of this router. I connect as telnet <IPADDRESS> and the prompt shows vpnaccess-bristol> But I want to know the full hostname of the router how can i do that. When i type the hostname command the following... (3 Replies)
Discussion started by: rahulrathod
3 Replies
Login or Register to Ask a Question