]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
1.5 /etc/profile
配置别名 配置环境变量
[root@znix ~]# head -5 /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
1.6 /etc/bashrc
配置别名
[root@znix ~]# cat /etc/bashrc
# /etc/bashrc
# System wide functions and aliases
# Environment stuff goes in /etc/profile
1.6.1 .bash_profile与 .bashrc
国法:对所有用户生效
/etc/profile (改这一个就可以)
/etc/bashrc
家规 :只对当前用户生效
.bash_profile
.bashrc
1.7 /etc/init.d
系统中软件或服务管理命令的存放位置
/etc/init.d/iptables
/etc/init.d/network
[root@znix ~]# ls /etc/init.d/
1.8 /etc/inittab
系统运行级别的配置文件
运行级别===系统不同的状态
1.8.1 不同运行级别的含义:
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
关机状态(禁止把运行级别设置为0)
# 1 - Single user mode
单用户模式 (root用户密码忘了 维护)
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
多用户模式,但是没有NFS功能
# 3 - Full multiuser mode
工作中默认的运行级别 完全的多用户模式 命令行模式
# 4 - unused
没有使用
# 5 - X11
桌面模式 图形化模式
# 6 - reboot (Do NOT set initdefault to this)
重启
1.8.2 如何临时修改运行级别
init 3 修改运行级别
runlevel 显示运行级别
[root@znix ~]# runlevel
N 3
1.8.3 如何永久修改运行级别
修改/etc/inittab 文件的最后一行。
[root@znix ~]# tail -1 /etc/inittab
id:3:initdefault:
1.9 /etc/rc.local
开机自动运行的程序或命令
需要在开机的时候自动运行命令或软件就可以放入到这个文件中
[root@znix ~]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
第2章 /var/目录
2.1 /var/log/messages
系统默认的日志
[root@znix ~]# ll /var/log/messages*
-rw-------. 1 root root 5533 Aug 22 20:31 /var/log/messages
-rw-------. 1 root root 628615 Aug 12 07:21 /var/log/messages-20170814
-rw-------. 1 root root 6740 Aug 20 01:22 /var/log/messages-20170821
每过一段时间,就会把 /var/log/messages /var/log/secure 切割一下,给旧的文件加上个时间 ---日志切割(日志轮询)
2.2 /var/log/secure
用户的登录信息 什么时候 从哪里登录 是否成功
主要看failed (失败)的记录
[root@znix ~]# ll /var/log/secure*
-rw-------. 1 root root 3586 Aug 22 20:31 /var/log/secure
-rw-------. 1 root root 14984 Aug 1