Problem:
1. When using a Linux machine, it is often necessary to confirm the current operating system version information, kernel information, etc.
The version information of the operating system can be accomplished by the following commands, such as: Lsb_release-a;cat/etc/issue
The view kernel version can be done by the following command, for example: Uname-a;cat/proc/version,
These commands are more difficult to remember, and this article attempts to explain the origins of these command names to facilitate memory.
Workaround: 1. To view the operating system version of the command 1.1 command lsb_release-a
Lsb_release provides information about specific LSB (Linux standard Base) and release versions.
The results of running lsb_release-a in Ubuntu are as follows:
[Plain]View PlainCopyprint?
- [Email protected]:~$ lsb_release-a
- No LSB modules is available.
- Distributor Id:ubuntu
- Description:ubuntu 11.10
- release:11.10
- Codename:oneiric
- [Email protected]:~$
1.2 Command Cat/etc/issue
The/etc directory is decentralized with the system configuration file.
/etc/issue files usually include a short description of the system or welcome information. The content is determined by the system administrator.
The results of the Execute cat/etc/issue command in Ubuntu are as follows:
[Plain]View PlainCopyprint?
- [Email protected]:~$ cat/etc/issue
- Ubuntu 11.10 \ \l
- [Email protected]:~$
2. View the kernel version of the command 2.1 command uname-a
Uname from Utsname, is a system call, formatted as
int uret = uname ((struct utsname) * uname_buf),
Among them, the structure pointer uname_buf mainly holds the operating system name, kernel version and hardware architecture;
struct struct utsname is defined as follows:
[Plain]View PlainCopyprint?
- struct Utsname {
- Char sysname[]; /* Operating system name (e.g., "Linux") */
- Char nodename[]; /* Name within "some implementation-defined
- Network "*/
- Char release[]; /* OS release (e.g., "2.6.28") */
- Char version[]; /* OS version */
- Char machine[]; /* Hardware identifier */
- #ifdef _gnu_source
- Char domainname[]; /* NIS or YP domain name */
- #endif
- };
The UTS in Utsname refers to the Universal time–sharing system (Universal Time-sharing systems).
The results of running uname-a in Ubuntu are as follows:
[Plain]View PlainCopyprint?
- [Email protected]:~$ uname-a
- Linux david-nb 3.0.0-32-generic #51-ubuntu SMP Thu Mar 15:51:26 UTC-i686 i686 i386 Gnu/linux
- [Email protected]:~$
The kernel version is: 3.0.0-32-generic
2.2 Command Cat/proc/version
The proc file system is a virtual file system that allows you to communicate in Linux kernel space and user space using a new method.
Unlike normal files, these virtual files are created dynamically.
/proc is very powerful, as shown below as the result of performing an interactive query on some elements in the/proc:
[Plain]View PlainCopyprint?
- [Email protected]:~$ Ls/proc
- 1 1279 1480 1512 1576 1646 1803 $3081 565 902 buddyinfo FB Loadavg SCSI Version_signature
- 1001 1485 1515 1580 1649 1807 2052 265 3082 6 903 bus filesystems Locks Self Vmallocinfo
- 1005 1362 1487 1523 1584 1655 1815 2095 3084 7 904 cgroups FS Mdstat Slabinf o Vmstat
- 1006 1370 1492 1526 1585 1656 1816 21 2744 3085 754 914 cmdline interrupts meminfo softirq S Zoneinfo
- 1007 1390 1493 1527 1589 1666 1817 216 2796 318 806 915 consoles iomem misc stat
- 1013 1496 1539 1671 1828 217-323 837 933 Cpuinfo ioports modules swaps
- 1030 1409 1542 1616 1673 183 2856 PNS 838 942 crypto IRQ Mounts SYS
- 1073 1418 1501 1544 1617 1676 188 2391 2881 40 844 977 devices kallsyms mtd sysrq-t Rigger
- 1079 1448 1503 1548 1619 from 847 982 device-tree Kcore mtrr SYSVIPC
- 1084 1453 1506 1555 1622 1711 190 2448 2998 453 848 991 diskstats key-users net timer_l Ist
- 1456 1508 1562 1623 1712 1957 3 455 882 992 DMA kmsg pagetypeinfo timer_s Tats
- 1168 1457 1509 1563 1625 1776 1992 2538 3017 528 885 994 dri kpagecount partitions tty
- 1175 1459 1510 1566 1627 1790 1997 2548 3070 531 899 acpi driver kpageflags sched_debug uptime
- 1464 1511 1569 1633 2 3080 540 9 Asound execdomains latency_stats schedstat version
- [Email protected]:~$
Where the version file stores information such as kernel versions, operating system names, and so on, the content of the uname-a is basically the same.
[Plain]View PlainCopyprint?
- [Email protected]:~$ cat/proc/version
- Linux version 3.0.0-32-generic ([email protected]) (GCC version 4.6.1 (Ubuntu/linaro 4.6.1-9ubuntu3)) #51-ubuntu SMP Thu Mar 15:51:26 UTC 2013
- [Email protected]:~$
Kernel version is 3.0.0-32-generic
Linux Information Lookup