Determining, via the shell prompt, the Linux distribution in use

SSH is sometimes the only mode of access you have to a server. So how do you instantly determine the distro in use?

The following would work for most popular distributions (RedHat, CentOS, Ubuntu, etc.):

cat /etc/*-release

If the above returns “No such file or directory”, try the following which would work on Debian-based distros:

lsb_release -a

Finally, for kernel-related data, use the following command:

uname -a

You’ll be able to determine the kernel version and release date, whether it’s a 32 or 64 bit hardware and the current machine hostname.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>