How to get the remote hostname


Hi group,

machine A has a connection to macine B.

It is possible to run some command on machine B as you are on machine A such as:

# ssh  10.0.27.254  ls
# ssh  10.0.27.254  mkdir aDir

but when I do

# ssh 10.0.27.254  echo $HOSTNAME  it doesn't print the name of the remote machine (B)

How can I get that information?

Thanks,
akohanAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
amit_gConnect With a Mentor Commented:
Use command hostname ...

ssh 10.0.27.254  hostname
0
 
amit_gCommented:
Why B?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.