]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - bin/freebsd-version/freebsd-version.1
Merge llvm-project release/17.x llvmorg-17.0.6-0-g6009708b4367
[FreeBSD/FreeBSD.git] / bin / freebsd-version / freebsd-version.1
1 .\"-
2 .\" Copyright (c) 2013 Dag-Erling Smørgrav
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .Dd October 1, 2021
27 .Dt FREEBSD-VERSION 1
28 .Os
29 .Sh NAME
30 .Nm freebsd-version
31 .Nd print the version and patch level of the installed system
32 .Sh SYNOPSIS
33 .Nm
34 .Op Fl kru
35 .Op Fl j Ar jail
36 .Sh DESCRIPTION
37 The
38 .Nm
39 utility makes a best effort to determine the version and patch level
40 of the installed kernel and / or userland.
41 .Pp
42 The following options are available:
43 .Bl -tag -width Fl
44 .It Fl k
45 Print the version and patch level of the installed kernel.
46 Unlike
47 .Xr uname 1 ,
48 if a new kernel has been installed but the system has not yet
49 rebooted,
50 .Nm
51 will print the version and patch level of the new kernel.
52 .It Fl r
53 Print the version and patch level of the running kernel.
54 Unlike
55 .Xr uname 1 ,
56 this is unaffected by environment variables.
57 .It Fl u
58 Print the version and patch level of the installed userland.
59 These are hardcoded into
60 .Nm
61 during the build.
62 .It Fl j Ar jail
63 Print the version and patch level of the installed userland in the
64 given jail specified by
65 .Va jid
66 or
67 .Va name .
68 This option can be specified multiple times.
69 .El
70 .Pp
71 If several of the above options are specified,
72 .Nm
73 will print the installed kernel version first, then the running kernel
74 version, next the userland version, and finally the userland version
75 of the specified jails, on separate lines.
76 If neither is specified, it will print the userland version only.
77 .Sh IMPLEMENTATION NOTES
78 The
79 .Nm
80 utility should provide the correct answer in the vast majority of
81 cases, including on systems kept up-to-date using
82 .Xr freebsd-update 8 ,
83 which does not update the kernel version unless the kernel itself was
84 affected by the latest patch.
85 .Pp
86 To determine the name (and hence the location) of a custom kernel, the
87 .Nm
88 utility will attempt to parse
89 .Pa /boot/defaults/loader.conf
90 and
91 .Pa /boot/loader.conf ,
92 looking for definitions of the
93 .Va kernel
94 and
95 .Va bootfile
96 variables, both with a default value of
97 .Dq kernel .
98 It may however fail to locate the correct kernel if either or both of
99 these variables are defined in a non-standard location, such as in
100 .Pa /boot/loader.rc .
101 .Sh ENVIRONMENT
102 .Bl -tag -width ROOT
103 .It Ev ROOT
104 Path to the root of the filesystem in which to look for
105 .Pa loader.conf
106 and the kernel.
107 .El
108 .Sh EXAMPLES
109 To determine the version of the currently running userland:
110 .Bd -literal -offset indent
111 /bin/freebsd-version -u
112 .Ed
113 .Pp
114 To inspect a system being repaired using a live CD:
115 .Bd -literal -offset indent
116 mount -rt ufs /dev/ada0p2 /mnt
117 env ROOT=/mnt /mnt/bin/freebsd-version -ku
118 .Ed
119 .Sh SEE ALSO
120 .Xr uname 1 ,
121 .Xr loader.conf 5
122 .Sh HISTORY
123 The
124 .Nm
125 command appeared in
126 .Fx 10.0 .
127 .Sh AUTHORS
128 The
129 .Nm
130 utility and this manual page were written by
131 .An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .