您的位置:首页 > 运维架构 > Linux

CentOS 7查看系统版本及查看机器位数x86-64 & centOS7下实践查询版本/CPU/内存/硬盘容量等硬件信息

2017-10-30 09:10 681 查看
http://www.linuxidc.com/Linux/2016-11/137550.htm http://blog.csdn.net/dream_broken/article/details/52883883

前言

记下CentOS 7查看系统版本及查看机器位数x86-64的方法,由于不经常使用Linux,每当使用的时候就是安装软件,安装软件的时候就要选择安装包平台,是32位的还是64位的。这时候突然发现不知道怎么查,于是百度。虽然轻而易举百度出来,但仍旧没有自己的笔记看起来舒服。所以,还是记录下来。

辨识标准

首先要清楚什么样标识是32位的,什么样的是64位的。PC server X86 系列I386--I686 都是32位x86_6464位

查看位数命令

命令实在是不要太多,为了防止选择性障碍,一致选择第一种方式,后面的仅作为补充。方法1:
[root@linuxidc ~]# uname -a
Linux linuxidc 3.10.0-327.18.2.el7.x86_64 #1 SMP Thu May 12 11:03:55 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
方法2:显示系统程序信息
[root@linuxidc ~]# file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=aa7ff68f13de25936a098016243ce57c3c982e06, stripped
方法3:
[root@linuxidc ~]# cat /proc/version
Linux version 3.10.0-327.18.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu May 12 11:03:55 UTC 2016
方法4:(32位的系统中int类型和long类型一般都是4字节,64位的系统中int类型还是4字节的,但是long已变成了8字节inux系统中可用"getconf WORD_BIT"和"getconf LONG_BIT"获得word和long的位数。64位系统中应该分别得到32和64。)
[root@linuxidc ~]# getconf LONG_BIT
64

查看系统版本

方法1:《这个命令试过不好用》
[root@linuxidc ~]#  lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.2.1511 (Core)
Release:    7.2.1511
Codename:   Core
方法2:
[root@linuxidc ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel Fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
RedHat_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
方法3:
[root@linuxidc ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
方法4:
[root@linuxidc ~]# rpm -q centos-release
centos-release-7-2.1511.el7.centos.2.10.x86_64
方法5:查看系统版本

cat /etc/redhat-release

[/code]

查看内核版本

方法1:
[root@linuxidc ~]# cat /proc/versionLinux version 3.10.0-327.18.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu May 12 11:03:55 UTC 2016
方法2:
[root@linuxidc ~]# uname -aLinux linuxidc 3.10.0-327.18.2.el7.x86_64 #1 SMP Thu May 12 11:03:55 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14---------------------------------

1.系统

1.1版本

uname -a 能确认是64位还是32位,其它的信息不多[html] viewplain copy[root@localhost ~]# uname -aLinux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linuxmore /etc/*release 可以看到更多信息[html] viewplain copy[root@localhost ~]# more /etc/*release::::::::::::::/etc/centos-release::::::::::::::CentOS Linux release 7.2.1511 (Core)::::::::::::::/etc/os-release::::::::::::::NAME="CentOS Linux"VERSION="7 (Core)"ID="centos"ID_LIKE="rhel fedora"VERSION_ID="7"PRETTY_NAME="CentOS Linux 7 (Core)"ANSI_COLOR="0;31"CPE_NAME="cpe:/o:centos:centos:7"HOME_URL="https://www.centos.org/"BUG_REPORT_URL="https://bugs.centos.org/"CENTOS_MANTISBT_PROJECT="CentOS-7"CENTOS_MANTISBT_PROJECT_VERSION="7"REDHAT_SUPPORT_PRODUCT="centos"REDHAT_SUPPORT_PRODUCT_VERSION="7"::::::::::::::/etc/redhat-release::::::::::::::CentOS Linux release 7.2.1511 (Core)::::::::::::::/etc/system-release::::::::::::::CentOS Linux release 7.2.1511 (Core)

1.2核数

cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c[html] viewplain copy[root@localhost ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c1 Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz1个逻辑CPU,i5型等信息[html] viewplain copy[root@localhost ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c8 Intel(R) Xeon(R) CPU E7-4820 v2 @ 2.00GHz8个逻辑CPUcat /proc/cpuinfo | grep physical | uniq -c[html] viewplain copy[root@localhost ~]# cat /proc/cpuinfo | grep physical | uniq -c1 physical id : 01 address sizes : 42 bits physical, 48 bits virtual实际上是一颗一核的CPU[html] viewplain copy[root@localhost ~]# cat /proc/cpuinfo | grep physical | uniq -c1 physical id : 01 address sizes : 40 bits physical, 48 bits virtual1 physical id : 01 address sizes : 40 bits physical, 48 bits virtual1 physical id : 01 address sizes : 40 bits physical, 48 bits virtual1 physical id : 01 address sizes : 40 bits physical, 48 bits virtual1 physical id : 01 address sizes : 40 bits physical, 48 bits virtual1 physical id : 01 address sizes : 40 bits physical, 48 bits virtual1 physical id : 01 address sizes : 40 bits physical, 48 bits virtual1 physical id : 01 address sizes : 40 bits physical, 48 bits virtual由8个1核的CPU组成8核cat /proc/cpuinfo可以看到更为详细的信息[html] viewplain copy[root@localhost ~]# cat /proc/cpuinfoprocessor : 0vendor_id : GenuineIntelcpu family : 6model : 94model name : Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHzstepping : 3microcode : 0x74cpu MHz : 2304.004cache size : 6144 KBphysical id : 0siblings : 1core id : 0cpu cores : 1apicid : 0initial apicid : 0fpu : yesfpu_exception : yescpuid level : 22wp : yesflags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm hwp hwp_noitfy hwp_act_window hwp_epp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt xsavec xgetbv1 xsavesbogomips : 4608.00clflush size : 64cache_alignment : 64address sizes : 42 bits physical, 48 bits virtualpower management:

1.3运行模式

getconf LONG_BIT CPU运行在多少位模式下[html] viewplain copy[root@localhost ~]# getconf LONG_BIT64如果是32,说明当前CPU运行在32bit模式下, 但不代表CPU不支持64bitcat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l 是否支持64位[html] viewplain copy[root@localhost ~]# cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l1结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit

1.4计算机名

hostname[html] viewplain copy[root@localhost ~]# hostnamelocalhost.localdomain

1.5.查看环境变量

env[html] viewplain copy[root@localhost ~]# envXDG_SESSION_ID=4HOSTNAME=localhost.localdomainSELINUX_ROLE_REQUESTED=TERM=vt100SHELL=/bin/bashHISTSIZE=1000SSH_CLIENT=192.168.174.1 58896 22SELINUX_USE_CURRENT_RANGE=SSH_TTY=/dev/pts/0USER=root

1.6系统允许多长时间了/负载数

uptime[html] viewplain copy[root@localhost proc]# uptime10:55:01 up 1:28, 2 users, load average: 0.00, 0.01, 0.051.当前时间10:55:012.系统运行了多少时间,1:28(1小时28分)3.多少个用户,2 users4.平均负载:0.00, 0.01, 0.05,最近1分钟、5分钟、15分钟系统的负载直接查看平均负载情况 cat /proc/loadavg[html] viewplain copy[root@localhost proc]# cat /proc/loadavg0.00 0.01 0.05 4/524 7152除了前3个数字表示平均进程数量外,后面的1个分数,分母表示系统进程总数,分子表示正在运行的进程数;最后一个数字表示最近运行的进程ID

2.资源

2.1内存

cat /proc/meminfo内存的详细信息[html] viewplain copy[root@localhost proc]# cat /proc/meminfoMemTotal: 1001332 kBMemFree: 99592 kBMemAvailable: 420940 kBBuffers: 1064 kBCached: 405292 kBSwapCached: 0 kBActive: 412548 kBInactive: 250192 kBActive(anon): 205264 kBInactive(anon): 58460 kBActive(file): 207284 kBInactive(file): 191732 kBUnevictable: 0 kBMlocked: 0 kBSwapTotal: 2097148 kBSwapFree: 2097140 kBDirty: 0 kBWriteback: 0 kBAnonPages: 256416 kBMapped: 103344 kBShmem: 7340 kBSlab: 126408 kBSReclaimable: 69912 kBSUnreclaim: 56496 kBKernelStack: 10416 kBPageTables: 15520 kBNFS_Unstable: 0 kBBounce: 0 kBWritebackTmp: 0 kBCommitLimit: 2597812 kBCommitted_AS: 1578872 kBVmallocTotal: 34359738367 kBVmallocUsed: 170756 kBVmallocChunk: 34359564288 kBHardwareCorrupted: 0 kBAnonHugePages: 75776 kBHugePages_Total: 0HugePages_Free: 0HugePages_Rsvd: 0HugePages_Surp: 0Hugepagesize: 2048 kBDirectMap4k: 73600 kBDirectMap2M: 974848 kBDirectMap1G: 0 kBMemTotal总内存,MemFree可用内存free -m(-m,单位是m,如果是-g,单位是g)查看可用内存[html] viewplain copy[root@localhost proc]# free -mtotal used free shared buff/cache availableMem: 977 360 97 7 520 411Swap: 2047 0 2047空闲内存total-used=free+buff/cache我们通过free命令查看机器空闲内存时,会发现free的值很小。这主要是因为,在linux中有这么一种思想,内存不用白不用,因此它尽可能的cache和buffer一些数据,以方便下次使用。但实际上这些内存也是可以立刻拿来使用的。

3.磁盘和分区

3.1查看各分区使用情况

df -h[html] viewplain copy[root@localhost ~]# df -hFilesystem Size Used Avail Use% Mounted on/dev/mapper/centos-root 45G 22G 24G 48% /devtmpfs 906M 0 906M 0% /devtmpfs 921M 96K 921M 1% /dev/shmtmpfs 921M 1004K 920M 1% /runtmpfs 921M 0 921M 0% /sys/fs/cgroup/dev/sda1 497M 195M 303M 40% /boottmpfs 185M 0 185M 0% /run/user/1001tmpfs 185M 0 185M 0% /run/user/0[root@localhost ~]#

3.2查看指定目录的大小

du -sh <目录名>[html] viewplain copy[root@localhost ~]# du -sh /root1.2G /root

3.3查看所有分区

fdisk -l[html] viewplain copy[root@localhost proc]# fdisk -l磁盘 /dev/sda:32.2 GB, 32212254720 字节,62914560 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节磁盘标签类型:dos磁盘标识符:0x000a0cd4设备 Boot Start End Blocks Id System/dev/sda1 * 2048 1026047 512000 83 Linux/dev/sda2 1026048 62914559 30944256 8e Linux LVM磁盘 /dev/mapper/centos-root:29.5 GB, 29490151424 字节,57597952 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节磁盘 /dev/mapper/centos-docker--poolmeta:33 MB, 33554432 字节,65536 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):512 字节 / 512 字节磁盘 /dev/mapper/docker-253:0-101330881-pool:107.4 GB, 107374182400 字节,209715200 个扇区Units = 扇区 of 1 * 512 = 512 bytes扇区大小(逻辑/物理):512 字节 / 512 字节I/O 大小(最小/最佳):65536 字节 / 65536 字节

3.4查看所有交换分区

swapon -s[html] viewplain copy[root@localhost proc]# swapon -s文件名 类型 大小 已用 权限/dev/dm-1 partition 2097148 8 -1

4.网络

4.1查看所有网络接口的属性

ifconfig[html] viewplain copy[root@localhost proc]# ifconfigdocker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0ether 02:42:e1:b8:a5:4f txqueuelen 0 (Ethernet)RX packets 0 bytes 0 (0.0 B)RX errors 0 dropped 0 overruns 0 frame 0TX packets 0 bytes 0 (0.0 B)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet 192.168.174.129 netmask 255.255.255.0 broadcast 192.168.174.255inet6 fe80::20c:29ff:fe50:b3b4 prefixlen 64 scopeid 0x20<link>ether 00:0c:29:50:b3:b4 txqueuelen 1000 (Ethernet)RX packets 28649 bytes 38411280 (36.6 MiB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 8937 bytes 1226914 (1.1 MiB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536inet 127.0.0.1 netmask 255.0.0.0inet6 ::1 prefixlen 128 scopeid 0x10<host>loop txqueuelen 0 (Local Loopback)RX packets 4 bytes 340 (340.0 B)RX errors 0 dropped 0 overruns 0 frame 0TX packets 4 bytes 340 (340.0 B)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255ether 00:00:00:00:00:00 txqueuelen 0 (Ethernet)RX packets 0 bytes 0 (0.0 B)RX errors 0 dropped 0 overruns 0 frame 0TX packets 0 bytes 0 (0.0 B)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

4.2 带宽

ethtool 网卡名[plain] viewplain copy[root@localhost php-tomcat-base]# ethtool ens192Settings for ens192:Supported ports: [ TP ]Supported link modes: 1000baseT/Full10000baseT/FullSupported pause frame use: NoSupports auto-negotiation: NoAdvertised link modes: Not reportedAdvertised pause frame use: NoAdvertised auto-negotiation: No<span style="color:#ff0000;">Speed: 10000Mb/s</span>Duplex: FullPort: Twisted PairPHYAD: 0Transceiver: internalAuto-negotiation: offMDI-X: UnknownSupports Wake-on: uagWake-on: dLink detected: yes看Speed

4.3查看路由表

route -n[html] viewplain copy[root@localhost proc]# route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 192.168.174.2 0.0.0.0 UG 100 0 0 eth0172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0192.168.174.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0[root@localhost proc]#

4.4查看所有监听端口

netstat -lntp[html] viewplain copy[root@localhost ~]# netstat -lntpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 743/rpcbindtcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1740/nginx: mastertcp 0 0 0.0.0.0:81 0.0.0.0:* LISTEN 1740/nginx: mastertcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2194/dnsmasqtcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1543/sshdtcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 12610/cupsdtcp 0 0 0.0.0.0:40536 0.0.0.0:* LISTEN 19964/rpc.statdtcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2133/mastertcp6 0 0 :::111 :::* LISTEN 743/rpcbindtcp6 0 0 :::81 :::* LISTEN 1740/nginx: mastertcp6 0 0 :::22 :::* LISTEN 1543/sshdtcp6 0 0 ::1:631 :::* LISTEN 12610/cupsdtcp6 0 0 ::1:25 :::* LISTEN 2133/mastertcp6 0 0 :::35420 :::* LISTEN 19964/rpc.statd[root@localhost ~]#

4.5查看所有已经建立的连接

netstat -antp[html] viewplain copy[root@localhost ~]# netstat -antpActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 743/rpcbindtcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1740/nginx: mastertcp 0 0 0.0.0.0:81 0.0.0.0:* LISTEN 1740/nginx: mastertcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2194/dnsmasqtcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1543/sshdtcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 12610/cupsdtcp 0 0 0.0.0.0:40536 0.0.0.0:* LISTEN 19964/rpc.statdtcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2133/mastertcp 0 0 172.31.4.233:22 121.34.147.13:57190 ESTABLISHED 29540/sshd: cavan [tcp 0 0 172.31.4.233:22 121.34.147.13:54544 ESTABLISHED 27077/sshd: cavan [tcp 0 96 172.31.4.233:22 219.137.32.66:60645 ESTABLISHED 30315/sshd: root@pttcp 0 0 172.31.4.233:22 121.34.147.13:56319 ESTABLISHED 28703/sshd: cavan [tcp6 0 0 :::111 :::* LISTEN 743/rpcbindtcp6 0 0 :::81 :::* LISTEN 1740/nginx: mastertcp6 0 0 :::22 :::* LISTEN 1543/sshdtcp6 0 0 ::1:631 :::* LISTEN 12610/cupsdtcp6 0 0 ::1:25 :::* LISTEN 2133/mastertcp6 0 0 :::35420 :::* LISTEN 19964/rpc.statd[root@localhost ~]#

4.6 某端口使用情况

lsof -i:端口号[plain] viewplain copy[root@localhost mysql]# lsof -i:22COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEsshd 1150 root 3u IPv4 18264 0t0 TCP *:ssh (LISTEN)sshd 1150 root 4u IPv6 18273 0t0 TCP *:ssh (LISTEN)sshd 2617 root 3u IPv4 20437 0t0 TCP localhost.localdomain:ssh->192.168.174.1:60426 (ESTABLISHED)[root@localhost mysql]#或者netstat -apn|grep 端口号[html] viewplain copy[root@localhost mysql]# netstat -apn|grep 22tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1150/sshdtcp 0 96 192.168.174.136:22 192.168.174.1:60426 ESTABLISHED 2617/sshd: root@ptstcp6 0 0 :::22 :::* LISTEN 1150/sshd

5.进程

5.1查看所有进程

ps -ef,使用ps -ef|gerp tomcat过滤[html] viewplain copy[root@localhost ~]# ps -efUID PID PPID C STIME TTY TIME CMDroot 1 0 0 09:26 ? 00:00:03 /usr/lib/systemd/systemd --switched-root --system --deserialize 21root 2 0 0 09:26 ? 00:00:00 [kthreadd]root 3 2 0 09:26 ? 00:00:00 [ksoftirqd/0]root 6 2 0 09:26 ? 00:00:00 [kworker/u256:0]root 7 2 0 09:26 ? 00:00:00 [migration/0]root 8 2 0 09:26 ? 00:00:00 [rcu_bh]root 9 2 0 09:26 ? 00:00:00 [rcuob/0]root 10 2 0 09:26 ? 00:00:00 [rcuob/1]root 11 2 0 09:26 ? 00:00:00 [rcuob/2]root 12 2 0 09:26 ? 00:00:00 [rcuob/3]root 13 2 0 09:26 ? 00:00:00 [rcuob/4]root 14 2 0 09:26 ? 00:00:00 [rcuob/5]root 15 2 0 09:26 ? 00:00:00 [rcuob/6]root 16 2ps -aux可以看到进程占用CPU,内存情况[html] viewplain copy[root@localhost ~]# ps -auxUSER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMANDroot 1 0.0 0.6 126124 6792 ? Ss 09:26 0:03 /usr/lib/systemd/systemd --switched-root --system --deserialize 21root 2 0.0 0.0 0 0 ? S 09:26 0:00 [kthreadd]root 3 0.0 0.0 0 0 ? S 09:26 0:00 [ksoftirqd/0]root 6 0.0 0.0 0 0 ? S 09:26 0:00 [kworker/u256:0]root 7 0.0 0.0 0 0 ? S 09:26 0:00 [migration/0]root 8 0.0 0.0 0 0 ? S 09:26 0:00 [rcu_bh]root 9 0.0 0.0 0 0 ? S 09:26 0:00 [rcuob/0]root 10 0.

5.2实时显示进程状态

top[html] viewplain copy[root@localhost ~]# toptop - 11:29:02 up 2:02, 2 users, load average: 0.12, 0.04, 0.05Tasks: 408 total, 2 running, 406 sleeping, 0 stopped, 0 zombie%Cpu(s): 1.3 us, 0.3 sy, 0.0 ni, 98.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 stKiB Mem : 1001332 total, 92184 free, 370332 used, 538816 buff/cacheKiB Swap: 2097148 total, 2097140 free, 8 used. 419124 avail MemPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND3001 gdm 20 0 1419364 122996 45860 S 1.0 12.3 0:06.50 gnome-shell276 root 20 0 0 0 0 S 0.3 0.0 0:09.72 kworker/0:13765 root 20 0 142864 5128 3876 S 0.3 0.5 0:00.77 sshd7740 root 20 0 146452 2384 1432 R 0.3 0.2 0:00.17 top1 root 20 0 126124 6792 3912 S 0.0 0.7 0:03.58 systemd2 root 20 0 0 0 0 S 0.0 0.0 0:00.03 kthreadd3 root 20 0 0 0 0 S 0.0 0.0 0:00.37 ksoftirqd/06 root 20 0 0 0 0 S 0.0 0.0 0:00.39 kworker/u256:07 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/08 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/010 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/111 root 20 0 0

6.用户

6.1查看活动用户

w[html] viewplain copy[root@localhost ~]# w11:32:36 up 72 days, 20:50, 3 users, load average: 0.00, 0.01, 0.05USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATcavan pts/0 121.34.147.13 09:47 1:14m 0.17s 0.17s sshd: cavan [priv]root pts/1 219.137.32.66 11:19 4.00s 0.05s 0.00s wcavan pts/3 121.34.147.13 10:14 20:44 0.38s 0.11s vim Dockerfile[root@localhost ~]#

6.2查看指定用户的信息

id <用户名>[html] viewplain copy[root@localhost ~]# id rootuid=0(root) gid=0(root) groups=0(root)[root@localhost ~]# id cavanuid=1001(cavan) gid=1001(cavan) groups=1001(cavan)[root@localhost ~]#

6.3查看用户登录日志

last[html] viewplain copy[root@localhost 1]# lastroot pts/0 192.168.174.1 Mon Oct 24 09:51 still logged in(unknown :0 :0 Mon Oct 24 09:27 still logged inreboot system boot 3.10.0-327.el7.x Mon Oct 24 09:26 - 11:35 (02:09)root pts/0 192.168.174.1 Fri Oct 21 09:41 - 18:44 (09:03)(unknown :0 :0 Fri Oct 21 09:15 - 18:44 (09:28)reboot system boot 3.10.0-327.el7.x Fri Oct 21 09:15 - 11:35 (3+02:20)root pts/1 192.168.174.1 Thu Oct 20 10:05 - 18:13 (08:08)root pts/0

6.4查看系统所有用户

cut -d: -f1 /etc/passwd[html] viewplain copy[root@localhost ~]# cut -d: -f1 /etc/passwdrootbindaemonadmlpsyncshutdownhaltmailoperatorgamesftpnobodydbuspolkitdabrtunboundcolordusbmuxdntp版权声明:本文为博主原创文章,未经博主允许不得转载
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux centos