Firmino Changani

Getting Linux distribution's name

22 May 2022
linux

I had just linked my VS Code to a container, when I questioned myself about which Linux distribution I was connected to, and a quick search led me to the following instruction:

cat /etc/os-release

Which after ran, should print the following information in the terminal:

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Linux uses the file mentioned in the command above to store information about the operating system. An alternative file that can be used to get the same information is: /usr/lib/os-release.

Further reading: