您的位置:首页 > 运维架构 > Linux

Linux uname --打印系统信息

2016-04-08 11:10 393 查看
用途说明
uname命令用来打印系统信息(printsystem information),包括系统名称、内核版本等重要信息。美中不足的是无法打印Linux发行版本的名称,比如打印RHEL5.5或
CentOS5.5之类的,另外一个命令lsb_release可以打印这些。相关资料【2】中提供了一些别的方法可以取得系统版本信息。
常用参数
-a 打印全部系统信息。
-r 打印内核发行版本。
在脚本中可以使用 `uname -r`或者 $(uname -r) 取得内核发行版本,比如2.4.18。
使用示例
示例一 打印使用方法
[root@web186 root]#
uname --help
用法:uname [选项]...
Print certain systeminformation. With no OPTION, same as -s.

-a,--all print all information, in the following order:
-s,--kernel-name print the kernel name
-n,--nodename printthe network node hostname
-r,--kernel-release print the kernel release
-v,--kernel-version print the kernel version
-m,--machine print the machine hardware name
-p,--processor print theprocessor type
-i,--hardware-platform print the hardware platform
-o,--operating-system print the operating system
--help
显示此帮助信息并离开
--version
显示版本信息并离开

Report bugs to<bug-coreutils@gnu.org>.
[root@web186 root]#
示例二 在RHEL5.5下的结果
[root@new55 ~]#
uname
Linux
[root@new55 ~]#
uname -a
Linux new552.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
[root@new55 ~]#
uname -s
Linux
[root@new55 ~]#
uname -m
i686
[root@new55 ~]#
uname -i
i386
[root@new55 ~]#
uname -n
new55
[root@new55 ~]#
uname -v
#1 SMP Tue Mar 1621:52:43 EDT 2010
[root@new55 ~]#
uname -r
2.6.18-194.el5

示例三 其他显示系统版本信息的方法
[root@new55 ~]#
cat /proc/version
Linux version2.6.18-194.el5 (mockbuild@x86-007.build.bos.redhat.com) (gcc version 4.1.220080704 (Red Hat 4.1.2-48)) #1 SMP Tue Mar 16 21:52:43 EDT 2010
[root@new55 ~]#
cat /etc/issue
Red Hat EnterpriseLinux Server release 5.5 (Tikanga)
Kernel \r on an \m

[root@new55 ~]#
cat /etc/redhat-release
Red Hat EnterpriseLinux Server release 5.5 (Tikanga)
[root@new55 ~]#
[root@new55 ~]#
lsb_release -a
LSBVersion: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID:RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release: 5.5
Codename: Tikanga
[root@new55 ~]#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: