xref: /freebsd/bin/freebsd-version/freebsd-version.1 (revision 6fd07539f028f6e79cb027bfcd26bcec27e68c9c)
15f385077SDag-Erling Smørgrav.\"-
25f385077SDag-Erling Smørgrav.\" Copyright (c) 2013 Dag-Erling Smørgrav
35f385077SDag-Erling Smørgrav.\" All rights reserved.
45f385077SDag-Erling Smørgrav.\"
55f385077SDag-Erling Smørgrav.\" Redistribution and use in source and binary forms, with or without
65f385077SDag-Erling Smørgrav.\" modification, are permitted provided that the following conditions
75f385077SDag-Erling Smørgrav.\" are met:
85f385077SDag-Erling Smørgrav.\" 1. Redistributions of source code must retain the above copyright
95f385077SDag-Erling Smørgrav.\"    notice, this list of conditions and the following disclaimer.
105f385077SDag-Erling Smørgrav.\" 2. Redistributions in binary form must reproduce the above copyright
115f385077SDag-Erling Smørgrav.\"    notice, this list of conditions and the following disclaimer in the
125f385077SDag-Erling Smørgrav.\"    documentation and/or other materials provided with the distribution.
135f385077SDag-Erling Smørgrav.\"
145f385077SDag-Erling Smørgrav.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
155f385077SDag-Erling Smørgrav.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
165f385077SDag-Erling Smørgrav.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
175f385077SDag-Erling Smørgrav.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
185f385077SDag-Erling Smørgrav.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
195f385077SDag-Erling Smørgrav.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
205f385077SDag-Erling Smørgrav.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
215f385077SDag-Erling Smørgrav.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
225f385077SDag-Erling Smørgrav.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
235f385077SDag-Erling Smørgrav.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
245f385077SDag-Erling Smørgrav.\" SUCH DAMAGE.
255f385077SDag-Erling Smørgrav.\"
265f385077SDag-Erling Smørgrav.\" $FreeBSD$
275f385077SDag-Erling Smørgrav.\"
28*6fd07539SDag-Erling Smørgrav.Dd November 14, 2017
295f385077SDag-Erling Smørgrav.Dt FREEBSD-VERSION 1
305f385077SDag-Erling Smørgrav.Os
315f385077SDag-Erling Smørgrav.Sh NAME
325f385077SDag-Erling Smørgrav.Nm freebsd-version
335f385077SDag-Erling Smørgrav.Nd print the version and patch level of the installed system
345f385077SDag-Erling Smørgrav.Sh SYNOPSIS
355f385077SDag-Erling Smørgrav.Nm
36*6fd07539SDag-Erling Smørgrav.Op Fl kru
375f385077SDag-Erling Smørgrav.Sh DESCRIPTION
385f385077SDag-Erling SmørgravThe
395f385077SDag-Erling Smørgrav.Nm
405f385077SDag-Erling Smørgravutility makes a best effort to determine the version and patch level
415f385077SDag-Erling Smørgravof the installed kernel and / or userland.
425f385077SDag-Erling Smørgrav.Pp
435f385077SDag-Erling SmørgravThe following options are available:
445f385077SDag-Erling Smørgrav.Bl -tag -width Fl
455f385077SDag-Erling Smørgrav.It Fl k
465f385077SDag-Erling SmørgravPrint the version and patch level of the installed kernel.
475f385077SDag-Erling SmørgravUnlike
485f385077SDag-Erling Smørgrav.Xr uname 1 ,
495f385077SDag-Erling Smørgravif a new kernel has been installed but the system has not yet
505f385077SDag-Erling Smørgravrebooted,
515f385077SDag-Erling Smørgrav.Nm
525f385077SDag-Erling Smørgravwill print the version and patch level of the new kernel.
53*6fd07539SDag-Erling Smørgrav.It Fl r
54*6fd07539SDag-Erling SmørgravPrint the version and patch level of the running kernel.
55*6fd07539SDag-Erling SmørgravUnlike
56*6fd07539SDag-Erling Smørgrav.Xr uname 1 ,
57*6fd07539SDag-Erling Smørgravthis is unaffected by environment variables.
585f385077SDag-Erling Smørgrav.It Fl u
595f385077SDag-Erling SmørgravPrint the version and patch level of the installed userland.
605f385077SDag-Erling SmørgravThese are hardcoded into
615f385077SDag-Erling Smørgrav.Nm
625f385077SDag-Erling Smørgravduring the build.
635f385077SDag-Erling Smørgrav.El
645f385077SDag-Erling Smørgrav.Pp
65*6fd07539SDag-Erling SmørgravIf several of the above options are specified,
665f385077SDag-Erling Smørgrav.Nm
67*6fd07539SDag-Erling Smørgravwill print the installed kernel version first, then the running kernel
68*6fd07539SDag-Erling Smørgravversion, and finally the userland version, on separate lines.
695f385077SDag-Erling SmørgravIf neither is specified, it will print the userland version only.
705f385077SDag-Erling Smørgrav.Sh IMPLEMENTATION NOTES
715f385077SDag-Erling SmørgravThe
725f385077SDag-Erling Smørgrav.Nm
735f385077SDag-Erling Smørgravutility should provide the correct answer in the vast majority of
745f385077SDag-Erling Smørgravcases, including on systems kept up-to-date using
755f385077SDag-Erling Smørgrav.Xr freebsd-update 8 ,
765f385077SDag-Erling Smørgravwhich does not update the kernel version unless the kernel itself was
775f385077SDag-Erling Smørgravaffected by the latest patch.
785f385077SDag-Erling Smørgrav.Pp
795f385077SDag-Erling SmørgravTo determine the name (and hence the location) of a custom kernel, the
805f385077SDag-Erling Smørgrav.Nm
815f385077SDag-Erling Smørgravutility will attempt to parse
825f385077SDag-Erling Smørgrav.Pa /boot/defaults/loader.conf
835f385077SDag-Erling Smørgravand
845f385077SDag-Erling Smørgrav.Pa /boot/loader.conf ,
855f385077SDag-Erling Smørgravlooking for definitions of the
865f385077SDag-Erling Smørgrav.Va kernel
875f385077SDag-Erling Smørgravand
885f385077SDag-Erling Smørgrav.Va bootfile
895f385077SDag-Erling Smørgravvariables, both with a default value of
905f385077SDag-Erling Smørgrav.Dq kernel .
915f385077SDag-Erling SmørgravIt may however fail to locate the correct kernel if either or both of
925f385077SDag-Erling Smørgravthese variables are defined in a non-standard location, such as in
935f385077SDag-Erling Smørgrav.Pa /boot/loader.rc .
945f385077SDag-Erling Smørgrav.Sh ENVIRONMENT
955f385077SDag-Erling Smørgrav.Bl -tag -width ROOT
965f385077SDag-Erling Smørgrav.It Ev ROOT
975f385077SDag-Erling SmørgravPath to the root of the filesystem in which to look for
985f385077SDag-Erling Smørgrav.Pa loader.conf
995f385077SDag-Erling Smørgravand the kernel.
1005f385077SDag-Erling Smørgrav.El
1015f385077SDag-Erling Smørgrav.Sh EXAMPLES
1025f385077SDag-Erling SmørgravTo determine the version of the currently running userland:
1035f385077SDag-Erling Smørgrav.Bd -literal -offset indent
1045f385077SDag-Erling Smørgrav/bin/freebsd-version -u
1055f385077SDag-Erling Smørgrav.Ed
1065f385077SDag-Erling Smørgrav.Pp
1075f385077SDag-Erling SmørgravTo inspect a system being repaired using a live CD:
1085f385077SDag-Erling Smørgrav.Bd -literal -offset indent
1095f385077SDag-Erling Smørgravmount -rt ufs /dev/ada0p2 /mnt
1105f385077SDag-Erling Smørgravenv ROOT=/mnt /mnt/bin/freebsd-version -ku
1115f385077SDag-Erling Smørgrav.Ed
1125f385077SDag-Erling Smørgrav.Sh SEE ALSO
1135f385077SDag-Erling Smørgrav.Xr uname 1 ,
114225636dcSEdward Tomasz Napierala.Xr loader.conf 5
1155f385077SDag-Erling Smørgrav.Sh HISTORY
1165f385077SDag-Erling SmørgravThe
1175f385077SDag-Erling Smørgrav.Nm
1185f385077SDag-Erling Smørgravcommand appeared in
1195f385077SDag-Erling Smørgrav.Fx 10.0 .
1205f385077SDag-Erling Smørgrav.Sh AUTHORS
1215f385077SDag-Erling SmørgravThe
1225f385077SDag-Erling Smørgrav.Nm
1235f385077SDag-Erling Smørgravutility and this manual page were written by
124bd0891ceSBaptiste Daroussin.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
125