To determine which version of Amazon Linux you’re running, you can use the command below:
grep -E -w ‘VERSION|NAME|PRETTY_NAME’ /etc/os-release
The output will return one of the following:
Amazon Linux
# grep -E -w ‘VERSION|NAME|PRETTY_NAME’ /etc/os-release
NAME=”Amazon Linux AMI”
VERSION=”2018.03″
PRETTY_NAME=”Amazon Linux AMI 2018.03″
Amazon Linux 2
# grep -E -w ‘VERSION|NAME|PRETTY_NAME’ /etc/os-release
NAME=”Amazon Linux”
VERSION=”2″
PRETTY_NAME=”Amazon Linux 2″