[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Action disabled: register

Welcome to the Slackware Documentation Project

Checking a Slackware Version

To check which version of Slackware you are running, we have two means that are widely used and practical, the first is to read the slackware-version file, which is located in the /etc/ directory. For this you can run the 'cat' command indicating the input file, or simply open it with your favorite editor.

Slackware Version file

$ cat /etc/slackware-version
Slackware 14.2 

The slackware-version file will also be updated if you upgrade your Slackware, since it is part of the “aaa_base” package.

If the slackware-version output is appended by a '+' it means that the system is running the Slackware -current (development) version.

$ cat /etc/slackware-version
Slackware 14.2+

os-release file

The second method is the most complete. There is a file containing a lot of basic system information which is present in practically all Linux distributions. IT was first introduced by systemd.

This file is called os-release and is also located in /etc/. To view it, you can use the same methods as above with the cat command or your favorite editor.

$ cat /etc/os-release
NAME=Slackware
VERSION="14.2"
ID=slackware
VERSION_ID=14.2
PRETTY_NAME="Slackware 14.2"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:slackware:slackware_linux:14.2"
HOME_URL="http://slackware.com/"
SUPPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
BUG_REPORT_URL="http://www.linuxquestions.org/questions/slackware-14/" 
There is a lot of very valuable information in this file. This information can be easily used in your Shell script using the source command (also known as the 'dot' command “.”). A very simple example using bash:
$ source /etc/os-release
$ echo "Distribution: $NAME"
Distribution: Slackware
$ echo "Version: $VERSION"
Version: 14.2
$ echo "URL SITE: $HOME_URL"
URL SITE: http://slackware.com/

Unix Way

Or you can use a more UNIX way of handling things using old rice and beans … So you can also collect the necessary data. For this we execute a pipeline command storing the result inside a variable called version as an example.

$ version=$(grep '^VERSION=' /etc/os-release | cut -d '=' -f 2 | sed 's/"//g')
$ echo "$version"
14.2

Sources

 howtos:misc:checking_a_slackware_version ()