This subchapter looks at uname, a UNIX (and Linux) command.
uname is used to report system information.
On a Linux machine you can find all of this same information in the appropriate files in the /proc filesystem, but uname utility may be easier and faster to use.
basic use
Type the uname without any options to get the kernel name.
$ uname Darwin
system
Use the -s option to get the operating system name.
$ uname -s Darwin
release info
Use the -r option to get the operating system release information.
$ uname -r 9.8.0
operating system version
Use the -v option to get the operating system version.
$ uname -v Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_PPC
machine
Use the -m option to get the machine hardware name.
$ uname -m Power Macintosh
When running on an Intel (or compatiable) processor, you may also get an indication as to whether it is a 32-bit or 64-bit system.
$ uname -m x86_64
processor
Use the -p option to get the machine processor architecture type.
$ uname -p powerpc
network node
Use the -n option to get the network node host name (node name).
$ uname -n local
You can also use the hostname command to get the exact same answer.
all
Use the -a option to get all of the information available from this command.
$ uname -a Darwin admins-power-mac-g5.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_PPC Power Macintosh
nonstandard
There are a few additional nonstandard options that may be available. Even if available, they may produce unknown as their output. because these are nonstandard options, you should avaoid using them in a script.
Use the -i option to get hardware platform information.
$ uname -i x86_64
Use the -o option to get he operating system name.
$ uname -o GNU/Linux
CentOS and Red hat Enterprise
You ca find the distribution version number for CentOS or red hat Enterprise Linux with the following command:
In June 2009, Ken Milberg named this command as one of the Top 50 universal UNIX commands at this web page Top 50 Universal INIX commands. Note that this web page requires agreeing to be spammed before you can read it.
free music player coding example
Coding example: I am making heavily documented and explained open source code for a method to play music for free almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).
Create your own copy from the original source code/ (presented for learning programming).
Work on this project is very slow because I am homeless. I am available for work if someone can provide an indoor place to work in Costa Mesa, California, electricity, internet connections, a flat raised working surface (such as a table or desk), a sitting device (such as a chair or stool), and a fully functional reasonably modern used computer. Im already homeless, so you dont need to pay me (and I understand how much business people hate the minimum wage law). Just give me a chance to work.
Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.
If you like the idea of this project, then please donate some money.
send donations to: Milo
PO Box 1361
Tustin, California 92781
At the time I am homeless. This greatly interferes with my ability to create this project, which can help nearly 20 million U.S. college students and more than 150 million students world-wide. I am looking for 30 rich people or corporations willing to donate $10 a month to my church so that the church can provide a place indoors for me to continue work. If you want to donate, please see help project. Thanks much.
Supporting the entire project:
If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)
UNIX used as a generic term unless specifically used as a trademark (such as in the phrase UNIX certified). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.
Names and logos of various OSs are trademarks of their respective owners.