Common Query command collation under Linux centos6.x

Source: Internet
Author: User
Tags dmesg

Linux centos6.x Common Query command collation----1. System basic Information----View System version
cat /etc/redhat-release[[email protected] ~]# cat /etc/redhat-releaseCentOS release 6.9 (Final)
View Processor Architecture
arch 或 uname -m[[email protected] ~]# archx86_64[[email protected] ~]# uname -mx86_64
View Kernel version
uname -r 或 cat /proc/version[[email protected] ~]# uname -r2.6.32-696.23.1.el6.x86_64[[email protected] ~]# cat /proc/versionLinux version 2.6.32-696.23.1.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Tue Mar 13 22:44:18 UTC 2018
viewing system Information
uname -a[[email protected] ~]# uname -aLinux test 2.6.32-696.23.1.el6.x86_64 #1 SMP Tue Mar 13 22:44:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
View system time
date[[email protected] ~]# dateThu Apr  5 16:06:07 CST 2018
----2. User-related Information----view Current user
whoami[[email protected] ~]# whoamiroot
View currently logged in System user
w[[email protected] ~]# w15:50:09 up 22:04,  1 user,  load average: 0.00, 0.00, 0.00USER    TTY      FROM              [email protected]  IDLE  JCPU  PCPU WHATroot    pts/0    255.255.255.255  15:37    0.00s  0.00s  0.00s w
View user Information
cat /etc/passwd[[email protected] ~]# cat /etc/passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologin
View User group information
cat /etc/group[[email protected] ~]# cat /etc/grouproot:x:0:bin:x:1:bin,daemon
----3. Hardware + performance-related----View CPU information
cat /proc/cpuinfo[[email protected] ~]# cat /proc/cpuinfoprocessor      : 0vendor_id      : GenuineIntelcpu family      : 6model          : 79model name      : Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz......
View memory Information
cat /proc/meminfo[[email protected] ~]# cat /proc/meminfoMemTotal:        2054152 kBMemFree:        1638884 kBBuffers:          31096 kBCached:          302444 kBSwapCached:            0 kB......
View CPU memory updates every five seconds
vmstat 5[[email protected] ~]# vmstat 5procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----r  b  swpd  free  buff  cache  si  so    bi    bo  in  cs us sy id wa st0  0      0 1638884  31112 302536    0    0    3    3  68  157  0  0 100  0  00  0      0 1638728  31112 302556    0    0    0    0  79  168  0  0 100  0  00  0      0 1638728  31120 302556    0    0    0    2  86  176  0  0 100  0  00  0      0 1638728  31120 302556    0    0    0    0  79  167  0  0 100  0  0
View disk space remaining
df -h[[email protected] ~]# df -hFilesystem      Size  Used Avail Use% Mounted on/dev/vda1        40G  1.6G  36G  5% /tmpfs          939M    0  939M  0% /dev/shm
View disk remaining Inodes node
df -i[[email protected] ~]# df -iFilesystem      Inodes IUsed  IFree IUse% Mounted on/dev/vda1      2621440 62268 2559172    3% /tmpfs          240257    1  240256    1% /dev/shm
View System Average Load
cat /proc/loadavg1、5、15分钟内的平均进程数、正在运行的进程数/进程总数、最近运行的进程ID号[[email protected] ~]# cat /proc/loadavg0.00 0.00 0.00 1/103 9728
View system run time + load
uptime[[email protected] ~]# uptime16:01:41 up 22:15,  1 user,  load average: 0.00, 0.00, 0.00
Network Status View
// 查看 指定端口netstat -nlpt | grep 22[[email protected] test]# netstat -nlpt | grep 22tcp        0      0 0.0.0.0:22                  0.0.0.0:*                  LISTEN      1245/sshd// 查看当前tcp连接数(ESTABLISHED)netstat -nat | grep ESTABLISHED|wc -l[[email protected] test]# netstat -nat | grep ESTABLISHED|wc -l2// 查看当前tcp连接数(TIME_WAIT)netstat -na  | grep ‘TIME_WAIT‘ |wc -l[[email protected] test]# netstat -na  | grep ‘TIME_WAIT‘ |wc -l0//  查看当前tcp连接数(指定端口)netstat -nat | grep -i "22"|wc -l[[email protected] test]# netstat -nat | grep -i "22"|wc -l2
----4. Service-related----system performance-top
Top[[email protected] ~]# toptop-16:11:31 up 22:25, 1 user, Load average:0.00, 0.00, 0.00tasks:76 total, 1 ru Nning, sleeping, 0 stopped, 0 zombiecpu (s): 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%stme   m:2054152k Total, 417164k used, 1636988k free, 31384k buffersswap:0k total, 0k used, 0k free,                                                                                                                                                                303324k cached PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND                                                                                                                                                                      1168 Root 0 125m 12m 8588 S 0.0 0.6 2:31.16 Aliyundun 967                                                                                       7 Root 0 100m 4464 3424 S 0.0 0.2 0:00.04 sshd                                                                                     1364 postfix 0 81200 3516 2632 S     0.0 0.2 0:00.04 Qmgr
System operating conditions-htop
htop需 yum install htop[[email protected] ~]# htop  CPU[                                                                                                        0.0%]    Tasks: 25, 27 thr; 1 running  Mem[|||||##****************                                                                            81/2006MB]    Load average: 0.00 0.00 0.00   Swp[                                                                                                      0/0MB]    Uptime: 22:26:59  PID USER      PRI  NI  VIRT  RES  SHR S CPU% MEM%  TIME+  Command                                                                                                                                                                      1168 root      20  0  125M 12832  8588 S  0.3  0.6  2:31.33 /usr/local/aegis/aegis_client/aegis_10_41/AliYunDun    
View the specified process
ps -ef | grep 进程名[[email protected] ~]# ps -ef | grep sshdroot      1245    1  0 Apr04 ?        00:00:00 /usr/sbin/sshdroot      9677  1245  0 15:37 ?        
View service Status
chkconfig --list[[email protected] ~]# chkconfig --listaegis          0:off  1:off  2:on    3:on    4:on    5:on    6:offagentwatch      0:off  1:off  2:on    3:on    4:on    5:on    6:offaliyun-util    0:off  1:off  2:on    3:on    4:on    5:on    6:off
----5. Log related----View the commands that the current user has executed
history[[email protected] ~]# history    1  ls    2  clear    3  history
View the last 5 lines of system logs
dmesg | tail -n5[[email protected] ~]# dmesg | tail -n5  alloc irq_desc for 30 on node -1  alloc kstat_irqs on node -1virtio-pci 0000:00:04.0: irq 30 for MSI/MSI-XIPv6: Loaded, but administratively disabled, reboot required to enabletype=1305 audit(1522835175.952:3): audit_pid=1031 old=0 auid=4294967295 ses=4294967295 res=1
----6. FILE-related----show total file size per file size
ll -ht[[email protected] test]# ll -httotal 12K-rw-r--r-- 1 root root 19 Apr  5 09:48 1.txt-rw-r--r-- 1 root root  1 Apr  4 17:56 3.png-rw-r--r-- 1 root root  1 Apr  4 17:56 2.png
Tail viewing files
 // 显示最后20行tail -n 20 error.log // 时时刷新日志显示tail -f access.log
Global Find File
find / -name 1.txt[[email protected] test]# find / -name 1.txt/usr/local/src/test/1.txt

Common Query command collation under Linux centos6.x

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.