Linux day05

1、解析映射文件

/etc/hosts
C:\Windows\System32\drivers\etc\hosts
本地的DNS

192.168.15.101   www.baidu.com

2、磁盘挂载文件

/etc/fstab
磁盘挂载文件。

3、开机加载脚本

/etc/rc.local

1、编辑开机自启动脚本
vim /etc/rc.local
2、设置开机自启动权限
chmod +x /etc/rc.d/rc.local
3、重启系统

4、系统启动级别

系统启动级别:
0、关机
1、单用户模式(无法通过xshell的方式使用)
2、多用户无网络模式
3、完全多用户模式
4、待定
5、桌面模式
6、重启

设置系统级别:
init [编号] 临时设置
systemctl set-default [系统启动级别]

通过单用户模式修改密码
1、重启
2、在启动选择系统内核界面,按 e 键进入单用户模式
3、找到 linux16 开头行,删除 ro , 并且在 ro 处添加 rw init=/sysroot/bin/sh
4、按 ctrl + x 进行系统重新引导
5、执行 chroot /sysroot
6、执行 passwd root
7、执行 touch /.autorelabel
8、执行 Ctrl + D 重启系统

 

 

 

5、变量加载文件

在Linux中添加环境变量怎么添加呢?

文件
  /etc/profile
  /etc/bashrc
  ~/.bash_profile
  ~/.bash_rc
文件夹
/etc/profile.d/

增加环境变量有两种方式:
1、临时添加
2、永久添加

增加环境变量的格式:
export PYTHON_HOME='D:/python'

查看本机的环境变量:
echo $PYTHON_HOME : 查看某一个环境变量
printenv   : 查看所有的环境变量

读取环境变量的几种情况,并且测试出使用文件的先后顺序
1、重启
/etc/profile.d --> /etc/profile --> /etc/bashrc --> ~/.bashrc --> ~/.bash_profile
2、切换用户
/etc/profile.d --> /etc/bashrc --> ~/.bashrc
知识储备:
useradd [用户名]
su [用户名]
3、重新登录用户
1、su - [用户名]
/etc/profile.d --> /etc/profile --> /etc/bashrc --> ~/.bashrc --> ~/.bash_profile

2、ssh root@192.168.15.101
/etc/profile.d --> /etc/profile --> /etc/bashrc --> ~/.bashrc --> ~/.bash_profile

 

 

 

6、登录提示文件

登录成功之后显示的信息。
/etc/motd

登录之前显示的信息。
/etc/issue

7、编译安装目录

# 安装第三方软件的目录
/usr/local

下载rpm安装包
yum安装python:yum install python3

 

 

 

8、系统日志目录

/var

 

 

 

9、保存系统运行状态的目录

保存CPU运行状态的:/proc/cpuinfo
lscpu
保存内存的状态的:/proc/meminfo
free
保存系统负载的:/proc/loadavg
w
0.001分钟内的CPU负载
0.015分钟内的CPU负载
0.05 :15分钟内的CPU负载

负载:当前系统的所有进程占用CPU的时间比

保存系统挂载信息:/proc/mounts
mount
umount

 

posted @ 2021-12-13 20:11  杰尼龟无所畏惧  阅读(91)  评论(0)    收藏  举报