Common commands for viewing system information in linux

Source: Internet
Author: User
Tags nameserver
1: cpu [root @ srv/] # more/proc/cpuinfo | grep & quot; modelname: Intel (R) Xeon (R) CPUX3220@2.40GHzmodelname: Intel (R) xeon (R) CPUX3220@2.40GHz

I. cpu

[Root @ srv/] # more/proc/cpuinfo | grep "model name"

Model name: Intel (R) Xeon (R) CPU X3220 @ 2.40 GHz

Model name: Intel (R) Xeon (R) CPU X3220 @ 2.40 GHz

Model name: Intel (R) Xeon (R) CPU X3220 @ 2.40 GHz

Model name: Intel (R) Xeon (R) CPU X3220 @ 2.40 GHz

[Root @ srv/] # grep "model name"/proc/cpuinfo

Model name: Intel (R) Xeon (R) CPU X3220 @ 2.40 GHz

Model name: Intel (R) Xeon (R) CPU X3220 @ 2.40 GHz

Model name: Intel (R) Xeon (R) CPU X3220 @ 2.40 GHz

Model name: Intel (R) Xeon (R) CPU X3220 @ 2.40 GHz

[Root @ srv/] # grep "model name"/proc/cpuinfo | cut-f2-d:

Intel (R) Xeon (R) CPU X3220 @ 2.40 GHz

Intel (R) Xeon (R) CPU X3220 @ 2.40 GHz

Intel (R) Xeon (R) CPU X3220 @ 2.40 GHz

Intel (R) Xeon (R) CPU X3220 @ 2.40 GHz

II. memory

[Root @ srv/] # grep MemTotal/proc/meminfo

MemTotal: 614400 kB

[Root @ srv/] # free-m

Total used free shared buffers cached

Mem: 600 23 576 0 0 0

-/+ Buffers/cache: 23 576

Swap: 0 0 0

[Root @ srv/] # free-m | grep "Mem" | awk '{print $2 }'

600

3. view the number of CPU bits (32 or 64)

[Root @ srv/] # getconf LONG_BIT

32

4. view the linux version

[Root @ srv/] # more/etc/redhat-release

CentOS release 5 (Final)

[Root @ srv/] # more/etc/issue

CentOS release 5 (Final)

Kernel \ r on an \ m

[Root @ srv/] # more/proc/version

Linux version 2.6.18-92.1.18.el5.028stab060.2PAE ([email = root @ rhel5-32-build-xemul] root @ rhel5-32-build-xemul [/email]) (gc

C version 4.1.2 20071124 (Red Hat 4.1.2-42) #1 SMP Tue Jan 13 12:31:30 MSK 2009

V. view the kernel version

[Root @ srv/] # uname-r

2.6.18-92.1.18.el5.028stab060.2PAE

[Root @ srv/] # uname-

Linux srv.eddiechen.cn 2.6.18-92.1.18.el5.028stab060.2PAE #1 SMP Tue Jan 13 12:31:30 MSK 2009 i686 i686 i386 GNU/Linux

VI. view the time zone

[Root @ srv/] # date-R

Wed, 25 Feb 2009 02:20:50 + 0000

[Root @ srv/] # mv/etc/localtime. save

[Root @ srv/] # cp/usr/share/zoneinfo/Asia/Shanghai/etc/localtime

[Root @ srv/] # date-R

Wed, 25 Feb 2009 10:24:26 + 0800

7. host name

View host name

[Root @ srv/] # hostname

Www.ifuoo.com

Modify host name

[Root @ srv/] # cat/etc/sysconfig/network

8. View selinux information

[Root @ srv/] # sestatus

SELinux status: disabled

9. Network

IP

[Root @ srv/] # ifconfig | grep 'inet addr: '| grep-v' 127. 0.0.1' | cut-d:-f2 | awk '{print $1 }'

207.154.202.216

Gateway

[Root @ srv/] # cat/etc/sysconfig/network

NETWORKING = "yes"

GATEWAY = "192.0.2.1"

HOSTNAME = "srv.eddiechen.cn"

Dns

[Root @ srv/] # cat/etc/resolv. conf

Nameserver 208.74.168.131

Nameserver 208.74.168.132

Nameserver 4.2.2.1

Modify the Host file

[Root @ srv/] # cat/etc/hosts

10. installed software packages

[Root @ srv/] # rpm-qa | wc-l

197

[Root @ srv/] # yum list installed | wc-l

198

11: disks and partitions

[Root @ srv/] # df-h

Filesystem Size Used Avail Use % Mounted on

/Dev/simfs 10G 353 M 9.7G 4%/

[Root @ srv/] # du-sh

353 M

[Root @ srv/] # du/etc-sh

4.6 M/etc

9. view the keyboard layout

Cat/etc/sysconfig/keyboard

Cat/etc/sysconfig/keyboard | grep KEYTABLE | cut-f2-d =

12: view the default language

Echo $ LANG $ LANGUAGE

Cat/etc/sysconfig/i18n

========================================

Http://hi.baidu.com/mypc007

Run the following command to view the physical memory size of the RS/6000 system.

Lsdev-Cc memory

View the physical memory device configured in RS/6000. The following is an example output:

Mem0 Available 00-00 Memory

L2cache0 Available 00-00 L2 Cache

Then use the command

Lsattr-El mem0

Output:

Size 512 Total amount of physical memory in Mbytes False

Goodsize 512 Amount of usable physical memory in Mbytes False

In this example, the physical memory of the machine is 512 MB. If there is mem1 in the output of lsdev, run the same command to view the corresponding size and push it accordingly. L2cache0 is the device name of Level 2 Cache. Similarly, run the following command:

Lsattr-El L2cache0

You can view its size.

View LINUX system digits

1. programming implementation:

Return the value of sizeof (int) in the program. The Returned result is the number of bytes in the operating system. If 4 is returned, it is a 32-bit operating system, and 8 is 64-bit.

2. getconf command:

The getconf command can obtain basic system configuration information, such as the number of operating systems, memory size, and disk size.

For example:

Determine the disk hdisk0 size. if it is a root user, enter:

Getconf DISK_SIZE/dev/hdisk0

Determine the actual memory size: getconf REAL_MEMORY

Determine whether the hardware of the machine is 32-bit or 64-bit: getconf HARDWARE_BITMODE

Determine whether the kernel is 32-bit or 64-bit: getconf KERNEL_BITMODE

If the above getconf KERNEL_BITMODE method fails (it fails on my machine), it may be because the version is inconsistent. try again: getconf WORD_BIT. this command returns the length of the int type, consistent with sizeof (int.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.