xref: /freebsd/bin/freebsd-version/freebsd-version.1 (revision f54b18fc4d72c566912b9a41601ed87a852960e7)
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*f54b18fcSFaraz Vahedi.Dd October 1, 2021
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
366fd07539SDag-Erling Smørgrav.Op Fl kru
37*f54b18fcSFaraz Vahedi.Op Fl j Ar jail
385f385077SDag-Erling Smørgrav.Sh DESCRIPTION
395f385077SDag-Erling SmørgravThe
405f385077SDag-Erling Smørgrav.Nm
415f385077SDag-Erling Smørgravutility makes a best effort to determine the version and patch level
425f385077SDag-Erling Smørgravof the installed kernel and / or userland.
435f385077SDag-Erling Smørgrav.Pp
445f385077SDag-Erling SmørgravThe following options are available:
455f385077SDag-Erling Smørgrav.Bl -tag -width Fl
465f385077SDag-Erling Smørgrav.It Fl k
475f385077SDag-Erling SmørgravPrint the version and patch level of the installed kernel.
485f385077SDag-Erling SmørgravUnlike
495f385077SDag-Erling Smørgrav.Xr uname 1 ,
505f385077SDag-Erling Smørgravif a new kernel has been installed but the system has not yet
515f385077SDag-Erling Smørgravrebooted,
525f385077SDag-Erling Smørgrav.Nm
535f385077SDag-Erling Smørgravwill print the version and patch level of the new kernel.
546fd07539SDag-Erling Smørgrav.It Fl r
556fd07539SDag-Erling SmørgravPrint the version and patch level of the running kernel.
566fd07539SDag-Erling SmørgravUnlike
576fd07539SDag-Erling Smørgrav.Xr uname 1 ,
586fd07539SDag-Erling Smørgravthis is unaffected by environment variables.
595f385077SDag-Erling Smørgrav.It Fl u
605f385077SDag-Erling SmørgravPrint the version and patch level of the installed userland.
615f385077SDag-Erling SmørgravThese are hardcoded into
625f385077SDag-Erling Smørgrav.Nm
635f385077SDag-Erling Smørgravduring the build.
64*f54b18fcSFaraz Vahedi.It Fl j Ar jail
65*f54b18fcSFaraz VahediPrint the version and patch level of the installed userland in the
66*f54b18fcSFaraz Vahedigiven jail specified by
67*f54b18fcSFaraz Vahedi.Va jid
68*f54b18fcSFaraz Vahedior
69*f54b18fcSFaraz Vahedi.Va name .
70*f54b18fcSFaraz VahediThis option can be specified multiple times.
715f385077SDag-Erling Smørgrav.El
725f385077SDag-Erling Smørgrav.Pp
736fd07539SDag-Erling SmørgravIf several of the above options are specified,
745f385077SDag-Erling Smørgrav.Nm
756fd07539SDag-Erling Smørgravwill print the installed kernel version first, then the running kernel
76*f54b18fcSFaraz Vahediversion, next the userland version, and finally the userland version
77*f54b18fcSFaraz Vahediof the specified jails, on separate lines.
785f385077SDag-Erling SmørgravIf neither is specified, it will print the userland version only.
795f385077SDag-Erling Smørgrav.Sh IMPLEMENTATION NOTES
805f385077SDag-Erling SmørgravThe
815f385077SDag-Erling Smørgrav.Nm
825f385077SDag-Erling Smørgravutility should provide the correct answer in the vast majority of
835f385077SDag-Erling Smørgravcases, including on systems kept up-to-date using
845f385077SDag-Erling Smørgrav.Xr freebsd-update 8 ,
855f385077SDag-Erling Smørgravwhich does not update the kernel version unless the kernel itself was
865f385077SDag-Erling Smørgravaffected by the latest patch.
875f385077SDag-Erling Smørgrav.Pp
885f385077SDag-Erling SmørgravTo determine the name (and hence the location) of a custom kernel, the
895f385077SDag-Erling Smørgrav.Nm
905f385077SDag-Erling Smørgravutility will attempt to parse
915f385077SDag-Erling Smørgrav.Pa /boot/defaults/loader.conf
925f385077SDag-Erling Smørgravand
935f385077SDag-Erling Smørgrav.Pa /boot/loader.conf ,
945f385077SDag-Erling Smørgravlooking for definitions of the
955f385077SDag-Erling Smørgrav.Va kernel
965f385077SDag-Erling Smørgravand
975f385077SDag-Erling Smørgrav.Va bootfile
985f385077SDag-Erling Smørgravvariables, both with a default value of
995f385077SDag-Erling Smørgrav.Dq kernel .
1005f385077SDag-Erling SmørgravIt may however fail to locate the correct kernel if either or both of
1015f385077SDag-Erling Smørgravthese variables are defined in a non-standard location, such as in
1025f385077SDag-Erling Smørgrav.Pa /boot/loader.rc .
1035f385077SDag-Erling Smørgrav.Sh ENVIRONMENT
1045f385077SDag-Erling Smørgrav.Bl -tag -width ROOT
1055f385077SDag-Erling Smørgrav.It Ev ROOT
1065f385077SDag-Erling SmørgravPath to the root of the filesystem in which to look for
1075f385077SDag-Erling Smørgrav.Pa loader.conf
1085f385077SDag-Erling Smørgravand the kernel.
1095f385077SDag-Erling Smørgrav.El
1105f385077SDag-Erling Smørgrav.Sh EXAMPLES
1115f385077SDag-Erling SmørgravTo determine the version of the currently running userland:
1125f385077SDag-Erling Smørgrav.Bd -literal -offset indent
1135f385077SDag-Erling Smørgrav/bin/freebsd-version -u
1145f385077SDag-Erling Smørgrav.Ed
1155f385077SDag-Erling Smørgrav.Pp
1165f385077SDag-Erling SmørgravTo inspect a system being repaired using a live CD:
1175f385077SDag-Erling Smørgrav.Bd -literal -offset indent
1185f385077SDag-Erling Smørgravmount -rt ufs /dev/ada0p2 /mnt
1195f385077SDag-Erling Smørgravenv ROOT=/mnt /mnt/bin/freebsd-version -ku
1205f385077SDag-Erling Smørgrav.Ed
1215f385077SDag-Erling Smørgrav.Sh SEE ALSO
1225f385077SDag-Erling Smørgrav.Xr uname 1 ,
123225636dcSEdward Tomasz Napierala.Xr loader.conf 5
1245f385077SDag-Erling Smørgrav.Sh HISTORY
1255f385077SDag-Erling SmørgravThe
1265f385077SDag-Erling Smørgrav.Nm
1275f385077SDag-Erling Smørgravcommand appeared in
1285f385077SDag-Erling Smørgrav.Fx 10.0 .
1295f385077SDag-Erling Smørgrav.Sh AUTHORS
1305f385077SDag-Erling SmørgravThe
1315f385077SDag-Erling Smørgrav.Nm
1325f385077SDag-Erling Smørgravutility and this manual page were written by
133bd0891ceSBaptiste Daroussin.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
134