summaryrefslogtreecommitdiff
path: root/corebinutils/freebsd-version/linux-version.1
blob: 97a992586ef6ac055f8574d7c362e32fc9d71685 (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) 2026
.\"  Project Tick. 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.
.\"
.Dd February 28, 2026
.Dt LINUX-VERSION 1
.Os
.Sh NAME
.Nm linux-version
.Nd print the installed system and kernel version on Linux
.Sh SYNOPSIS
.Nm
.Op Fl kru
.Op Fl j Ar jail
.Sh DESCRIPTION
The
.Nm
utility is a Linux-native port of
.Xr freebsd-version 1
for this repository.
It reports the installed kernel version,
the running kernel version,
and the installed userland version.
.Pp
The following options are available:
.Bl -tag -width Fl
.It Fl k
Print the installed kernel version for the target root.
On Linux, this is resolved from the default kernel symlink
.Pa /vmlinuz
or
.Pa /boot/vmlinuz
when available,
otherwise from a unique kernel release under
.Pa /lib/modules
or
.Pa /usr/lib/modules .
If several installed kernels exist and no default boot target can be
determined, the command fails with an explicit error.
.It Fl r
Print the running kernel version from
.Pa /proc/sys/kernel/osrelease .
.It Fl u
Print the installed userland version from
.Pa /etc/os-release
or
.Pa /usr/lib/os-release
under the target root.
The utility prefers
.Ev VERSION_ID ,
then falls back to
.Ev BUILD_ID ,
.Ev VERSION ,
and
.Ev PRETTY_NAME .
.It Fl j Ar jail
Accepted for interface compatibility but not supported on Linux.
The command exits with an explicit error because Linux containers and
namespaces do not provide a jail-equivalent query with compatible semantics.
.El
.Pp
If several supported options are specified,
.Nm
prints the installed kernel version first,
then the running kernel version,
and finally the installed userland version,
each on a separate line.
If no option is specified,
it prints the installed userland version only.
.Sh ENVIRONMENT
.Bl -tag -width ROOT
.It Ev ROOT
Path to the root of the filesystem tree in which to inspect
.Pa os-release ,
.Pa /boot/vmlinuz ,
and kernel module directories for
.Fl k
and
.Fl u .
This does not affect
.Fl r ,
which always reports the current running kernel.
.El
.Sh IMPLEMENTATION NOTES
This port intentionally does not preserve FreeBSD-specific implementation
details such as parsing
.Pa loader.conf ,
querying
.Va kern.osrelease
via
.Xr sysctl 8 ,
or executing inside jails with
.Xr jexec 8 .
.Pp
The Linux kernel does not provide a syscall or procfs interface that reports
the installed-on-disk kernel version separately from the running kernel.
Therefore
.Nm
uses the default kernel symlink when present and otherwise requires a unique
kernel release under the module tree.
.Sh SEE ALSO
.Xr uname 1 ,
.Xr os-release 5