Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

hostname(1) [ultrix man page]

hostname(1)						      General Commands Manual						       hostname(1)

       hostname - print system name

       hostname [nameofhost]

       The  command  prints  the name of the current host, as given before the ``login'' prompt.  The super-user can set the hostname by giving an
       argument; this is usually done in the startup script

See Also
       gethostname(2), sethostname(2)


Check Out this Related Man Page

gethostname(2)							System Calls Manual						    gethostname(2)

gethostname() - get name of current host system SYNOPSIS
returns in the array to which hostname points, the standard host name for the current system as set by (see sethostname(2)). size speci- fies the length of the hostname array. hostname is null-terminated unless insufficient space is provided. RETURN VALUE
returns 0 if successful. Otherwise, it returns -1 and sets to indicate the error. ERRORS
can fail if the following is true: hostname points to an illegal address. The reliable detection of this error is implementation dependent. size is less than one. WARNINGS
It is recommended that programs use to dynamically size the buffer used to accept the host name from This is preferred over use of the con- stant. For cases where the constant must be used, there are two values: 64 and 256. The smaller value is compatible with current releases and is used by default. To use the larger value consult the related documentation (see nodehostnamesize(5)). The administrator may, with appropriate configuration options enabled, set a host name larger than 64 bytes. Existing applications which were compiled using the smaller to size a buffer passed to the system function obtain only the first 64 bytes. This truncation may cause the applications to exhibit anomalous behavior or to fail. AUTHOR
was developed by the University of California, Berkeley. SEE ALSO
hostname(1), uname(1), sethostname(2), uname(2), nodehostnamesize(5). gethostname(2)
Man Page

15 More Discussions You Might Find Interesting

1. IP Networking

How do I configure TCP/IP

How do I configure TCP/IP on an old SCO UNIX 3.2 v4.0 I can't seem to find any type of documentation on it. Can someone give me step by step info or refer some type of article? (11 Replies)
Discussion started by: gguzman
11 Replies

2. UNIX for Dummies Questions & Answers

IP details for Unix/Linux login clients?

Hi there, I am wondering if by logging in to a unix system, if it is possible to get the IP address of the machine I am connecting FROM. I know how I can do this using the name server, but is this possible without a host lookup?:confused: Thanks, -ghoti (15 Replies)
Discussion started by: ghoti
15 Replies

3. Linux

Hostname displays incorrectly

hiii, in many of the linux machines i have tried this but the result is the same everywhere. if there are double letters in a hostname then that is displayed as single letter. e.g. if hostname is set to nepttune then login into the shell will display : NEPTUNE(admin)@/ $ hostname... (15 Replies)
Discussion started by: shamik
15 Replies

4. Solaris

changing ip and hostname on solaris

dears does any one know in steps how can i change ip and hostname on solaris (10 Replies)
Discussion started by: murad.jaber
10 Replies

5. 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: 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

6. IP Networking

Configure DNS

I am running Solaris 2.6 Server on a Sparc 10 and I was wondering how I can manually specify a DNS server to resolve hostnames. Any help will be greatly appreciated. And also I have created a file in the /etc dir named defaultrouter and added th IP address of my router, but when I ping another... (15 Replies)
Discussion started by: jskillet
15 Replies

7. AIX

How to show hostname infor after login

When I login AIX console, how to show hostname before any command: hostname:/#>id uid=0(root) gid=0(system) groups=2(bin),3(sys),7(security),8(cron),10(audit),11(lp) (15 Replies)
Discussion started by: rainbow_bean
15 Replies

8. UNIX for Dummies Questions & Answers

Resolve IP to Hostname?

Good day, I would like to resolve IP's to Hostnames using Putty. I'm using Mandriva Linux 2008.0. Is this possible? Perhaps with nmap? (13 Replies)
Discussion started by: McGuywer
13 Replies

9. Shell Programming and Scripting

FQDN into domain name and hostname

I'm working on a rather large script atm (it already takes 9 arguments). As such, I need to obtain both a server name and domain from the FQDN. From this, I want to both populate the hostname of the server, as well as the domain line in the /etc/resolv.conf file. Obviously, this isn't working. I... (10 Replies)
Discussion started by: msarro
10 Replies

10. Solaris

hostname.bge0 failing after creating bge0:1 and rebooting

Hello, I've got a puzzler here but it might be quick solution for some of you. I'm trying to add a second IP address to a network adapter on a Solaris 10 box. I've created a hostname.bge0:1 file and put in the new name, e.g. I've added the new IP and the name to hosts. I've... (12 Replies)
Discussion started by: Friedrich
12 Replies

11. Shell Programming and Scripting

Getting hostname using ssh

I am writing a script and need to get the hostname of the remote server in order to zip that file... the syntax in which the file is named is "hostname.html." This is the line I am trying to use ssh $host "/bin/gzip /tmp/`hostname`.html" >> $PATH_TMP/Linux_cfg2html.log but whenever I run it... (26 Replies)
Discussion started by: eponcedeleonc
26 Replies

12. Shell Programming and Scripting

How to extract hostname from file using awk?

Hi iam having file with below lines of text pun-ras-bng-mhs-01#cont enk-ras-bng-cse-01#cont how to extract the host name and store in a variable and to print output using awk command output will be HOSTNAME pun-ras-bng-mhs-01 enk-ras-bng-cse-01 Tnx in advance. (13 Replies)
Discussion started by: surender reddy
13 Replies

13. Shell Programming and Scripting

Script Shell Extracting hostname

Hi all, Please i have to get hostname of an ip address ( so i have used the command 'host' host $ipaddr >> iptohostname.txt Here is my file: iptohostname.txt domain name pointer domain name pointer... (11 Replies)
Discussion started by: chercheur111
11 Replies

14. IP Networking

DNS problem : ping doesn't recognize hostname

I have vmware on my windows PC ( hostname : acer ). vmware has RHEL 7 ( hostname : rhel7 ) installed recently. RHEL IP configuration IP : Netmask : ssh to rhel7 works from acer using putty resolve.conf cat /etc/resolv.conf nameserver host... (12 Replies)
Discussion started by: hiten.r.chauhan
12 Replies

15. AIX

AIX Syslog where the hostname sit

Dear all experts, I would like to know where can I find the hostname located as when I receive the syslog, I can only see as below : (showing in localhost instead of the hostname) Feb 6 15:31:31 localhost syslog:info syslogd: restart Feb 6 15:31:50 localhost syslog:info syslogd: restart Feb... (13 Replies)
Discussion started by: kwliew999
13 Replies

Featured Tech Videos