Linux Command to view system information

Source: Internet
Author: User

Linux Command to view system information

View disk Information

Df to view disk usage, which has been introduced. Fdisk is used for disk partitioning. We just need its-l command to view the disk partition. As follows:
M @ sys :~ /Program/C_codes/algorithms $ sudo fdisk-l [sudo] password for m: Disk/dev/sda: 500.1 GB, 500107862016 bytes255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectorsUnits = sector of 1*512 = 512 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x0006fe98 device start end block number Id system/dev/sda1 * 2048 508022783 254010368 83 Linux/dev/sda2 508024830 976771071 234373121 5 extensions/dev/sda5 508024832 937709567 214842368 83 Linux/dev/sda6 937711616 967008255 14648320 82 Linux switch/Solaris/dev/sda7 967010304 976771071 83 Linux

The provided information is still very detailed.

Dumpe2fs view the details of a specific partition. Different file systems can be installed in each partition, and only one file system exists. Therefore, partitions are equivalent to file systems. This command provides a lot of information, and the overall architecture is like this: first, the overall information of the file system; then, the unit is block group, from group0 to the last group. Let's take a look ..

View cpu Information

Lscpu will provide a relatively simple information
M @ sys :~ /Program/C_codes/algorithms $ lscpuArchitecture: i686CPU run mode: 32-bit, 64-bitByte Order: Little EndianCPU (s): 4On-line CPU (s) list: 0-3 threads per core: 1 each seat number of cores: 4 Socket (s): 1 vendor ID: GenuineIntelCPU series: 6 models: 23 step: 10 CPU MHz: 2659.968 BogoMIPS: 5319.93 Virtualization: VT-xL1d cache: 32KL1i cache: 32KL2 cache: 2048 K
To view more detailed information, you can use cat/proc/cpuinfo to introduce the/proc file system in detail later.

View memory usage

Free is just an overview
m@sys:~$ free -h total used free shared buffers cachedMem: 3.8G 3.3G 531M 364M 145M 1.3G-/+ buffers/cache: 1.9G 2.0GSwap: 13G 94M 13G
To view more detailed information, run the cat/proc/meminfo command. Free is also obtained from here.

Other commands similar to lscpu for viewing hardware information

Lsusb lists the usb bus information and device information. Lsscsi lists information about scsi/sata devices, such as hard drives and disc drives. Lspci lists information on the pci bus and information about all devices connected to the pci bus.

Lshw lists the parameter information of many different hardware, including cpu, memory, disk, usb controller, and nic, lshw extracts hardware information from different files in the/proc file directory.

Lsblk lists all block device information, including hard disk partition information and other storage devices, such as optical disks and flash memory.

View operating system information

Uname-a kernel information. For specific parameters, see man.

m@meng:~/blog$ uname -aLinux meng 3.13.0-55-generic #94-Ubuntu SMP Thu Jun 18 00:28:41 UTC 2015 i686 i686 i686 GNU/Linux

View the operating system version

m@meng:~/blog$ cat /etc/issueUbuntu 14.04.2 LTS \n \lm@meng:~/blog$ sudo lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 14.04.2 LTSRelease: 14.04Codename: trusty

Command for viewing user information

Who am I? Display the current user (this command seems useless ...) W displays the names of users who have logged on to the system and what they are doing. The information used by this command comes from the/var/run/utmp file.
M @ sys :~ $ W 19:53:00 up 4 days, 4 users, load average: 2.63, 1.98, 1.60 user tty from login @ idle jcpu pcpu what m: 0: 0 4 15? Xdm? 6: 42 m 1.00 s init -- user m pts/18: 0 day 16 8: 54 m 0.55 s 0.40 s vim PrimeControl. java m pts/0: 0 day 11 12.00 s 0.49 s 0.28 s vim/home/m/blog/source/_ posts/Linux Command to view system information. md m pts/25: 0 day 12 4.00 s 0.16 s 41.02 s gnome-terminal

The displayed information includes the user name.
User's machine name or tty number
Remote Host address
Time when the user logs on to the system
Idle Time (little effect)
Time (JCPU time) used by the process appended to tty (Terminal)
Time used by the current process (PCPU time)
Command currently in use

m@sys:~$ whom :0 2015-05-14 15:24 (:0)m pts/18 2015-05-17 16:57 (:0)m pts/0 2015-05-17 11:10 (:0)m pts/25 2015-05-17 12:17 (:0)

For other options, see man.

Whois is followed by the account name. You can view the detailed information of this account.

Id: displays detailed information of a specific user, similar to whois. When no parameter is added, the current user is displayed by default.

M @ sys :~ $ Iduid = 1000 (m) gid = 1000 (m) group = 1000 (m), 4 (adm), 24 (cdrom), 27 (sudo), 30 (dip ), 46 (plugdev), 112 (lpadmin), 124 (sambashare)

Last is used to display the logon history of a specific user. If no parameter is specified, the historical information of all users is displayed. By default, the information displayed will be from the/var/log/wtmp file. The output result of this command contains the following columns:
User name, tty device number, historical logon time date, logout time date, total working time

m@sys:~$ last mm pts/18 :0 Sun May 17 16:57 still logged in m pts/26 :0 Sun May 17 15:08 - 15:32 (00:24) m pts/18 :0 Sun May 17 14:45 - 15:32 (00:47) m pts/25 :0 Sun May 17 12:17 still logged in m pts/0 :0 Sun May 17 11:10 still logged in m pts/0 :0 Thu May 14 20:19 - 11:09 (2+14:50) 。。。。

Command for viewing Network Information

Display the host name hostname host to view the IP address of a domain name
m@sys:~$ host www.baidu.comwww.baidu.com is an alias for www.a.shifen.com.www.a.shifen.com has address 119.75.218.70www.a.shifen.com has address 119.75.217.109

Ifconfig displays the local IP address, MAC address, and other information. This command is very powerful and has many options. See man.

Sys :~ $ Ifconfig eth0 Link encap: Ethernet hardware address bc: 30: 5b: 98: c7: cf inet address: 192.168.108.146 broadcast: 192.168.108.255 mask: 255.255.255.0inet6 address: fe80: be30: 5bff: fe98: c7cf/64 Scope: LinkUP broadcast running multicast mtu: 1500 hops: 1 receive packets: 2725973 error: 0 discard: 0 overload: 0 frames: 0 send packets: 1762647 error: 0 discard: 0 overload: 0 carrier: 0 collision: 0 sending queue length: 1000 received Bytes: 3117576569 (3.1 GB) sent Bytes: 244501778 (244.5 MB) interrupted: 21 Memory: f7ae0000-f7b00000 lo Link encap: local LOOPBACK inet address: 127.0.0.1 mask: 255.0.0.0inet6 address: 1/128 Scope: HostUP loopback running mtu: 65536 hops: 1 receive packet: 82508 error: 0 discard: 0 overload: 0 frames: 0 sent packets: 82508 error: 0 dropped: 0 overload: 0 carrier: 0 collision: 0 sending queue length: 0 received Bytes: 19065248 (19.0 MB) sending byte: 19065248 (19.0 MB)

Netstat: view the network port. Of course, this function is more powerful than that. Several of my frequently used options are-apn. Check the other options for man. The output of netstat is divided into two parts: the TCP/IP network interface and the traditional Unix socket. I will only give an example:

M @ sys :~ $ Netstat-apn | tail (not all processes can be detected. process information of all non-local users is not displayed. If you want to see all the information, you must switch to the root user) unix 3 [] stream connected 20532 2749/ibus-ui-gtk3 unix 3 [] stream connected 10431-/var/run/runtime/system_bus_socketunix 2 [] stream connected 19317 2965/gvfsd-trash @/examples-vfs-daemon/socket-mulmC4fDunix 3 [] stream connected 12136 2562/at-spi2-regist unix 3 [] stream connected 14198-/var/run/examples/system_bus_socketunix 3 [] stream connected 1332871 24204/unity-scope-h @ m-com.canonical.Unity.Master.Scope.music.T849459399525853unix 3 [] stream connected 15077-/var/run/secrets/system_bus_socketunix 3 [] stream connected 18815 2465/login-daemon @/tmp/dbus-cZ5hhUQOENunix 3 [] stream connected 4289114 3331/libpepflashpla unix 2 [] datagram 21548-

View System Load

Uptime is used to obtain the host running time and query the linux system load. In the past, the uptime command only showed how long the system was running. Now, we can display how long the system has been running. The information is displayed in sequence as follows: current time, how long the system has been running, how many login users are there, and the average load of the system in the past 1 minute, 5 minutes, and 15 minutes.
m@sys:~$ uptime 20:25:18 up 4 days, 6:07, 4 users, load average: 1.15, 1.27, 1.35

The average system load refers to the average number of processes in the queue running at a specific time interval.
If the number of active processes per CPU core is not greater than 3, the system performance is good. If the number of tasks in each CPU kernel is greater than 5, the performance of this machine is seriously affected.
If your linux host is a dual-core CPU, when the Load Average is 6, it indicates that the host has been fully used.

Vmstat is short for Virtual Meomory Statistics (Virtual Memory Statistics). It monitors Virtual memory, processes, and CPU activity of the operating system. He makes statistics on the overall situation of the system. The disadvantage is that he cannot conduct in-depth analysis on a process.
m@sys:~$ vmstatprocs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 3 0 98736 552864 130232 1298648 0 0 2 10 24 11 3 1 96 0 0

The displayed information is not detailed here. Vmstat is often followed by a number, indicating how long data is collected.

The procinfo command reads relevant data from the/proc directory, and properly sorts the data and outputs it to the standard output device.
m@sys:~$ procinfoMemory: Total Used Free Buffers RAM: 4033684 3253004 780680 130772 Swap: 14648316 98736 14549580 Bootup: Thu May 14 14:17:35 2015 Load average: 1.53 1.29 1.24 2/623 12807 user : 12:34:06.98 3.1% page in : 2753447 nice : 00:01:39.48 0.0% page out: 14451992 system: 02:27:55.42 0.6% page act: 9269897 IOwait: 01:31:07.46 0.4% page dea: 485308 hw irq: 00:00:00.04 0.0% page flt: 409341890 sw irq: 00:00:24.37 0.0% swap in : 4321 idle : 2w 2d 07:35:17.73 95.9% swap out: 28266 uptime: 4d 06:21:29.29 context : 880934961 irq 0: 75 timer irq 23: 2179869 ehci_hcd:usb2, uhirq 1: 3 i8042 irq 40: 22558440 hpet2 irq 7: 1 parport0 irq 41: 23046413 hpet3 irq 8: 1 rtc0 irq 42: 25352135 hpet4 irq 9: 3 acpi irq 43: 22893493 hpet5 irq 12: 4 i8042 irq 48: 1258851 ahci irq 16: 58604 uhci_hcd:usb3 irq 49: 2768638 eth0 irq 17: 0 uhci_hcd:usb4, uh irq 50: 7732162 i915 irq 18: 0 uhci_hcd:usb8 irq 51: 1139 snd_hda_intel irq 22: 2 ehci_hcd:usb1, uh sda 162103r 793668w eth0 TX 232.44MiB RX 2.90GiB lo TX 16.89MiB RX 16.89MiB

.

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.