How it works...
When you are querying these files, you are asking the OS what version it thinks it is.
This is useful in everything from security to writing scripts. Not only do you want to know when the version of an OS you're running is insecure, you might also want to add a sanity check to the top of any scripts, to ensure they're only run on systems they're designed for, that is, you can write a script for CentOS systems, and step one can be to "check we're actually being executed on a CentOS system."
uname (Unix name) is more interesting, because instead of querying files for the OS version, what we were actually doing was querying the running kernel for its information.
uname uses the uname system call (confused yet?), which is not ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access