Reputation: 468
I am creating Adobe AIR Application (for Windows, Linux and MAC), which show machine's Internal IP, External IP and Host Name. I've done successfully on Windows. I got host name on Windows by opening the c:\windows\system32\hostname.exe application using the Native for process.
But I don't know that such type of hostname application file exists in Linux or not? If it really exists, then what is its path? How to get host name in Linux through opening any executable file or through any bash command?
Thanks in advance.
Upvotes: 1
Views: 15462
Reputation: 141958
The hostname
command appears in must Unixes.
Here's the path from a Mac (you mention this as one of your target platforms and I don't have a Linux host up at the moment):
% type hostname
hostname is /bin/hostname
You shouldn't need to hard-code the path, though... hostname
is usually within your ${PATH}
environment variable (Q.E.D.). The same should be true for Windows.
Upvotes: 8
Reputation: 3580
The best idea is to use
'$ uname -n'
after using
'$ uname --help'
P.S.: and yes,
$ which uname
/bin/uname
Upvotes: 8