2010년에 나온 systemd 가 리눅스의 주류가 된 시점에 가장 확실한 방법이다.
systemd가 좋다 나쁘다 시끄러웠지만 lsb_release는 나쁜 방법이라 생각한다.
$ cat /etc/os-release
PRETTY_NAME="Kali GNU/Linux Rolling"
NAME="Kali GNU/Linux"
ID=kali
VERSION="2021.3"
VERSION_ID="2021.3"
VERSION_CODENAME="kali-rolling"
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="https://www.kali.org/"
SUPPORT_URL="https://forums.kali.org/"
BUG_REPORT_URL="https://bugs.kali.org/"
배포판 이름과 버전 정보와 같은 필요한 정보가 확인된다.
이미 LTS 버전이 넘어간 우분투/데비안이라면 아마 이 명령어가 가장 정확한 해답이 될것이다.
lsb_release 명령어는 man 파일에서 확인하면
The lsb_release command provides certain LSB (Linux Standard Base) and distribution-specific information.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2021.3
Codename: kali-rolling
전체 결과값을 알수 있고 아마 대부분은 Kali 라는 배보판 명과 Release 정보가 필요할것이다.
$ lsb_release -r
Release: 2021.3
릴리즈 정보만 확인한다. 2021.3
$ lsb_release -i
Distributor ID: Kali
$ cat /etc/os-release
$ cat /etc/system-release
$ uname -s -r
Linux 4.19.104-microsoft-standard