]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - bin/freebsd-version/freebsd-version.1
bhnd(9): Fix a few mandoc related issues
[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 .\" $FreeBSD$
27 .\"
28 .Dd November 14, 2017
29 .Dt FREEBSD-VERSION 1
30 .Os
31 .Sh NAME
32 .Nm freebsd-version
33 .Nd print the version and patch level of the installed system
34 .Sh SYNOPSIS
35 .Nm
36 .Op Fl kru
37 .Sh DESCRIPTION
38 The
39 .Nm
40 utility makes a best effort to determine the version and patch level
41 of the installed kernel and / or userland.
42 .Pp
43 The following options are available:
44 .Bl -tag -width Fl
45 .It Fl k
46 Print the version and patch level of the installed kernel.
47 Unlike
48 .Xr uname 1 ,
49 if a new kernel has been installed but the system has not yet
50 rebooted,
51 .Nm
52 will print the version and patch level of the new kernel.
53 .It Fl r
54 Print the version and patch level of the running kernel.
55 Unlike
56 .Xr uname 1 ,
57 this is unaffected by environment variables.
58 .It Fl u
59 Print the version and patch level of the installed userland.
60 These are hardcoded into
61 .Nm
62 during the build.
63 .El
64 .Pp
65 If several of the above options are specified,
66 .Nm
67 will print the installed kernel version first, then the running kernel
68 version, and finally the userland version, on separate lines.
69 If neither is specified, it will print the userland version only.
70 .Sh IMPLEMENTATION NOTES
71 The
72 .Nm
73 utility should provide the correct answer in the vast majority of
74 cases, including on systems kept up-to-date using
75 .Xr freebsd-update 8 ,
76 which does not update the kernel version unless the kernel itself was
77 affected by the latest patch.
78 .Pp
79 To determine the name (and hence the location) of a custom kernel, the
80 .Nm
81 utility will attempt to parse
82 .Pa /boot/defaults/loader.conf
83 and
84 .Pa /boot/loader.conf ,
85 looking for definitions of the
86 .Va kernel
87 and
88 .Va bootfile
89 variables, both with a default value of
90 .Dq kernel .
91 It may however fail to locate the correct kernel if either or both of
92 these variables are defined in a non-standard location, such as in
93 .Pa /boot/loader.rc .
94 .Sh ENVIRONMENT
95 .Bl -tag -width ROOT
96 .It Ev ROOT
97 Path to the root of the filesystem in which to look for
98 .Pa loader.conf
99 and the kernel.
100 .El
101 .Sh EXAMPLES
102 To determine the version of the currently running userland:
103 .Bd -literal -offset indent
104 /bin/freebsd-version -u
105 .Ed
106 .Pp
107 To inspect a system being repaired using a live CD:
108 .Bd -literal -offset indent
109 mount -rt ufs /dev/ada0p2 /mnt
110 env ROOT=/mnt /mnt/bin/freebsd-version -ku
111 .Ed
112 .Sh SEE ALSO
113 .Xr uname 1 ,
114 .Xr loader.conf 5
115 .Sh HISTORY
116 The
117 .Nm
118 command appeared in
119 .Fx 10.0 .
120 .Sh AUTHORS
121 The
122 .Nm
123 utility and this manual page were written by
124 .An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .