19ddb49cbSWarner Losh.\"- 24b88c807SRodney W. Grimes.\" Copyright (c) 1983, 1988, 1990, 1993 34b88c807SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 44b88c807SRodney W. Grimes.\" 54b88c807SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 64b88c807SRodney W. Grimes.\" modification, are permitted provided that the following conditions 74b88c807SRodney W. Grimes.\" are met: 84b88c807SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 94b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 104b88c807SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 114b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 124b88c807SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 13fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 144b88c807SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 154b88c807SRodney W. Grimes.\" without specific prior written permission. 164b88c807SRodney W. Grimes.\" 174b88c807SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 184b88c807SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 194b88c807SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 204b88c807SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 214b88c807SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 224b88c807SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 234b88c807SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 244b88c807SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 254b88c807SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 264b88c807SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 274b88c807SRodney W. Grimes.\" SUCH DAMAGE. 284b88c807SRodney W. Grimes.\" 2951457784SFernando Apesteguía.Dd October 5, 2020 304b88c807SRodney W. Grimes.Dt HOSTNAME 1 31caa2db3bSRuslan Ermilov.Os 324b88c807SRodney W. Grimes.Sh NAME 334b88c807SRodney W. Grimes.Nm hostname 34*26cf4a61SChia-Jung Chang.Nd set or print the name of current host system 354b88c807SRodney W. Grimes.Sh SYNOPSIS 36be8b1497SRuslan Ermilov.Nm 3731500ce9SMarcelo Araujo.Op Fl f 3831500ce9SMarcelo Araujo.Op Fl s | d 39113b529fSSteve Price.Op Ar name-of-host 404b88c807SRodney W. Grimes.Sh DESCRIPTION 41e004acc8SPhilippe CharnierThe 42e004acc8SPhilippe Charnier.Nm 43eccea571SRuslan Ermilovutility prints the name of the current host. 44eccea571SRuslan ErmilovThe super-user can 454b88c807SRodney W. Grimesset the hostname by supplying an argument; this is usually done in the 460f0a3e4fSRuslan Ermilovinitialization script 47f1caa99dSGiorgos Keramidas.Pa /etc/rc.d/hostname , 484b88c807SRodney W. Grimesnormally run at boot 494b88c807SRodney W. Grimestime. 50b6c1f94fSJohn BaldwinThis script uses the 51b6c1f94fSJohn Baldwin.Va hostname 52b6c1f94fSJohn Baldwinvariable in 53b6c1f94fSJohn Baldwin.Pa /etc/rc.conf . 544b88c807SRodney W. Grimes.Pp 554b88c807SRodney W. GrimesOptions: 564b88c807SRodney W. Grimes.Bl -tag -width flag 57a426a286STim Kientzle.It Fl f 58a426a286STim KientzleInclude domain information in the printed name. 59a426a286STim KientzleThis is the default behavior. 604b88c807SRodney W. Grimes.It Fl s 6161c9c5ebSPhilippe CharnierTrim off any domain information from the printed 624b88c807SRodney W. Grimesname. 6331500ce9SMarcelo Araujo.It Fl d 6431500ce9SMarcelo AraujoOnly print domain information. 654b88c807SRodney W. Grimes.El 6651457784SFernando Apesteguía.Sh EXAMPLES 6751457784SFernando ApesteguíaSet the host name of the machine and check the result: 6851457784SFernando Apesteguía.Bd -literal -offset indent 6951457784SFernando Apesteguía$ hostname beastie.localdomain.org 7051457784SFernando Apesteguía$ hostname 7151457784SFernando Apesteguíabeastie.localdomain.org 7251457784SFernando Apesteguía.Ed 7351457784SFernando Apesteguía.Pp 7451457784SFernando ApesteguíaDo not show domain information: 7551457784SFernando Apesteguía.Bd -literal -offset indent 7651457784SFernando Apesteguía$ hostname -s 7751457784SFernando Apesteguíabeastie 7851457784SFernando Apesteguía.Ed 7951457784SFernando Apesteguía.Pp 8051457784SFernando ApesteguíaShow only domain information: 8151457784SFernando Apesteguía.Bd -literal -offset indent 8251457784SFernando Apesteguía$ hostname -d 8351457784SFernando Apesteguíalocaldomain.org 8451457784SFernando Apesteguía.Ed 854b88c807SRodney W. Grimes.Sh SEE ALSO 86b6c1f94fSJohn Baldwin.Xr gethostname 3 , 87b6c1f94fSJohn Baldwin.Xr rc.conf 5 884b88c807SRodney W. Grimes.Sh HISTORY 894b88c807SRodney W. GrimesThe 9061c9c5ebSPhilippe Charnier.Nm 914b88c807SRodney W. Grimescommand appeared in 924b88c807SRodney W. Grimes.Bx 4.2 . 93