Sometimes you’re working on a system and you’re not entirely sure which Linux distribution it is. There are several ways to find out what you’re working with and I keep forgetting what they commands are to get there – so here’s a quick list for all of us.
Release and Distribution
Most systems (but not all) have a file called something-release in the /etc directory. On CentOS and Redhat this is /etc/redhat-release. Display the contents of that file and you’ll find out:
cat /etc/redhat-release
This is not going to work on an Ubuntu system for example where the file is called something different. The best approach hence is to call
cat /etc/*release
which will give you the output no matter which distribution you’re on. You may also try
lsb_release -a
however this does not work on all systems. When it does it will typically show you a more detailed output.
Linux Kernel
If you want to dig even deeper and find out which Kernel you’re using, or if you’re working on a 32/64 bit system, try issuing
uname -mrs
which will show you those. Try -a instead for a more detailed output.
Hope this helps 😉