View hardware information in CentOS

Source: Internet
Author: User
Tags dmesg kingston technology

View hardware information in CentOS

1. The hardware information in centos is comprehensive.
Common CentOS commands to view cpu
More/proc/cpuinfo | grep "model name"
Grep "model name"/proc/cpuinfo
[Root @ localhost/] # grep "CPU"/proc/cpuinfo
Model name: Intel (R) Pentium (R) Dual CPU E2180 @ 2.00 GHz
Model name: Intel (R) Pentium (R) Dual CPU E2180 @ 2.00 GHz
2. view memory using common CentOS commands
Grep MemTotal/proc/meminfo | cut-f2-d: free-m | grep "Mem"
| Awk '{print $2 }'
3. Use common CentOS commands to check whether the cpu is 32-bit or 64-bit
View CPU bits (32 or 64)
Getconf LONG_BIT
4. Use common CentOS commands to view the current linux version
More/etc/redhat-release
Cat/etc/redhat-release
5. Use common CentOS commands to view the kernel version
Uname-r
Uname-
6. Use common CentOS commands to view hard disks and partitions
Df-h fdisk-l can also view partitions.
Du-sh shows all occupied space.
Du/etc-sh to view the directory size
7. Use common CentOS commands to view installed software packages
View the software packages installed during system installation
Cat-n/root/install. log
More/root/install. log | wc-l
8. view the keyboard layout using common CentOS commands
Cat/etc/sysconfig/keyboard
Cat/etc/sysconfig/keyboard | grep KEYTABLE | cut-f2-d =
9. Use common CentOS commands to view selinux Information
Sestatus
Sestatus | cut-f2-d:
Cat/etc/sysconfig/selinux
10. Use common CentOS commands to view ip addresses and mac addresses
In the ifcfg-eth0 file you can see mac, Gateway and other information. Ifconfig cat/etc/sysconfig/network-scripts/ifcfg-eth0 | grep IPADDR

Cat/etc/sysconfig/network-scripts/ifcfg-eth0 | grep IPADDR | cut-f2-d = ifconfig eth0 | grep "inet addr:" | awk

'{Print $2}' | cut-c 6-ifconfig | grep 'inet addr: '| grep-v' 127. 0.0.1 '| cut-d:-f2 | awk' {print $1 }'

View gateway cat/etc/sysconfig/network view dns cat/etc/resolv. conf 12: query using common CentOS commands
View default language
Echo $ LANG $ LANGUAGE
Cat/etc/sysconfig/i18n
11. Run common CentOS commands to check the time zone and whether the UTC time is used.
Cat/etc/sysconfig/clock
12. view the host name using common CentOS commands
Cat/etc/sysconfig/network
Modifying the host name is to modify this file, and it is recommended that you also modify the host file.
13: Use common CentOS commands to view the startup time
Uptime
09:44:45 up 67 days, 23:32 ,...
14. view the motherboard Information
Dmidecode | more

**************************************** **************************************** ******************

1. view all hardware information of the machine:

Dmidecode | more

Dmesg | more

The two commands have a lot of information, so we recommend that you use "| more" for ease of viewing.

2. View CPU Information

Method 1:

CPU-related parameters in Linux are stored in the/proc/cpuinfo file.

Cat/proc/cpuinfo | more

Method 2:

Run the command dmesg | grep CPU to view the startup information of the CPU.

View the number of CPUs:

Getconf LONG_BIT

3. View Mem Information

Cat/proc/meminfo | more (note the last line of output information: MachineMem: 41932272 kB)

Free-m

Top

4. view disk Information

Method 1:

Fdisk-l shows the partition and size of the disk (including the USB flash disk) on the system.

Method 2:

View

Cat/proc/partitions

5. View Nic Information

Method 1:

Ethtool eth0 can use this command to view NIC-related technical indicators

(Not all network cards support this command)

Ethtool-I eth1 and-I parameters to view the NIC Driver

You can try other parameters to view NIC-related technical parameters.

Method 2:

You can also view the NIC name (manufacturer) and other information through dmesg | grep eth0.

View/etc/sysconfig/network-scripts/ifcfg-eth0 to see the current Nic configuration including IP, gateway address and other information.

You can also run the ifconfig command.

6. How to view the motherboard information?

Lspci

7. How to mount an ISO file

Mount-o loop-t iso9660 *. iso mount_point

Unmount umount mount_point.

8. How to view information about a cd

Method 1:

After inserting the CD, in my RHEL5 system, the CD file is/dev/cdrom,

Therefore, you only need to mount/dev/cdrom mount_point.

[Root @ miix tmp] # mount/dev/cdrom mount_point

Mount: block device/dev/cdrom is write-protected, mounting read-only

In fact, take a closer look, the device file of the optical drive is hdc.

[Root @ miix tmp] # ls-l/dev/cdrom *

Lrwxrwxrwx 1 root 3 01-08 08:54/dev/cdrom-> hdc

Lrwxrwxrwx 1 root 3 01-08 08:54/dev/cdrom-hdc-> hdc

Therefore, we can mount/dev/hdc mount_point in this way.

If a valid disc is not included in the optical drive, an error is returned:

[Root @ miix tmp] # mount/dev/hdc mount_point

Mount: media not found

9. How to view USB devices

Method 1:

In fact, you can use the fdisk-l command to view the information of the connected USB flash disk. Your USB flash disk information is as follows:

Disk/dev/sda: 2012 MB, 2012217344 bytes

16 heads, 32 sectors/track, 7676 cylinders

Units = cylinders of 512*512 = 262144 bytes

Device Boot Start End Blocks Id System

/Dev/sda1*16 7676 1961024 B W95 FAT32

The device file of the USB flash drive is in the/dev/sda, 2 GB size, and FAT32 format.

If the user logs on to the Linux GUI, the USB flash drive will not be automatically mounted.

In this case, you can manually mount ):

Mount/dev/sda1 mount_point

The above command mounts the USB flash drive to the mount_point directory of the current directory. Note that sda1 is not sda.

The uninstall command is umount mount_point.

By default, Linux does not have a built-in drive that supports NTFS disks, but supports FAT32 well. The-t vfat parameter is generally not required for mounting.

If ntfs is supported, the-t ntfs parameter should be used for ntfs-format disk partitions.

If garbled characters occur, you can use-o iocharset = character set parameters.

You can use the lsusb command to view the USB device information:

[Root @ miix tmp] # lsusb

Bus 001 Device 001: ID :0000

Bus 002 Device 001: ID :0000

Bus 003 Device 001: ID :0000

Bus 004 Device 002: ID 0951: 1613 Kingston Technology

Bus 004 Device 001: ID :0000

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

Method for obtaining the real number of cores of memory and cpu

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

Linux memory Display Mode

The following shows the usage of the current memory.-m indicates that the content is displayed in MB bytes. Let's take a look.

$ Free-m
Total used free shared buffers cached
Mem: 1002 769 232 0 62 421
-/+ Buffers/cache: 286 715
Swap: 1153 0 1153

Part 1 Mem row:
Total memory: 1002 MB
Used memory used: 769 MB
Free idle memory: 232 MB
Shared is no longer used. It is always 0.
Buffers Buffer cache memory: 62 MB
Cached Page cache memory: 421 MB

Link: total (1002 M) = used (769 M) + free (232 M)

Part 2 (-/+ buffers/cache ):
(-Buffers/cache) used memory size: 286 MB (refers to used-buffers-cached in the first part of the Mem row)
(+ Buffers/cache) free memory: 715 MB (refers to the first part of the Mem row free + buffers + cached)

It can be seen that-buffers/cache reflects the memory actually eaten by the program, while + buffers/cache reflects the total number of memories that can be used.

The third part refers to swap partitions. I don't want to understand it.

I think you are still dizzy after reading the above. The first part (Mem) and the second part (-/+ buffers/cache) are so strange about used and free.
In fact, we can explain it in two ways.
For the operating system, it is the Mem parameter. buffers/cached are all used, so it is considered that free is only 232.
For applications (-/+ buffers/cach). buffers/cached is equivalent to available, because buffer/cached is used to improve the performance of program execution.

When memory is used, buffer/cached will be quickly used.

So, let's take a look at the application. We'll focus on the free and used of (-/+ buffers/cache). So let's take a look at this. In addition, let's tell you some common sense. In order to improve the disk

And memory access efficiency, Linux has made a lot of careful design, in addition to the dentry cache (for VFS, accelerate file path name to inode conversion), also adopted two main

Cache method: Buffer Cache and Page Cache. The former is used to read and write disk blocks, and the latter is used to read and write inode files. These caches can effectively shorten the I/O system

Call time (such as read, write, getdents.

Remember that the memory is used for usage, not for reference. Unlike windows, no matter how much physical memory you have, it will take hard disk swap files for reading.

What are the causes of insufficient virtual space? Think about it. It's boring. When there is still a large amount of memory, you can use some hard disk space to act as the memory. How can the hard disk be faster?

Memory. Therefore, if we look at linux, as long as we don't need swap space for swap, we don't have to worry about too little memory. If we often use a lot of swap, you may have to consider adding physical memory.

This is also the Standard for linux to check whether the memory is sufficient.

View the real number of CPU cores in Linux

Many people know that you can view detailed cpu information by directly typing cat/proc/cpuinfo.

The information is divided into processor 0-n. If you think n is the real number of cpu cores, it is a big mistake.

We know that intel has hyperthread Technology (HT), which can be logically divided into several times the number of cpus. Therefore, the number of processors is inaccurate.

The actual number of cores should be the value of cpu cores.

[Admin @ transmit180 logs] $ cat/proc/cpuinfo

Processor: 0

Vendor_id: GenuineIntel

Cpu family: 6

Model: 15

Model name: Intel (R) Xeon (R) CPU E5310 @ 1.60 GHz

Stepping: 7

Cpu MHz: 1596.035

Cache size: 4096 KB

Physical id: 0

Siblings: 4

Core id: 0

Cpu cores: 4

Fdiv_bug: no

Hlt_bug: no

F00f_bug: no

Coma_bug: no

Fpu: yes

Fpu_exception: yes

Cpuid level: 10

Wp: yes

Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat limit 36 clflush dts acpi mmx fxsr

Sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl tm2 xtpr

Bogomips: 3194.26

The number of physical CPUs. You can specify the number of unique physical IDs.

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.