/etc目录下的重要文件
07.系统运行级别文件/etc/inittab (ContOS6)
查看修改运行级别:
sentos6查看方式:cat /etc/inittab
sentos6修改方式: vim /etc/inittab
sentos7查看方式:systemctl get-default
sentos7修改方式:systemctl get-default xxx(要设设定的运行级别)
运行级别说明:(CentOS6)
0级别 关机模式
1级别 单用户模式 (root用户密码忘记,修改密码用)
2级别 多用户模式(没有NFS 就是没有网络 )
3级别 多用户模式(有网络,系统默认级别)
4级别 预留模式(自定义)
5级别 图形化界面模式(桌面模式)
6级别 重启模式
运行级别说明:(CentOS7)
poweroff.target 关机模式
resuce.target 救援模式
multiuser.target 多用户模式
multiuser.target 多用户模式
multiuser.target 多用户模式
graphical.target 图形化界面模式
reboot.target 重启模式
Linux系统启动流程
CentOS6启动流程:(串行启动)
1.开机自检(BIOS) 检查硬件设备
2.MBR引导 (引导系统启动)
3.GRUB菜单 (选择不同的内核)
4.加载内核 (/boot加载到内存)
5.运行INIT进程 (第一个启动进程)
6.读取/etc/inittab (读取运行级别)
7读取/etc/rc.sysinit 初始化系统
8.根据运行级别,运行不同服务
9.启动minggetty显示登录界面
CentOS7启动流程:(并行启动)
1.开机自检(BIOS) (系统自动检查硬件设备)
2.MBR引导 (主引导记录)
3.GRUB菜单 (选择内核)
4.加载内核信息
5运行第一个进程 (systemd进程 -- 控制后续进程并行启动)
6.识别加载系统运行级别 ( /etc/systemd/system/default.target)
7完成系统初始化 (加载初始化target文件 /usr/lib/systemd/system/sysinit.target)
8加载/etc/systemd/systm 目录中的文件现实服务开机自动运行
9.运行最后一个进程minggetty (可以看到登陆提示信息)
08.配置变量和别名文件/etc/profile
变量是什么:???
x+y=10 已知X=20 y=? 未知数/变量
取变量
[root@jiaoling ~]# x=100
[root@jiaoling ~]# echo $x
100
环境变量特点:
1.系统创建好的变量
2.linux系统下面随意使用 ,含义不变
3.环境变量名都是大写
/usr目录下的重要文件
存放用户编译安装软件/usr/local
编译安装:
不能解决依赖关系 优点;单独定制安装软件(定制化)
yum安装:
不能灵活定制化 优点;可以解决软件之间的依赖关系
/vra目录下的重要文件
日志文件/var/log/messages
记录系统默认的日志 (各种服务状态日志)
Apr 2 10:45:01 jiaoling systemd: Started Session 33 of user root.
Apr 2 10:45:01 jiaoling systemd: Starting Session 33 of user root.
Apr 2 10:50:01 jiaoling systemd: Started Session 34 of user root.
Apr 2 10:50:01 jiaoling systemd: Starting Session 34 of user root.
Apr 2 10:55:01 jiaoling systemd: Started Session 35 of user root.
Apr 2 10:55:01 jiaoling systemd: Starting Session 35 of user root.
Apr 2 11:00:01 jiaoling systemd: Started Session 36 of user root.
Apr 2 11:00:01 jiaoling systemd: Starting Session 36 of user root.
Apr 2 11:01:01 jiaoling systemd: Started Session 37 of user root.
Apr 2 11:01:01 jiaoling systemd: Starting Session 37 of user root.
Apr 2 11:05:01 jiaoling systemd: Started Session 38 of user root.
Apr 2 11:05:01 jiaoling systemd: Starting Session 38 of user root.
Apr 2 11:10:01 jiaoling systemd: Started Session 39 of user root.
Apr 2 11:10:01 jiaoling systemd: Starting Session 39 of user root.
Apr 2 11:15:01 jiaoling systemd: Started Session 40 of user root.
Apr 2 11:15:01 jiaoling systemd: Starting Session 40 of user root.
Apr 2 11:20:01 jiaoling systemd: Started Session 41 of user root.
Apr 2 11:20:01 jiaoling systemd: Starting Session 41 of user root.
用户登入信息文件/var/log/secure
记录着用户登入信息日志
[root@aling ~]# cat /var/log/secure
Mar 27 15:00:02 Aling sshd[1838]: Address 10.0.0.1 maps to bogon, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
Mar 27 15:00:02 Aling sshd[1838]: Accepted password for root from 10.0.0.1 port 9786 ssh2
Mar 27 15:00:02 Aling sshd[1838]: pam_unix(sshd:session): session opened for user root by (uid=0)
Mar 27 16:25:27 Aling sshd[1838]: pam_unix(sshd:session): session closed for user root
Mar 27 17:45:58 Aling sshd[2450]: Address 10.0.0.1 maps to bogon, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
Mar 27 17:45:58 Aling sshd[2450]: Accepted password for root from 10.0.0.1 port 2887 ssh2
Mar 27 17:45:58 Aling sshd[2450]: pam_unix(sshd:session): session opened for user root by (uid=0)
Mar 27 17:48:27 Aling login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
Mar 27 17:48:27 Aling login: ROOT LOGIN ON tty1
Mar 27 17:50:11 Aling polkitd[1009]: Registered Authentication Agent for unix-process:2501:1042828 (system bus name :1.146 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Mar 27 18:00:46 Aling polkitd[980]: Loading rules from directory /etc/polkit-1/rules.d
Mar 27 18:00:46 Aling polkitd[980]: Loading rules from directory /usr/share/polkit-1/rules.d
Mar 27 18:00:46 Aling polkitd[980]: Finished loading, compiling and executing 2 rules
Mar 27 18:00:46 Aling polkitd[980]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
Mar 27 18:00:50 Aling sshd[1309]: Server listening on 0.0.0.0 port 22.
Mar 27 18:00:50 Aling sshd[1309]: Server listening on :: port 22.
/proc目录下重要文件
CPU信息文件/proc/cpuinfo
[root@aling ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 142
model name : Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
stepping : 10
microcode : 0x84
cpu MHz : 1800.003
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 mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc 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 fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec ibpb ibrs stibp arat spec_ctrl intel_stibp
bogomips : 3600.00
clflush size : 64
cache_alignment : 64
address sizes : 43 bits physical, 48 bits virtual
power management:
processor : 0 第几个核心
physical id : 0 第几颗CPU
processor : 3 第4个核心
physical id : 1 第2颗cpu
查看CPU信息命令:lscpu
[root@aling ~]# 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: 142
Model name: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Stepping: 10
CPU MHz: 1800.003
BogoMIPS: 3600.00
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
内存信息文件/proc/meminfo
[root@aling ~]# cat /proc/meminfo
MemTotal: 997956 kB
MemFree: 729596 kB
MemAvailable: 719024 kB
Buffers: 2108 kB
Cached: 95276 kB
MemTotal: 2028116 kB #内存一共多少 total
MemFree: 1808804 kB #内存剩余 free
MemAvailable: 1776000 kB #内存当前可以使用
Buffers: 2076 kB #buffer 占用内存空间大小
Cached: 76180 kB #cache 占用内存空间大小
查看内存信息命令:free
参数 -m 以mb为单位显示大小
[root@aling ~]# free -m
total used free shared buff/cache available
Mem: 974 110 712 7 151 702
Swap: 1023 0 1023
-h 以人类可读方式显示
[root@aling ~]# free -h
total used free shared buff/cache available
Mem: 974M 110M 712M 7.6M 151M 702M
Swap: 1.0G 0B 1.0G
负载信息文件/proc/loadavg
[root@aling ~]# cat /proc/loadavg
0.00 0.01 0.05 2/112 2851
最近1分钟 最近5分钟 最近15分钟 1个正在运行/一共有125个进程 pid进程号
查看负载命令:w
[root@aling ~]# w
17:21:25 up 8:57, 1 user, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 10.0.0.1 16:58 5.00s 0.40s 0.00s w
挂载信息文件/proc/mounts
查看挂载命令:df -h
[root@aling ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_oldboy--caojiaoling-root 48G 2.0G 47G 4% /
devtmpfs 476M 0 476M 0% /dev
tmpfs 488M 0 488M 0% /dev/shm
tmpfs 488M 7.7M 480M 2% /run
tmpfs 488M 0 488M 0% /sys/fs/cgroup
/dev/sda1 1014M 130M 885M 13% /boot
tmpfs 98M 0 98M 0% /run/user/0