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