Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 03-25-2014, 11:34 AM   #1
Registered: Sep 2009
Posts: 117

Rep: Reputation: 15
hostname command not found

hello all,

Im getting the strangest error. When I attempt to run the hostname command, I keep getting the following error:

/bin/hostname: Command not found

I've verified that the hostname command exists and installed:

# which hostname

# ls -l /bin/hostname
-rwxr-xr-x 1 root root 17848 Apr 26 2012 /bin/hostname

# /bin/hostname
/bin/hostname: Command not found

# rpm -qa | grep net-tools

Also there is another user logging into this server via ssh and they are getting another error:

$ hostname
hostname: hostname: cannot execute [Exec format error]

This is user is in the ksh shell compared to the BASH shell I'm in above. All $PATH variables are correct. I'm out of ideas.... Has anyone experienced this issue before?

Old 03-25-2014, 12:46 PM   #2
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
what is the output of

file /bin/hostname
uname -m
Old 03-25-2014, 12:55 PM   #3
Senior Member
Registered: Aug 2009
Distribution: CentOS
Posts: 4,535

Rep: Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077
And, if those don't yield a clue, the output from
ldd /bin/hostname
might be instructive.
Old 03-25-2014, 12:58 PM   #4
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 7
Posts: 3,532

Rep: Reputation: 974Reputation: 974Reputation: 974Reputation: 974Reputation: 974Reputation: 974Reputation: 974Reputation: 974
Also "alias"
Old 03-25-2014, 01:07 PM   #5
Registered: Sep 2009
Posts: 117

Original Poster
Rep: Reputation: 15
Please see below:

# uname -a
Linux or1dlxvp002 2.6.32-358.23.2.el6.x86_64 #1 SMP Sat Sep 14 05:32:37 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
# file /bin/hostname
/bin/hostname: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
# uname -m
# ldd /bin/hostname => (0x00007fffc5cdb000) => /lib64/ (0x0000003de7e00000) => /lib64/ (0x0000003de6600000) => /lib64/ (0x0000003de6200000)
/lib64/ (0x0000003de5e00000)
Old 03-30-2014, 02:49 AM   #6
Registered: Oct 2013
Distribution: RedHat CentOS Fedora SuSE
Posts: 353

Rep: Reputation: 51
# rpm -V net-tools
Let's see if binary really broken.


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
HOSTNAME = hostname -> HOSTNAME: command not found ? thomas2004ch Linux - Software 2 08-26-2013 08:25 PM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM
hostname not found? iansworld SUSE / openSUSE 1 12-08-2004 07:03 PM
hostname command vs. $HOSTNAME env. variable Silly22 Linux - Networking 2 03-29-2002 05:01 PM
hostname: not found php Linux - General 2 11-19-2001 06:44 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:09 PM.

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