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