61阅读

linux查看系统版本-查看linux主机系统的基本信息

发布时间:2018-02-14 所属栏目:win10查看系统版本

一 : 查看linux主机系统的基本信息

查看linux主机系统的基本信息

一、 硬件信息

1. CPU

a. Cat /proc/cpuinfo 例:

[root@linux victor]# cat /proc/cpuinfo

processor : 0

vendor_id : GenuineIntel

cpu family : 6

model : 13

model name : Intel(R) Celeron(R) M processor 1.50GHz stepping : 8

cpu MHz : 1500.000

cache size : 1024 KB

fdiv_bug : no

hlt_bug : no

f00f_bug : no

coma_bug : no

fpu : yes

fpu_exception : yes

cpuid level : 2

wp : yes

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts

bogomips : 2999.83

clflush size : 64

power management:

b. Dmesg | grep –i ‘cpu’ 例:

[root@linux victor]# dmesg | grep -i 'cpu'

Initializing cgroup subsys cpuset

Initializing cgroup subsys cpu

KERNEL supported cpus:

Transmeta TransmetaCPU

PAT not supported by CPU.

ACPI: SSDT 1bdf645d 001FB (v01 PmRef CpuPm 00003000 INTL 20030224)

SMP: Allowing 1 CPUs, 0 hotplug CPUs

NR_CPUS:32 nr_cpumask_bits:32 nr_cpu_ids:1 nr_node_ids:1 PERCPU: Embedded 15 pages at c1382000, static data 37788 bytes Initializing CPU#0

SLUB: Genslabs=13, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 Initializing cgroup subsys cpuacct

CPU: L1 I cache: 32K, L1 D cache: 32K

CPU: L2 cache: 1024K

mce: CPU supports 5 MCE banks

linux主机 查看linux主机系统的基本信息

CPU0: Thermal monitoring enabled (TM1)

CPU0: Intel(R) Celeron(R) M processor 1.50GHz stepping 08 Brought up 1 CPUs

CPU0 attaching NULL sched-domain.

ACPI: CPU0 (power states: C1[C1] C2[C2] C3[C3])

processor LNXCPU:00: registered as cooling_device0

ACPI: Processor [CPU0] (supports 8 throttling states)

Switched to high resolution mode on CPU 0

cpuidle: using governor ladder

cpuidle: using governor menu

microcode: CPU0 sig=0x6d8, pf=0x20, revision=0x20

p4-clockmod: P4/Xeon(TM) CPU On-Demand Clock Modulation available

c. Dmidecode -t processor

例:

[root@linux victor]# dmidecode -t processor

# dmidecode 2.10

SMBIOS version fixup (2.31 -> 2.3).

SMBIOS 2.3 present.

Handle 0x0004, DMI type 4, 35 bytes

Processor Information

Socket Designation: Socket 479M

Type: Central Processor

Family: Unknown

Manufacturer: Intel

ID: D8 06 00 00 FF FB E9 AF

Version: Intel(R) Celeron(R) M processor

Voltage: 3.3 V

External Clock: 400 MHz

Max Speed: 1500 MHz

Current Speed: 1500 MHz

Status: Populated, Enabled

Upgrade: ZIF Socket

L1 Cache Handle: Not Provided

L2 Cache Handle: 0x0008

L3 Cache Handle: Not Provided

Serial Number: Not Specified

Asset Tag: Not Specified

Part Number: Not Specified

2. 硬盘

a. fdisk 查看分区信息,能够查看到所有的硬盘分区。[www.61k.com] 例:

[root@linux victor]# fdisk -l

Disk /dev/sda: 40.0 GB, 40007761920 bytes

255 heads, 63 sectors/track, 4864 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0xe7e0e7e0

Device Boot Start End Blocks Id System

/dev/sda1 1 1963 15767766 7 HPFS/NTFS

linux主机 查看linux主机系统的基本信息

/dev/sda2 1964 3011 8418060 83 Linux

/dev/sda3 3012 4135 9028530 f W95 Ext'd (LBA) /dev/sda4 4136 4864 5855692+ 83 Linux /dev/sda5 * 3012 4059 8418028+ 83 Linux

/dev/sda6 4060 4135 610438+ 82 Linux swap / Solaris

b. df查看大小情况,只能查看到当前已挂载的分区。(www.61k.com)

例:

[root@linux victor]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/sda5 8.0G 7.4G 173M 98% /

tmpfs 217M 780K 216M 1% /dev/shm

/dev/sda1 16G 14G 1.9G 88% /media/disk

c. du 查看使用情况,相当于windows的右键属性看大小了。

例:

[root@linux victor]# ls

Desktop Downloads Pictures Templates workspace Documents Music Public Videos

[root@linux victor]# du -h Downloads/

1.2M Downloads/nmon_x86_12a

139M Downloads/

3. 内存

a. Cat /proc/meminfo

例:

[root@linux victor]# cat /proc/meminfo

MemTotal: 443200 kB

MemFree: 9464 kB

Buffers: 13736 kB

Cached: 194672 kB

SwapCached: 2364 kB

Active: 156528 kB

Inactive: 242948 kB

Active(anon): 65480 kB

Inactive(anon): 127156 kB

Active(file): 91048 kB

Inactive(file): 115792 kB

Unevictable: 0 kB

Mlocked: 0 kB

HighTotal: 0 kB

HighFree: 0 kB

LowTotal: 443200 kB

LowFree: 9464 kB

SwapTotal: 610428 kB

SwapFree: 566144 kB

Dirty: 44 kB

Writeback: 0 kB

AnonPages: 189164 kB

Mapped: 56164 kB

Slab: 18284 kB

SReclaimable: 9500 kB

linux主机 查看linux主机系统的基本信息

SUnreclaim: 8784 kB

PageTables: 8840 kB

NFS_Unstable: 0 kB

Bounce: 0 kB

WritebackTmp: 0 kB

CommitLimit: 832028 kB

Committed_AS: 801028 kB

VmallocTotal: 573496 kB

VmallocUsed: 1784 kB

VmallocChunk: 566444 kB

HugePages_Total: 0

HugePages_Free: 0

HugePages_Rsvd: 0

HugePages_Surp: 0

Hugepagesize: 2048 kB

DirectMap4k: 10176 kB

DirectMap2M: 446464 kB

b. Free –m 能查看到当前内存的使用情况

例:

[root@linux victor]# free -m

total used free shared buffers cached

Mem: 432 423 9 0 13 190 -/+ buffers/cache: 220 212

Swap: 596 43 552

c. Vmstat

例:

[root@linux victor]# vmstat

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----

r b swpd free buff cache si so bi bo in cs us sy id wast 0 0 44284 8836 14096 194800 1 27 750 100 272 599 12 2 76 10 0

d. Dmidecode | grep –I mem 此命令可以显示详细内存相关信息

例:

[root@linux victor]# dmidecode | grep -i mem

Memory Controller Information

Maximum Memory Module Size: 512 MB 系统目前内存

Maximum Total Memory Size: 1024 MB 主板最大内存支持

Supported Memory Types:

Memory Module Voltage: 3.3 V 内存电压

Associated Memory Slots: 2 机器有两个内存插槽

Memory Module Information

Memory Module Information

Descriptor 2: Single-bit ECC memory error

Descriptor 3: Multi-bit ECC memory error

Physical Memory Array

Use: System Memory

Memory Device

Memory Device

Memory Device

32-bit Memory Error Information

Memory Array Address: Unknown

linux主机 查看linux主机系统的基本信息

Memory Array Mapped Address

Memory Device Mapped Address

Memory Array Mapped Address Handle: 0x0014

Memory Device Mapped Address

Memory Array Mapped Address Handle: 0x0014

Memory Device Mapped Address

Memory Array Mapped Address Handle: 0x0014

64-bit Memory Error Information

Memory Array Address: 0x0000000080000000

4. 查看网卡

a. Dmesg |grep -i eth 例:

[root@linux victor]# dmesg | grep -i eth

eth0: SiS 900 PCI Fast Ethernet at 0x2000, IRQ 19, 00:c0:9f:a5:99:c0

eth0: Media Link On 100mbps full-duplex

eth0: no IPv6 routers present

b. Cat /etc/sysconfig/hwconf | grep -i eth

例:

[root@linux victor]# lspci | grep -i eth

00:04.0 Ethernet controller: Silicon Integrated Systems [SiS] SiS900 PCI Fast

Ethernet (rev 91)

c. Lspci | grep -i eth

5. 查看显卡

a. Lspci | grep -i VGA

例:

[root@linux victor]# dmesg | grep -i VGA

Console: colour VGA+ 80x25

vgaarb: device added:

PCI:0000:01:00.0,decodes=io+mem,owns=io+mem,locks=none

vgaarb: loaded

b. Dmesg | gerp -i VGA 例:

[root@linux victor]# lspci | grep -i VGA

01:00.0 VGA compatible controller: Silicon Integrated Systems [SiS] 661/741/760

PCI/AGP or 662/761Gx PCIE VGA Display Adapter

Dmesg 能够查看机器所有的硬件信息,内容很多,查看的时候可以这样 dmesg |

less 这样可以前后翻页。[www.61k.com]

Lspci主要用来查看主板信息。

二、 系统信息

1. 查看内核版本

Uname –a

例:

linux主机 查看linux主机系统的基本信息

[root@linux victor]# uname Linux

[root@linux victor]# uname -a

Linux linux.victor 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 i686 i386 GNU/Linux

2. 查看hostname

hostname 例:

[root@linux victor]# hostname linux.victor

[root@linux victor]# hostname novots 这样可以直接更改hostname

[root@linux victor]# hostname

novots

3. 查看日前登录账户

W who

例:

[root@linux victor]# w

00:53:44 up 41 min, 3 users, load average: 0.05, 0.11, 0.13

USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT

victor tty1 :0 00:13 ? 1:33 0.09s pam:

gdm-passwor

victor pts/0 :0 00:13 39:54 0.00s 0.93s kded4 victor pts/1 :0.0 00:18 0.00s 0.15s 0.03s /bin/bash

[root@linux victor]# who

victor tty1 2010-03-24 00:13 (:0)

victor pts/0 2010-03-24 00:13 (:0)

victor pts/1 2010-03-24 00:18 (:0.0)

4. 查看历史账户登录信息

Last

例:

[root@linux victor]# last victor pts/2 :0.0 Wed Mar 24 00:54 still logged in victor pts/1 :0.0 Wed Mar 24 00:18 still logged in victor pts/0 :0 Wed Mar 24 00:13 still logged in victor tty1 :0 Wed Mar 24 00:13 still logged in reboot system boot 2.6.31.5-127.fc1 Wed Mar 24 00:12 - 00:55 (00:42) reboot system boot 2.6.31.5-127.fc1 Sat Mar 13 09:54 - 09:54 (00:00) reboot system boot 2.6.31.5-127.fc1 Tue Feb 16 18:37 - 18:38 (00:00) victor pts/0 :0 Tue Feb 16 14:02 - down (00:37) victor tty1 :0 Tue Feb 16 14:01 - down (00:38) reboot system boot 2.6.31.5-127.fc1 Tue Feb 16 14:01 - 14:40 (00:38) ……………………………………………………………………………………内容过多,省略

5. 查看系统运行时间

Uptime

例:

[root@linux victor]# uptime

00:56:27 up 43 min, 4 users, load average: 0.20, 0.11, 0.12

linux主机 查看linux主机系统的基本信息

6. 查看IP

Ifconfig 例:

[root@linux victor]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:C0:9F:A5:99:C0

inet addr:192.168.0.102 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::2c0:9fff:fea5:99c0/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8357 errors:0 dropped:0 overruns:0 frame:0

TX packets:5251 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:12377086 (11.8 MiB) TX bytes:374144 (365.3 KiB) Interrupt:19 Base address:0x2000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:46 errors:0 dropped:0 overruns:0 frame:0

TX packets:46 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:2740 (2.6 KiB) TX bytes:2740 (2.6 KiB)

7. 查看进程

Ps –aux 例:

[root@linux victor]# ps -aux

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

root 1 0.0 0.1 2028 512 ? Ss 00:12 0:00 /sbin/init

root 2 0.0 0.0 0 0 ? S< 00:12 0:00

[kthreadd]

root 3 0.0 0.0 0 0 ? S< 00:12 0:00

[migration/0]

root 4 0.0 0.0 0 0 ? S< 00:12 0:00

[ksoftirqd/0]

root 5 0.0 0.0 0 0 ? S< 00:12 0:00

[watchdog/0]

root 6 0.0 0.0 0 0 ? S< 00:12 0:00

[events/0]

……………………………………………………………………………………内容过多,省略

8. 查看时间与日期

Date cal 例:

[root@linux victor]# date

Wed Mar 24 00:58:09 CST 2010

[root@linux victor]# cal

March 2010

Su Mo Tu We Th Fr Sa

1 2 3 4 5 6

linux主机 查看linux主机系统的基本信息

7 8 9 10 11 12 13

14 15 16 17 18 19 20

21 22 23 24 25 26 27

28 29 30 31

参考:

二 : 查看linux主机系统的基本信息

查看linux主机系统的基本信息

一、 硬件信息

1. CPU

a. Cat /proc/cpuinfo 例:

[root@linux victor]# cat /proc/cpuinfo

processor : 0

vendor_id : GenuineIntel

cpu family : 6

model : 13

model name : Intel(R) Celeron(R) M processor 1.50GHz stepping : 8

cpu MHz : 1500.000

cache size : 1024 KB

fdiv_bug : no

hlt_bug : no

f00f_bug : no

coma_bug : no

fpu : yes

fpu_exception : yes

cpuid level : 2

wp : yes

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts

bogomips : 2999.83

clflush size : 64

power management:

b. Dmesg | grep –i ‘cpu’ 例:

[root@linux victor]# dmesg | grep -i 'cpu'

Initializing cgroup subsys cpuset

Initializing cgroup subsys cpu

KERNEL supported cpus:

Transmeta TransmetaCPU

PAT not supported by CPU.

ACPI: SSDT 1bdf645d 001FB (v01 PmRef CpuPm 00003000 INTL 20030224)

SMP: Allowing 1 CPUs, 0 hotplug CPUs

NR_CPUS:32 nr_cpumask_bits:32 nr_cpu_ids:1 nr_node_ids:1 PERCPU: Embedded 15 pages at c1382000, static data 37788 bytes Initializing CPU#0

SLUB: Genslabs=13, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 Initializing cgroup subsys cpuacct

CPU: L1 I cache: 32K, L1 D cache: 32K

CPU: L2 cache: 1024K

mce: CPU supports 5 MCE banks

CPU0: Thermal monitoring enabled (TM1)

CPU0: Intel(R) Celeron(R) M processor 1.50GHz stepping 08 Brought up 1 CPUs

CPU0 attaching NULL sched-domain.

ACPI: CPU0 (power states: C1[C1] C2[C2] C3[C3])

processor LNXCPU:00: registered as cooling_device0

ACPI: Processor [CPU0] (supports 8 throttling states)

Switched to high resolution mode on CPU 0

cpuidle: using governor ladder

cpuidle: using governor menu

microcode: CPU0 sig=0x6d8, pf=0x20, revision=0x20

p4-clockmod: P4/Xeon(TM) CPU On-Demand Clock Modulation available

c. Dmidecode -t processor

例:

[root@linux victor]# dmidecode -t processor

# dmidecode 2.10

SMBIOS version fixup (2.31 -> 2.3).

SMBIOS 2.3 present.

Handle 0x0004, DMI type 4, 35 bytes

Processor Information

Socket Designation: Socket 479M

Type: Central Processor

Family: Unknown

Manufacturer: Intel

ID: D8 06 00 00 FF FB E9 AF

Version: Intel(R) Celeron(R) M processor

Voltage: 3.3 V

External Clock: 400 MHz

Max Speed: 1500 MHz

Current Speed: 1500 MHz

Status: Populated, Enabled

Upgrade: ZIF Socket

L1 Cache Handle: Not Provided

L2 Cache Handle: 0x0008

L3 Cache Handle: Not Provided

Serial Number: Not Specified

Asset Tag: Not Specified

Part Number: Not Specified

2. 硬盘

a. fdisk 查看分区信息,能够查看到所有的硬盘分区。 例:

[root@linux victor]# fdisk -l

Disk /dev/sda: 40.0 GB, 40007761920 bytes

255 heads, 63 sectors/track, 4864 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0xe7e0e7e0

Device Boot Start End Blocks Id System

/dev/sda1 1 1963 15767766 7 HPFS/NTFS

/dev/sda2 1964 3011 8418060 83 Linux

/dev/sda3 3012 4135 9028530 f W95 Ext'd (LBA) /dev/sda4 4136 4864 5855692+ 83 Linux /dev/sda5 * 3012 4059 8418028+ 83 Linux

/dev/sda6 4060 4135 610438+ 82 Linux swap / Solaris

b. df查看大小情况,只能查看到当前已挂载的分区。

例:

[root@linux victor]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/sda5 8.0G 7.4G 173M 98% /

tmpfs 217M 780K 216M 1% /dev/shm

/dev/sda1 16G 14G 1.9G 88% /media/disk

c. du 查看使用情况,相当于windows的右键属性看大小了。

例:

[root@linux victor]# ls

Desktop Downloads Pictures Templates workspace Documents Music Public Videos

[root@linux victor]# du -h Downloads/

1.2M Downloads/nmon_x86_12a

139M Downloads/

3. 内存

a. Cat /proc/meminfo

例:

[root@linux victor]# cat /proc/meminfo

MemTotal: 443200 kB

MemFree: 9464 kB

Buffers: 13736 kB

Cached: 194672 kB

SwapCached: 2364 kB

Active: 156528 kB

Inactive: 242948 kB

Active(anon): 65480 kB

Inactive(anon): 127156 kB

Active(file): 91048 kB

Inactive(file): 115792 kB

Unevictable: 0 kB

Mlocked: 0 kB

HighTotal: 0 kB

HighFree: 0 kB

LowTotal: 443200 kB

LowFree: 9464 kB

SwapTotal: 610428 kB

SwapFree: 566144 kB

Dirty: 44 kB

Writeback: 0 kB

AnonPages: 189164 kB

Mapped: 56164 kB

Slab: 18284 kB

SReclaimable: 9500 kB

SUnreclaim: 8784 kB

PageTables: 8840 kB

NFS_Unstable: 0 kB

Bounce: 0 kB

WritebackTmp: 0 kB

CommitLimit: 832028 kB

Committed_AS: 801028 kB

VmallocTotal: 573496 kB

VmallocUsed: 1784 kB

VmallocChunk: 566444 kB

HugePages_Total: 0

HugePages_Free: 0

HugePages_Rsvd: 0

HugePages_Surp: 0

Hugepagesize: 2048 kB

DirectMap4k: 10176 kB

DirectMap2M: 446464 kB

b. Free –m 能查看到当前内存的使用情况

例:

[root@linux victor]# free -m

total used free shared buffers cached

Mem: 432 423 9 0 13 190 -/+ buffers/cache: 220 212

Swap: 596 43 552

c. Vmstat

例:

[root@linux victor]# vmstat

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----

r b swpd free buff cache si so bi bo in cs us sy id wast 0 0 44284 8836 14096 194800 1 27 750 100 272 599 12 2 76 10 0

d. Dmidecode | grep –I mem 此命令可以显示详细内存相关信息

例:

[root@linux victor]# dmidecode | grep -i mem

Memory Controller Information

Maximum Memory Module Size: 512 MB 系统目前内存

Maximum Total Memory Size: 1024 MB 主板最大内存支持

Supported Memory Types:

Memory Module Voltage: 3.3 V 内存电压

Associated Memory Slots: 2 机器有两个内存插槽

Memory Module Information

Memory Module Information

Descriptor 2: Single-bit ECC memory error

Descriptor 3: Multi-bit ECC memory error

Physical Memory Array

Use: System Memory

Memory Device

Memory Device

Memory Device

32-bit Memory Error Information

Memory Array Address: Unknown

Memory Array Mapped Address

Memory Device Mapped Address

Memory Array Mapped Address Handle: 0x0014

Memory Device Mapped Address

Memory Array Mapped Address Handle: 0x0014

Memory Device Mapped Address

Memory Array Mapped Address Handle: 0x0014

64-bit Memory Error Information

Memory Array Address: 0x0000000080000000

4. 查看网卡

a. Dmesg |grep -i eth 例:

[root@linux victor]# dmesg | grep -i eth

eth0: SiS 900 PCI Fast Ethernet at 0x2000, IRQ 19, 00:c0:9f:a5:99:c0

eth0: Media Link On 100mbps full-duplex

eth0: no IPv6 routers present

b. Cat /etc/sysconfig/hwconf | grep -i eth

例:

[root@linux victor]# lspci | grep -i eth

00:04.0 Ethernet controller: Silicon Integrated Systems [SiS] SiS900 PCI Fast

Ethernet (rev 91)

c. Lspci | grep -i eth

5. 查看显卡

a. Lspci | grep -i VGA

例:

[root@linux victor]# dmesg | grep -i VGA

Console: colour VGA+ 80x25

vgaarb: device added:

PCI:0000:01:00.0,decodes=io+mem,owns=io+mem,locks=none

vgaarb: loaded

b. Dmesg | gerp -i VGA 例:

[root@linux victor]# lspci | grep -i VGA

01:00.0 VGA compatible controller: Silicon Integrated Systems [SiS] 661/741/760

PCI/AGP or 662/761Gx PCIE VGA Display Adapter

Dmesg 能够查看机器所有的硬件信息,内容很多,查看的时候可以这样 dmesg |

less 这样可以前后翻页。

Lspci主要用来查看主板信息。

二、 系统信息

1. 查看内核版本

Uname –a

例:

[root@linux victor]# uname Linux

[root@linux victor]# uname -a

Linux linux.victor 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 i686 i386 GNU/Linux

2. 查看hostname

hostname 例:

[root@linux victor]# hostname linux.victor

[root@linux victor]# hostname novots 这样可以直接更改hostname

[root@linux victor]# hostname

novots

3. 查看日前登录账户

W who

例:

[root@linux victor]# w

00:53:44 up 41 min, 3 users, load average: 0.05, 0.11, 0.13

USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT

victor tty1 :0 00:13 ? 1:33 0.09s pam:

gdm-passwor

victor pts/0 :0 00:13 39:54 0.00s 0.93s kded4 victor pts/1 :0.0 00:18 0.00s 0.15s 0.03s /bin/bash

[root@linux victor]# who

victor tty1 2010-03-24 00:13 (:0)

victor pts/0 2010-03-24 00:13 (:0)

victor pts/1 2010-03-24 00:18 (:0.0)

4. 查看历史账户登录信息

Last

例:

[root@linux victor]# last victor pts/2 :0.0 Wed Mar 24 00:54 still logged in victor pts/1 :0.0 Wed Mar 24 00:18 still logged in victor pts/0 :0 Wed Mar 24 00:13 still logged in victor tty1 :0 Wed Mar 24 00:13 still logged in reboot system boot 2.6.31.5-127.fc1 Wed Mar 24 00:12 - 00:55 (00:42) reboot system boot 2.6.31.5-127.fc1 Sat Mar 13 09:54 - 09:54 (00:00) reboot system boot 2.6.31.5-127.fc1 Tue Feb 16 18:37 - 18:38 (00:00) victor pts/0 :0 Tue Feb 16 14:02 - down (00:37) victor tty1 :0 Tue Feb 16 14:01 - down (00:38) reboot system boot 2.6.31.5-127.fc1 Tue Feb 16 14:01 - 14:40 (00:38) ……………………………………………………………………………………内容过多,省略

5. 查看系统运行时间

Uptime

例:

[root@linux victor]# uptime

00:56:27 up 43 min, 4 users, load average: 0.20, 0.11, 0.12

6. 查看IP

Ifconfig 例:

[root@linux victor]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:C0:9F:A5:99:C0

inet addr:192.168.0.102 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::2c0:9fff:fea5:99c0/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8357 errors:0 dropped:0 overruns:0 frame:0

TX packets:5251 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:12377086 (11.8 MiB) TX bytes:374144 (365.3 KiB) Interrupt:19 Base address:0x2000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:46 errors:0 dropped:0 overruns:0 frame:0

TX packets:46 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:2740 (2.6 KiB) TX bytes:2740 (2.6 KiB)

7. 查看进程

Ps –aux 例:

[root@linux victor]# ps -aux

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

root 1 0.0 0.1 2028 512 ? Ss 00:12 0:00 /sbin/init

root 2 0.0 0.0 0 0 ? S< 00:12 0:00

[kthreadd]

root 3 0.0 0.0 0 0 ? S< 00:12 0:00

[migration/0]

root 4 0.0 0.0 0 0 ? S< 00:12 0:00

[ksoftirqd/0]

root 5 0.0 0.0 0 0 ? S< 00:12 0:00

[watchdog/0]

root 6 0.0 0.0 0 0 ? S< 00:12 0:00

[events/0]

……………………………………………………………………………………内容过多,省略

8. 查看时间与日期

Date cal 例:

[root@linux victor]# date

Wed Mar 24 00:58:09 CST 2010

[root@linux victor]# cal

March 2010

Su Mo Tu We Th Fr Sa

1 2 3 4 5 6

7 8 9 10 11 12 13

14 15 16 17 18 19 20

21 22 23 24 25 26 27

28 29 30 31

参考:

三 : linux下如何查看系统和内核版本

1. 查看内核版本命令:

  1) [root@q1test01 ~]# cat /proc/version

    Linux version 2.6.9-22.ELsmp (bhcompile@crowe.devel.redhat.com)(gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)) #1 SMP Mon Sep 1918:00:54 EDT 2005

  2) [root@q1test01 ~]# uname -a

  Linux q1test01 2.6.9-22.ELsmp #1 SMP Mon Sep 19 18:00:54 EDT 2005x86_64 x86_64 x86_64 GNU/Linux

  3) [root@q1test01 ~]# uname -r

  2.6.9-22.ELsmp
2.查看linux的版本主要有三种方法:

1) 登录到服务器执行 lsb_release -a ,即可列出所有版本信息,例如:

[root@3.5.5Biz-46 ~]# lsb_release -a
LSB Version: 1.3
Distributor ID: RedHatEnterpriseAS
Description: Red Hat Enterprise Linux AS release 4 (Nahant Update1)
Release: 4
Codename: NahantUpdate1
[root@3.5.5Biz-46 ~]#

这个命令适用于所有的linux,包括Redhat、SuSE、Debian等发行版。

2) 登录到linux执行cat /etc/redhat-release ,例如如下:
[root@3.5.5Biz-46 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 1)
[root@3.5.5Biz-46 ~]#

这种方式下可以直接看到具体的版本号,比如 AS4 Update 1

3)登录到linux执行rpm -q redhat-release ,例如如下

[root@3.5.5Biz-46 ~]# rpm -q redhat-release
redhat-release-4AS-2.4
[root@3.5.5Biz-46 ~]#

这种方式下可看到一个所谓的release号,比如上边的例子是2.4
这个release号和实际的版本之间存在一定的对应关系,如下:

redhat-release-3AS-1 -> Redhat Enterprise Linux AS3
redhat-release-3AS-7.4 -> Redhat Enterprise Linux AS3 Update 4
redhat-release-4AS-2 -> Redhat Enterprise Linux AS4
redhat-release-4AS-2.4 -> Redhat Enterprise Linux AS4 Update 1
redhat-release-4AS-3 -> Redhat Enterprise Linux AS 4Update 2
redhat-release-4AS-4.1 -> Redhat Enterprise Linux AS4 Update 3
redhat-release-4AS-5.5 -> Redhat Enterprise Linux AS4 Update 4

注意:第(2)(3)两种方法只对Redhat Linux有效

四 : linux查看系统资源

LINUX查看系统资源

1. 查看磁盘

用#df –h这个命令。[www.61k.com]查看信息如下:

其中Size是总共的磁盘大小,这里是19G

Used是用了多少

Avail是可用的大小。

2. 查看内存大小

#free –m这个命令即可

Total:内存总大小

Used:已占用内存大小

Free:空闲内存大小

Swap:一般在linux里,swap是物理内存的2倍

3. 查看cpu

cat /proc/cpuinfo,显示信息如下,这是cpu一些基本信息(咱们查看时候可以忽律)

系统资源怎么看 linux查看系统资源

系统资源怎么看 linux查看系统资源

系统资源怎么看 linux查看系统资源

系统资源怎么看 linux查看系统资源

4. 最后用top命令,查看所有状态

Top命令的作用是显示系统当前的进程和其他状况; top是一个动态显示过程,即可以通过用户按键来不断刷新当前状态.如果在前台执行该命令,它将独占前台,直到用户终止该程序为止. 比较准确的说,top命令提供了实时的对系统处理器的状态监视.它将显示系统中CPU最“敏感”的任务列表.该命令可以按CPU使用.内存使用和执行时间对任务进行排序;而且该命令的很多特性都可以通过交互式命令或者在个人定制文件中进行设定.

输入#top命令,显示信息如下:

统计信息区

前五行是系统整体的统计信息。(www.61k.com]

系统资源怎么看 linux查看系统资源

第一行是任务队列信息,同 uptime 命令的执行结果。其内容如下:

08:57:45 当前时间

up 7:19系统运行时间,格式为时:分

1 user 当前登录用户数

系统资源怎么看 linux查看系统资源

load average: 0.00, 0.00, 0.00 系统负载,即任务队列的平均长度。(www.61k.com)

三个数值分别为 1分钟、5分钟、15分钟前到现在的平均值。

第二、三行为进程和CPU的信息。当有多个CPU时,这些内容可能会超过两行。内容如下:

Tasks: 107 total 进程总数

2 running 正在运行的进程数

105 sleeping 睡眠的进程数

0 stopped 停止的进程数

0 zombie 僵尸进程数

Cpu(s): 0.0% us 用户空间占用CPU百分比

0.3% sy 内核空间占用CPU百分比

0.0% ni 用户进程空间内改变过优先级的进程占用CPU百分比

99.7% id 空闲CPU百分比

0.0% wa 等待输入输出的CPU时间百分比

0.0% hi

0.0% si

最后两行为内存信息。内容如下:

Mem: 509472k total 物理内存总量

433500k used 使用的物理内存总量

75972k free 空闲内存总量

28548k buffers 用作内核缓存的内存量

Swap: 1048568k total 交换区总量

112k used 使用的交换区总量

1048456k free 空闲交换区总量

186688k cached 缓冲的交换区总量。

内存中的内容被换出到交换区,而后又被换入到内存,但使用过的交换区尚未被覆盖, 该数值即为这些内容已存在于内存中的交换区的大小。

相应的内存再次被换出时可不必再对交换区写入。

进程信息区

统计信息区域的下方显示了各个进程的详细信息。首先来认识一下各列的含义。 序号 列名 含义

系统资源怎么看 linux查看系统资源

a PID 进程id

b USER 进程所有者的用户名

c PR 优先级

d NI nice值。[www.61k.com)负值表示高优先级,正值表示低优先级

e VIRT 进程使用的虚拟内存总量,单位kb。VIRT=SWAP+RES

f RES 进程使用的、未被换出的物理内存大小,单位kb。RES=CODE+DATA

h SHR 共享内存大小,单位kb

i S 进程状态。

j %CPU 上次更新到现在的CPU时间占用百分比

k %MEM 进程使用的物理内存百分比

l TIME+ 进程使用的CPU时间总计,单位1/100秒

m COMMAND 命令名/命令行

默认情况下仅显示比较重要的 PID、USER、PR、NI、VIRT、RES、SHR、S、%CPU、%MEM、TIME+、COMMAND 列。这里我只介绍到这,够用了,如有需要,google是你的十万个为什么。谢谢!

本文标题:linux查看系统版本-查看linux主机系统的基本信息
本文地址: http://www.61k.com/1152386.html

61阅读| 精彩专题| 最新文章| 热门文章| 苏ICP备13036349号-1