HTTPS clone URL
Subversion checkout URL
Clone this wiki locally
The sys-uname library is a Ruby interface for getting operating system information. The name comes from the Unix ‘uname’ command, but this library works on MS Windows as well.
gem install sys-uname
If you’re on MS Windows, and the above doesn’t work try:
gem install sys-uname --platform universal-mingw32
require 'sys/uname' include Sys p Uname.uname # => Display everything puts Uname.sysname # => The operating system name. e.g. "SunOS" puts Uname.nodename # => This is usually, but not necessarily, the same as the system's hostname. puts Uname.machine # => The machine hardware type. e.g. "i686" puts Uname.version # => The operating system version. e.g. "5.8". Windows includes patch information. puts Uname.release # => The operating system release. e.g. "2.2.16-3"
puts Uname.architecture # => Returns the instruction set architecture. e.g. "sparc" puts Uname.platform # => The platform identifier. e.g. "SUNW,Sun-Blade-100" puts Uname.isa_list # => List of supported instr. sets, e.g. "amd64 pentium_pro+mmx pentium_pro" puts Uname.hw_provider # => The name of the hardware manufacturer. puts Uname.hw_serial_number # => The hardware serial number puts Uname.srpc_domain # => The name of the Secure Remote Procedure Call domain, if any. puts Uname.dhcp_cache # => The boot(1M) interface encoding, in hexidecimal format.
puts Uname.id_number # => OS identification number
See the doc/uname.txt file for more detailed descriptions of some of these fields.