APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Some material is very old and may be incorrect today

© July 2013 Tony Lawrence

What is the shell command to determine the version of Unix or Linux that is currently running?

What is the shell command to determine the number of CPU's?

Usually some variant of uname, often "uname -a", but all sorts of other possibilies: -v, -X .. who knows? Depends on the flavor and in some cases even the version of that flavor.

Sometimes /etc/issue has what you want.. and on some systems a "cat *-release" or "cat *-version" may give results. Also, some systems have /etc/issue and /etce/issue.net, with the latter being used for network logins.

To stir the confusion even more, some systems had /etc/.issue that they overwrote at boot, which allowed you to modify the /etc/issue and have it stick.

Oh, and one more thing:

Even when the man page tells you that uname -v gives you the version, it can be an entirely different interpretation of version than what you would think.

For example, on this 2.4 kernel Red Hat box, uname -r says 2.4.9-21. That's good. But uname -v gives "#1" and todays date (yes, I did build a new kernel today)

This 2.6 Linux shows me that PAE is enabled with "-r": "2.6.18-238.5.1.el5PAE"

On the SCO system I'm trying to recover for a client to my left, uname -r says 3.2 and uname -v says "2", but uname -X says "Release=3.2v5.0.4" (and "5.0.4" is what's important there)

On the BSD box to my right, uname -r says 4.1.1-STABLE and -v says that and more.

Can't trust it unless you already know how it works :-)

Linux users can also "cat /proc/version", which is likely to give you something like this:

Linux version 2.6.18-238.5.1.el5PAE
([email protected]) (gcc version 4.1.2
20080704 (Red Hat 4.1.2-50)) #1 SMP Mon Feb 21 06:01:16
EST 2011
 

Unixware had some oddities when SCO was calling it "Open Unix 8":

Then (I don't know about now) uname returned "OpenUNIX". You could get it to return "UnixWare" by doing

$ SCOMPAT=5:7.1.2:UnixWare 
uname -s
 

CPU Info

For Linux, it's all in /proc/cpuinfo. If you only care about the number, "grep processor /proc/cpuinfo" will give you that.

Unixware and SunOS have "psrinfo", which will tell you about processors.

Unixware "idtype" will tell you the kind of kernel it is running (for example, whether or not SMP).

Speaking of cpu stuff, this How do I Find Out Linux CPU Utilization? is useful.

If you found something useful today, please consider a small donation.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> What is the shell command to determine the version of Unix or Linux that is currently running?


Inexpensive and informative Apple related e-books:

Take Control of Pages

Photos: A Take Control Crash Course

El Capitan: A Take Control Crash Course

Take Control of iCloud, Fifth Edition

iOS 8: A Take Control Crash Course





More Articles by © Tony Lawrence





Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us


Printer Friendly Version





One day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" (Larry Wall)




Linux posts

Troubleshooting posts


This post tagged:

BSD

Kernel

Linux

SCO_OSR5

Scripting

Shell

Unixware



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode