linux /var ,/usr目录下的相关文件day06,07

/porc 虚拟目录,显示内存的信息 一切皆文件

1.查看系统cpu的文件

/porc/cpuinfo

[root@linux59-moban ~]# cat  /proc/cpuinfo 
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 94
model name  : Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
stepping    : 3
microcode   : 0xc2
cpu MHz     : 2304.000
cache size  : 6144 KB
physical id : 0
siblings    : 1
core id     : 0
cpu cores   : 1
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 22
wp      : yes
flags       : 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 epb fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
bogomips    : 4608.00
clflush size    : 64
cache_alignment : 64
address sizes   : 42 bits physical, 48 bits virtual
power management:

processor : 0 第几个核心
physical id : 0 第几颗CPU

processor : 3 第4个核心
physical id : 1 第2颗cpu

查看系统cup信息 lscpu


[root@linux59-moban ~]# lscpu 
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 94
Model name:            Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
Stepping:              3
CPU MHz:               2304.000
CPU max MHz:           0.0000
CPU min MHz:           0.0000
BogoMIPS:              4608.00
Hypervisor vendor:     VMware
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              6144K
NUMA node0 CPU(s):     0
Flags:                 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 epb fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp

[root@oldboyedu59 ~]# lscpu
CPU(s): 4 4个核心
On-line CPU(s) list: 0-3
Socket(s): 2 CPU接口 2路 双路

2.系统内存信息

/proc/meminfo

[root@linux59-moban ~]# cat /proc/meminfo 
MemTotal:         995896 kB
MemFree:          423056 kB
MemAvailable:     646344 kB
Buffers:            2760 kB
Cached:           282300 kB
SwapCached:            0 kB
Active:           211360 kB
Inactive:         116488 kB
Active(anon):      43356 kB
Inactive(anon):     7296 kB
Active(file):     168004 kB
Inactive(file):   109192 kB
Unevictable:           0 kB

查看系统内存信息 free

-h 人类可以理解的方式显示
-m 以MB 为单位显示

[root@linux59-moban ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           972M        117M        412M        7.7M        441M        630M
Swap:          999M          0B        999M

total 总
used 已用
free 剩余

3.系统的负载(繁忙程度)

/proc/loadavg


[root@linux59-moban ~]# cat /proc/loadavg 
0.00 0.01 0.05 1/112 27137

0.00 最近1分钟
0.02 最近5分钟
0.05 最近15分钟

查看谁登录了,副业查看系统复制 w

[root@linux59-moban ~]# w
 16:55:57 up 23:58,  3 users,  load average: 0.00, 0.01, 0.05
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1                      Fri15    8:20m  0.27s  0.27s -bash
root     pts/0    10.0.0.1         12:04    4:51m  0.05s  0.05s -bash
root     pts/1    10.0.0.1         14:50    5.00s  0.45s  0.00s w

是否繁忙:

数字接近于cpu核心总数的时候 忙

4.设备的挂载信息

/proc/mounts

rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
devtmpfs /dev devtmpfs rw,nosuid,size=487048k,nr_inodes=121762,mode=755 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0
cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
cgroup /sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0
cgroup /sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_prio,net_cls 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
configfs /sys/kernel/config configfs rw,relatime 0 0
/dev/sda3 / xfs rw,relatime,attr2,inode64,noquota 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=32,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=21421 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,relatime 0 0
mqueue /dev/mqueue mqueue rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
/dev/sda1 /boot xfs rw,relatime,attr2,inode64,noquota 0 0
/dev/sr0 /mnt iso9660 ro,relatime 0 0
tmpfs /run/user/0 tmpfs rw,nosuid,nodev,relatime,size=99592k,mode=700 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0

查看系统挂载信息 df

-h 人类可读

[root@linux59-moban ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        19G  1.6G   18G   9% /
devtmpfs        476M     0  476M   0% /dev
tmpfs           487M     0  487M   0% /dev/shm
tmpfs           487M  7.7M  479M   2% /run
tmpfs           487M     0  487M   0% /sys/fs/cgroup
/dev/sda1       197M  105M   93M  54% /boot
/dev/sr0        4.3G  4.3G     0 100% /mnt
tmpfs            98M     0   98M   0% /run/user/0

存放用户的程序 /usr

1.安装软件的安装位置(编译安装 ,源码安装)

/usr/local

[root@linux59-moban ~]# ll /usr/local/
total 0
drwxr-xr-x. 2 root root  6 Apr 11  2018 bin
drwxr-xr-x. 2 root root  6 Apr 11  2018 etc
drwxr-xr-x. 2 root root  6 Apr 11  2018 games
drwxr-xr-x. 2 root root  6 Apr 11  2018 include
drwxr-xr-x. 2 root root  6 Apr 11  2018 lib
drwxr-xr-x. 2 root root  6 Apr 11  2018 lib64
drwxr-xr-x. 2 root root  6 Apr 11  2018 libexec
drwxr-xr-x. 2 root root  6 Apr 11  2018 sbin
drwxr-xr-x. 5 root root 49 Mar 26 11:39 share
drwxr-xr-x. 2 root root  6 Apr 11  2018 src
image.png

经常变化的文件,系统日志 /var

1.记录着系统默认的日志 (各种服务状态信息)

/var/log/messages

Apr  2 14:50:43 linux59-moban network: Bringing up interface eth0:  [  OK  ]
Apr  2 14:50:43 linux59-moban systemd: Started LSB: Bring up/down networking.
Apr  2 14:50:46 linux59-moban systemd: Started Session 38 of user root.
Apr  2 14:50:46 linux59-moban systemd-logind: New session 38 of user root.
Apr  2 14:50:55 linux59-moban chronyd[5896]: Forward time jump detected!
Apr  2 14:50:55 linux59-moban chronyd[5896]: Can't synchronise: no selectable sources
Apr  2 14:54:09 linux59-moban chronyd[5896]: Selected source 185.209.85.222
Apr  2 14:56:20 linux59-moban chronyd[5896]: Selected source 203.107.6.88
Apr  2 15:01:01 linux59-moban systemd: Started Session 39 of user root.
Apr  2 15:13:38 linux59-moban kernel: e1000: eth0 NIC Link is Down
Apr  2 15:13:44 linux59-moban kernel: e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
Apr  2 15:13:46 linux59-moban kernel: e1000: eth0 NIC Link is Down
Apr  2 15:13:50 linux59-moban kernel: e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
Apr  2 16:01:01 linux59-moban systemd: Started Session 40 of user root.
Apr  2 17:01:01 linux59-moban systemd: Started Session 41 of user root.
Apr  2 17:02:11 linux59-moban systemd-logind: Removed session 36.

2.记录着用户登录情况

/var/log/secure

[root@linux59-moban ~]# cat /var/log/secure
Apr  2 10:40:56 linux59-moban sshd[10499]: pam_unix(sshd:session): session closed for user root
Apr  2 10:55:20 linux59-moban sshd[11406]: error: Received disconnect from 10.0.0.1 port 7900:0:
Apr  2 10:55:20 linux59-moban sshd[11406]: Disconnected from 10.0.0.1 port 7900
Apr  2 10:55:20 linux59-moban sshd[11406]: pam_unix(sshd:session): session closed for user root
Apr  2 10:55:21 linux59-moban sshd[12466]: Accepted password for root from 10.0.0.1 port 10859 ssh2
Apr  2 10:55:21 linux59-moban sshd[12466]: pam_unix(sshd:session): session opened for user root by (uid=0)
Apr  2 10:55:47 linux59-moban sshd[12466]: pam_unix(sshd:session): session closed for user root
Apr  2 10:55:48 linux59-moban sshd[12489]: Accepted password for root from 10.0.0.1 port 10887 ssh2
Apr  2 10:55:48 linux59-moban sshd[12489]: pam_unix(sshd:session): session opened for user root by (uid=0)
Apr  2 10:56:41 linux59-moban sshd[12489]: pam_unix(sshd:session): session closed for user root
Apr  2 10:56:42 linux59-moban sshd[12513]: Accepted password for root from 10.0.0.1 port 10895 ssh2
Apr  2 10:56:42 linux59-moban sshd[12513]: pam_unix(sshd:session): session opened for user root by (uid=0)
Apr  2 11:10:26 linux59-moban sshd[12513]: error: Received disconnect from 10.0.0.1 port 10895:0:
Apr  2 11:10:26 linux59-moban sshd[12513]: Disconnected from 10.0.0.1 port 10895
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容