Using SSH, we can find the Linux version using two simple commands.
Want the cheatsheet version? Cheatsheet Linux Commands: uname
If you’re like me, you often have to SSH into lots of servers to help manage your clients and customers with their sites. Sometimes, it’s important to know what version of Linux they are using so you can quickly figure out how to best access their system, perform updates/upgrades, download software/packages etc.
Using the SSH terminal, try the following uname -a command:
Linux myhost.com 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux
This command tells you all the information about the server you’re running. Using the -a option, it will output all available information in the following order:
There are other commands also that can help you obtain specific information:
|uname –help||Returns the help manual for the uname command, including all available options.|
|uname -a||Prints all information for the server/system you’re on.|
|uname -s||Prints the kernel name|
|uname -n||Prints the node name|
|uname -r||Prints the kernel release data|
|uname -v||Prints the kernel version data|
|uname -m||Prints the machine data|
|uname -p||Prints the processor information|
|uname -i||Prints the platform hardware information|
|uname -o||Prints the operating system information|
Sometimes using uname -a isn’t enough. You might need to know the exact linux distro. You can do that by using the lsb_release command:
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 7.6 (wheezy) Release: 7.6 Codename: wheezy
Now you can see what version of the linux distro you’re using and see if there are any upgrades/updates available for it.