How does one identify the linux distro in use?
It depends on the distro.
Debian and relatives use
lsb_release -a
cat /etc/lsb-release
either one should be fine. But, despite this being related to LSB (Linux Standard Base), not all distros have it. If you get no reply from the above commands, you should try
ls /etc/*release
and then look inside whichever file you found. You must be careful to this: while RedHat does have /etc/redhat-release, others, like Arch Linux, have an empty /etc/arch-release file, and the one that does contain the info you are looking for is /etc/os-release.
So, YMMV.
It may not be foolproof, but /proc/version
should at least give you a ballpark:
Redhat derivative:
# cat /proc/version
Linux version 2.6.18-92cp (builder@Lnx30BccCmp5) (gcc version 4.1.1 20061011 (Red Hat 4.1.1-30)) #1 SMP Wed Apr 8 17:12:19 IDT 2015
Ubuntu:
$ cat /proc/version
Linux version 3.13.0-24-generic (buildd@panlong) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014
Debian:
$ cat /proc/version
Linux version 3.2.0-4-amd64 ([email protected]) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.65-1+deb7u1
Centos:
# cat /proc/version
Linux version 2.6.18-400.el5xen ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-55)) #1 SMP Thu Dec 4 13:29:23 EST 2014