韩顺平图解Linux全面升级 https://www.bilibili.com/video/BV1Sv411r7vd
27 小时 、153 讲, 2021 韩顺平 一周学会Linux

简介


目录

P001_韩顺平图解Linux全面升级_课程内容    20:37
P002_韩顺平图解Linux全面升级_应用领域    05:05
P003_韩顺平图解Linux全面升级_概述    16:37
P004_韩顺平图解Linux全面升级_Linux与Unix    18:09
P005_韩顺平图解Linux全面升级_vmware15.5安装    17:36
P006_韩顺平图解Linux全面升级_CentOS7.6安装    35:15
P007_韩顺平图解Linux全面升级_网络连接三种方式    16:01
P008_韩顺平图解Linux全面升级_虚拟机克隆    09:13
P009_韩顺平图解Linux全面升级_虚拟机快照    09:15
P010_韩顺平图解Linux全面升级_虚拟机迁移删除    06:47
P011_韩顺平图解Linux全面升级_vmtools    20:39
P012_韩顺平图解Linux全面升级_目录结构介绍    07:50
P013_韩顺平图解Linux全面升级_目录结构详解    18:44
P014_韩顺平图解Linux全面升级_远程登录    15:30
P015_韩顺平图解Linux全面升级_远程文件传输    13:58
P016_韩顺平图解Linux全面升级_vi vim快速入门    08:32
P017_韩顺平图解Linux全面升级_vi vim快捷键    19:09
P018_韩顺平图解Linux全面升级_vi vim内容梳理    06:02
P019_韩顺平图解Linux全面升级_关机重启    07:54
P020_韩顺平图解Linux全面升级_登录注销    08:41
P021_韩顺平图解Linux全面升级_用户管理(1)    15:26
P022_韩顺平图解Linux全面升级_用户管理(2)    05:22
P023_韩顺平图解Linux全面升级_用户管理(3)    18:45
P024_韩顺平图解Linux全面升级_用户管理(4)    08:37
P025_韩顺平图解Linux全面升级_运行级别    12:03
P026_韩顺平图解Linux全面升级_找回root密码    08:23
P027_韩顺平图解Linux全面升级_帮助指令    08:46
P028_韩顺平图解Linux全面升级_文件目录指令(1)    15:27
P029_韩顺平图解Linux全面升级_文件目录指令(2)    07:33
P030_韩顺平图解Linux全面升级_文件目录指令(3)    12:43
P031_韩顺平图解Linux全面升级_文件目录指令(4)    14:04
P032_韩顺平图解Linux全面升级_文件目录指令(5)    24:21
P033_韩顺平图解Linux全面升级_文件目录指令(6)    10:08
P034_韩顺平图解Linux全面升级_时间日期指令    07:51
P035_韩顺平图解Linux全面升级_查找指令(1)    13:33
P036_韩顺平图解Linux全面升级_查找指令(2)    08:22
P037_韩顺平图解Linux全面升级_压缩和解压(1)    11:18
P038_韩顺平图解Linux全面升级_压缩和解压(2)    09:59
P039_韩顺平图解Linux全面升级_实用指令小结    04:57
P040_韩顺平图解Linux全面升级_linux组的介绍    07:35
P041_韩顺平图解Linux全面升级_所有者    04:03
P042_韩顺平图解Linux全面升级_所在组    08:56
P043_韩顺平图解Linux全面升级_修改所在组    04:15
P044_韩顺平图解Linux全面升级_rwx权限    15:46
P045_韩顺平图解Linux全面升级_权限说明案例    06:48
P046_韩顺平图解Linux全面升级_修改权限    09:32
P047_韩顺平图解Linux全面升级_修改所有者和所在组    09:15
P048_韩顺平图解Linux全面升级_权限管理应用实例(1)    21:57
P049_韩顺平图解Linux全面升级_权限管理应用实例(2)    17:43
P050_韩顺平图解Linux全面升级_权限管理应用实例(3)    09:50
P051_韩顺平图解Linux全面升级_权限管理应用实例(4)    14:34
P052_韩顺平图解Linux全面升级_crond快速入门    11:01
P053_韩顺平图解Linux全面升级_crond时间规则    05:05
P054_韩顺平图解Linux全面升级_crond应用实例    14:55
P055_韩顺平图解Linux全面升级_at任务调度机制    12:36
P056_韩顺平图解Linux全面升级_at任务调度实例    10:09
P057_韩顺平图解Linux全面升级_任务调度小结    09:49
P058_韩顺平图解Linux全面升级_磁盘分区机制    16:04
P059_韩顺平图解Linux全面升级_增加磁盘应用实例    23:02
P060_韩顺平图解Linux全面升级_磁盘情况查询    07:57
P061_韩顺平图解Linux全面升级_磁盘实用指令    07:24
P062_韩顺平图解Linux全面升级_磁盘分区挂载小结    10:30
P063_韩顺平图解Linux全面升级_NAT网络原理图    13:42
P064_韩顺平图解Linux全面升级_网络配置指令    07:16
P065_韩顺平图解Linux全面升级_网络配置实例    12:10
P066_韩顺平图解Linux全面升级_主机名和hosts映射    22:08
P067_韩顺平图解Linux全面升级_网络配置小结    09:42
P068_韩顺平图解Linux全面升级_进程基本介绍    06:22
P069_韩顺平图解Linux全面升级_ps指令详解    10:21
P070_韩顺平图解Linux全面升级_父子进程    08:21
P071_韩顺平图解Linux全面升级_终止进程    16:15
P072_韩顺平图解Linux全面升级_pstree指令    04:11
P073_韩顺平图解Linux全面升级_服务管理(1)    13:42
P074_韩顺平图解Linux全面升级_服务管理(2)    06:30
P075_韩顺平图解Linux全面升级_服务管理(3)    06:40
P076_韩顺平图解Linux全面升级_服务管理(4)    22:01
P077_韩顺平图解Linux全面升级_服务管理(5)    07:56
P078_韩顺平图解Linux全面升级_动态监控系统(1)    09:49
P079_韩顺平图解Linux全面升级_动态监控系统(2)    08:01
P080_韩顺平图解Linux全面升级_监控网络状态    16:14
P081_韩顺平图解Linux全面升级_进程管理小结    11:02
P082_韩顺平图解Linux全面升级_rpm管理(1)    08:13
P083_韩顺平图解Linux全面升级_rpm管理(2)    07:36
P084_韩顺平图解Linux全面升级_yum    06:47
P085_韩顺平图解Linux全面升级_软件包管理小结    03:14
P086_韩顺平图解Linux全面升级_安装配置JDK8    12:45
P087_韩顺平图解Linux全面升级_安装配置tomcat8    07:16
P088_韩顺平图解Linux全面升级_安装配置idea2020    07:03
P089_韩顺平图解Linux全面升级_安装配置mysql5.7    15:14
P090_韩顺平图解Linux全面升级_小结    02:13
P091_韩顺平图解Linux全面升级_shell编程快速入门    11:41
P092_韩顺平图解Linux全面升级_shell变量    12:49
P093_韩顺平图解Linux全面升级_设置环境变量    09:41
P094_韩顺平图解Linux全面升级_位置参数变量    05:28
P095_韩顺平图解Linux全面升级_预定义变量    04:09
P096_韩顺平图解Linux全面升级_运算符    11:57
P097_韩顺平图解Linux全面升级_条件判断    12:51
P098_韩顺平图解Linux全面升级_单分支多分支    04:20
P099_韩顺平图解Linux全面升级_case语句    04:58
P100_韩顺平图解Linux全面升级_for循环    12:12
P101_韩顺平图解Linux全面升级_while循环    04:26
P102_韩顺平图解Linux全面升级_read获取输入    05:20
P103_韩顺平图解Linux全面升级_系统函数    04:10
P104_韩顺平图解Linux全面升级_自定义函数    05:21
P105_韩顺平图解Linux全面升级_定时备份数据库(1)    07:24
P106_韩顺平图解Linux全面升级_定时备份数据库(2)    25:27
P107_韩顺平图解Linux全面升级_shell编程笔记梳理    03:44
P108_韩顺平图解Linux全面升级_ubuntu安装    09:32
P109_韩顺平图解Linux全面升级_ubuntu中文支持    02:45
P110_韩顺平图解Linux全面升级_ubuntu的root    04:12
P111_韩顺平图解Linux全面升级_hello python    01:42
P112_韩顺平图解Linux全面升级_APT原理机制图    09:45
P113_韩顺平图解Linux全面升级_APT更新源和实例    12:28
P114_韩顺平图解Linux全面升级_ubuntu远程登录和集群    19:24
P115_韩顺平图解Linux全面升级_python定制篇梳理    04:58
P116_韩顺平图解Linux全面升级_centos8安装和介绍    16:13
P117_韩顺平图解Linux全面升级_日志介绍和实例    08:51
P118_韩顺平图解Linux全面升级_日志服务原理图    04:30
P119_韩顺平图解Linux全面升级_日志服务配置文件    11:11
P120_韩顺平图解Linux全面升级_自定义日志服务    05:24
P121_韩顺平图解Linux全面升级_日志轮替介绍    11:21
P122_韩顺平图解Linux全面升级_自定义日志轮替    06:38
P123_韩顺平图解Linux全面升级_日志轮替机制    03:13
P124_韩顺平图解Linux全面升级_内存日志    03:27
P125_韩顺平图解Linux全面升级_日志管理笔记梳理    05:59
P126_韩顺平图解Linux全面升级_定制自己的Linux(1)    09:14
P127_韩顺平图解Linux全面升级_定制自己的Linux(2)    26:32
P128_韩顺平图解Linux全面升级_定制自己的Linux(3)    03:20
P129_韩顺平图解Linux全面升级_阅读Linux内核源码好处    04:57
P130_韩顺平图解Linux全面升级_阅读Linux内核源码技巧    04:55
P131_韩顺平图解Linux全面升级_内核源码阅读及main    13:19
P132_韩顺平图解Linux全面升级_内核升级    14:41
P133_韩顺平图解Linux全面升级_备份与恢复介绍    08:51
P134_韩顺平图解Linux全面升级_数据备份dump    11:45
P135_韩顺平图解Linux全面升级_数据恢复restore    12:38
P136_韩顺平图解Linux全面升级_数据备份恢复梳理    04:06
P137_韩顺平图解Linux全面升级_webmin安装和配置    11:13
P138_韩顺平图解Linux全面升级_webmin功能演示    07:46
P139_韩顺平图解Linux全面升级_bt宝塔介绍和安装    05:45
P140_韩顺平图解Linux全面升级_bt宝塔应用实例    09:13
P141_韩顺平图解Linux全面升级_可视化管理小结    02:27
P142_韩顺平图解Linux全面升级_统计访问量和连接数    14:01
P143_韩顺平图解Linux全面升级_找回Mysql的root密码    05:57
P144_韩顺平图解Linux全面升级_访问量排名和tcpdump    08:45
P145_韩顺平图解Linux全面升级_系统权限划分(1)    17:47
P146_韩顺平图解Linux全面升级_系统权限划分(2)    05:33
P147_韩顺平图解Linux全面升级_权限思考题(有趣)    15:07
P148_韩顺平图解Linux全面升级_CentOS7启动流程详解    12:01
P149_韩顺平图解Linux全面升级_io读写监控    10:55
P150_韩顺平图解Linux全面升级_统计文件个数和行数    12:16
P151_韩顺平图解Linux全面升级_无人值守备份目录    09:44
P152_韩顺平图解Linux全面升级_Linux系统优化策略    23:57
P153_韩顺平图解Linux全面升级_卖油翁和老黄牛    06:09

01基础篇

20210206 — START

P001_韩顺平图解Linux全面升级_课程内容 20:37

P002_韩顺平图解Linux全面升级_应用领域 05:05

P003_韩顺平图解Linux全面升级_概述 16:37

www.kernel.org

当前最新是 5.10 版的内核

P004_韩顺平图解Linux全面升级_Linux与Unix 18:09

第三章 vm 和 linux 安装

P005_韩顺平图解Linux全面升级_vmware15.5安装 17:36

下载官方地址: https://www.vmware.com/cn.html
下载好用地址: https://www.nocmd.com/windows/740.html

P006_韩顺平图解Linux全面升级_CentOS7.6安装 35:15

https://mirrors.163.com/centos
https://mirrors.aliyun.com/centos ----不可用

P007_韩顺平图解Linux全面升级_网络连接三种方式 16:01

网络连接的三种模式
模式1.桥接模式
虚拟系统可以和外部系统通讯,但是容易造成IP冲突

模式2.NAT模式
网络地址转换模式,虚拟系统可以和外部通讯,不造成IP冲突;
注意外部不可以访问内部

模式3.主机模式
独立的系统,不与外部联系

P008_韩顺平图解Linux全面升级_虚拟机克隆 09:13

P009_韩顺平图解Linux全面升级_虚拟机快照 09:15

P010_韩顺平图解Linux全面升级_虚拟机迁移删除 06:47

P011_韩顺平图解Linux全面升级_vmtools 20:39

gcc -v : 可以查看是否有安装gcc

将其放到 /opt 目录



/mnt/hgfs/

第四章 linux 目录结构

P012_韩顺平图解Linux全面升级_目录结构介绍 07:50

P013_韩顺平图解Linux全面升级_目录结构详解 18:44

第五章 linux 实操篇 远程登录

P014_韩顺平图解Linux全面升级_远程登录 15:30

下载 free - for home school 版本 地址
https://www.netsarang.com/en/free-for-home-school/

P015_韩顺平图解Linux全面升级_远程文件传输 13:58

第六章 linux 实操篇 vi和vim

P016_韩顺平图解Linux全面升级_vi vim快速入门 08:32

P017_韩顺平图解Linux全面升级_vi vim快捷键 19:09

VIM快捷键使用

执行动作 所在模式 具体快捷键操作
1.拷贝 一般模式 拷贝当前行== yy ; 拷贝当前行向下5行 ==5yy ; 黏贴用 p
2. 删除 一般模式 删除当前行 dd ; 删除当前行向下5行 5dd
3.文件中查找 一般模式 、命令行模式 /关键字 ; 回车 查找; n 下一个;
4. 设置行号 命令行模式 :set nu ; :set nonu ;
5. 撤销 一般模式 u = 撤销
6. 快速定位 一般模式 gg=首行 ; G = 末行 ;
7.快速定位某行 一般模式 20 , shift + g == 快速定位到20行

P018_韩顺平图解Linux全面升级_vi vim内容梳理 06:02

第七章 linux 实操篇 开机 重启

P019_韩顺平图解Linux全面升级_关机重启 07:54

关机&重启命令

执行动作 所在模式
shutdown -h now 立刻进行关机
shutdown 1分钟后会关机(等同下面)
shutdown -h 1 1分钟后会关机
shutdown -r now 现在重新启动计算机
halt 关机,作用和上面一样
reboot 现在重新启动计算机
sync 将内存数据同步到磁盘

P020_韩顺平图解Linux全面升级_登录注销 08:41

  1. 开始以tom身份登录
  2. su root 切换到root 用户
  3. 执行相关操作
  4. 在root 用户下 ,执行 logout 指令, 切换回tom 用户
  5. 在tom用户下,再次执行logout 退出


第八章 linux实操篇 用户管理

20210207

P021_韩顺平图解Linux全面升级_用户管理(1) 15:26

https://www.bilibili.com/video/BV1Sv411r7vd?p=21
20210317 继续

–新建用户 设置密码

----- useradd milan ;默认创建家目录 /home/milan
[root@shell37 home]# useradd milan     ----新增用户milan

[root@shell37 home]# passwd milan --给milan设置密码
Changing password for user milan.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.

--- 显示所有用户 cat /etc/passwd | awk -F: '$3>=500' | cut -f 1 -d :
输出/etc/passwd文件,对于每一行进行处理,判断以冒号:分割的第三个元素,抽取其中的大于500的行,并用cut输出第一列(用户账号名)。删除用户 king  ---保留家目录userdel king [root@shell37 home]# pwd
/home
[root@shell37 home]# ls
kinghome  leo  milan--- 删除用户 milan  不保留家目录 (要慎重操作)
[root@shell37 home]# pwd
/home
[root@shell37 home]# ls
kinghome  leo  milan
[root@shell37 home]# userdel -r milan
[root@shell37 home]# ls
kinghome  leo

P022_韩顺平图解Linux全面升级_用户管理(2) 05:22


[root@shell37 home]# id leo
uid=1000(leo) gid=1000(leo) groups=1000(leo)
[root@shell37 home]# id root
uid=0(root) gid=0(root) groups=0(root)
[root@shell37 home]# id milan
id: milan: no such user
[root@shell37 home]# useradd jack
[root@shell37 home]# passwd jack
Changing password for user jack.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@shell37 home]# su - jack
[jack@shell37 ~]$
[jack@shell37 ~]$ pwd
/home/jack
[jack@shell37 ~]$ su - root
Password:
Last login: Wed Mar 17 06:58:33 PDT 2021 on pts/0
[root@shell37 ~]# logout
[jack@shell37 ~]$ logout
[root@shell37 ~]# whoami
root
[root@shell37 ~]# who am i
root     pts/0        2021-03-17 07:12 (192.168.121.1)
[root@shell37 ~]# su - jack
Last login: Wed Mar 17 07:11:14 PDT 2021 on pts/0
[jack@shell37 ~]$ who am i
root     pts/0        2021-03-17 07:12 (192.168.121.1)

P023_韩顺平图解Linux全面升级_用户管理(3) 18:45


[root@shell37 ~]# groupadd wudang   ---武当
[root@shell37 ~]# useradd -g wudang zwj
[root@shell37 ~]# id zwj  ---张无忌
uid=1002(zwj) gid=1003(wudang) groups=1003(wudang)---- 张无忌 划归 魔教 门下
[root@shell37 ~]# groupadd mojiao
[root@shell37 ~]# usermod -g mojiao zwj
[root@shell37 ~]# id zwj
uid=1002(zwj) gid=1004(mojiao) groups=1004(mojiao)
[root@shell37 ~]# cat /etc/passwd
...
tcpdump:x:72:72::/:/sbin/nologin
leo:x:1000:1000:CentOS7:/home/leo:/bin/bash
mongod:x:987:981:mongod:/var/lib/mongo:/bin/false
jack:x:1001:1001::/home/jack:/bin/bash
zwj:x:1002:1004::/home/zwj:/bin/bash[root@shell37 ~]# cat /etc/shadow
tcpdump:!!:18557::::::
leo:$1$oxzRhXx2$3.4d0qInl.vMfZJCW25Pi1:18557:0:99999:7:::
mongod:!!:18581::::::
jack:$1$naZ6CVhI$OEJlUnnEECkDCXfhTKEIe0:18703:0:99999:7:::    ---设置过密码的
zwj:!!:18703:0:99999:7:::                                      -- zwj 没有设置密码,所以没有数据是!![root@shell37 ~]# cat /etc/group
.....
tcpdump:x:72:
leo:x:1000:
mongod:x:981:
docker:x:980:
jack:x:1001:
wudang:x:1003:
mojiao:x:1004:

P024_韩顺平图解Linux全面升级_用户管理(4) 08:37


第九章 Linux 实操篇 使用指令


P025_韩顺平图解Linux全面升级_运行级别 12:03


[root@shell37 bin]# init 5   --- 切换到图形界面
[root@shell37 bin]#
[root@shell37 bin]# init 3   --- 切换到命令行界面 
[root@shell37 bin]# systemctl get-default
graphical.target[root@shell37 bin]# systemctl set-default multi-user.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.[root@shell37 bin]# systemctl get-default
multi-user.target

P026_韩顺平图解Linux全面升级_找回root密码 08:23

 详细图示过程,见单独的文章 https://blog.csdn.net/wei198621/article/details/114956502 

具体步骤
1.首先进入系统,进入开机界面,选中 上面的系统,按e进入编辑界面 (默认5秒内操作好,来回切换系统不耗费时间)
2.进入编辑页面,将光标移动到“Linux16” 开头的行,在最后面输入 init=/bin/sh ,输入完成后按ctrl +x 键 进入单用户模式
4.进入单用户模式后,启动如图, 输入 mount -o remount,rw /
注意单词间空格(mount空格-o空格remount,rw空格/ ),然后回车
5.在新的一行后面输入 passwd , 然后回车,
输入密码
再次输入密码
6.此处输入 touch /.autorelabel (touch空格/.autorelabel) 完成后回车
7.输入 exec /sbin/init (exec空格/sbin/init) 然后回车
8.等待重启


P027_韩顺平图解Linux全面升级_帮助指令 08:46


P028_韩顺平图解Linux全面升级_文件目录指令(1) 15:27


P029_韩顺平图解Linux全面升级_文件目录指令(2) 07:33


P030_韩顺平图解Linux全面升级_文件目录指令(3) 12:43


P031_韩顺平图解Linux全面升级_文件目录指令(4) 14:04


P032_韩顺平图解Linux全面升级_文件目录指令(5) 24:21


[root@hell39 ~]# head -n 5 anaconda-ks.cfg
#version=DEVEL
# System authorization information
auth --useshadow --enablemd5
# Install OS instead of upgrade
install[root@hell39 ~]# tail -n 5 anaconda-ks.cfg
%end%addon com_redhat_kdump --enable --reserve-mb='auto'

P033_韩顺平图解Linux全面升级_文件目录指令(6) 10:08


[root@hell39 home]# ln -s /root/ myroot
[root@hell39 home]# ll
total 4
drwxr-xr-x.  2 root root   50 Mar 14 01:31 ceshi
drwxr-xr-x.  2 root root   25 Mar 14 06:32 docker-test-volume
drwx------. 15 leo  leo  4096 Dec 15 06:59 leo
drwxr-xr-x.  2 root root   60 Mar 14 07:53 mydockerfile
lrwxrwxrwx.  1 root root    6 Mar 17 09:52 myroot -> /root/[root@hell39 home]# cd myroot/
[root@hell39 myroot]# pwd
/home/myroot
[root@hell39 myroot]# ll
total 16
-rw-r--r--. 1 root root    0 Mar 13 22:54 a124.txt
-rw-------. 1 root root 2761 Oct 22 08:55 anaconda-ks.cfg
drwxr-xr-x. 4 root root 4096 Nov 18 08:40 data
drwxr-xr-x. 2 root root    6 Dec  5 03:22 Desktop
drwxr-xr-x. 2 root root    6 Dec  5 03:22 Documents
drwxr-xr-x. 2 root root    6 Dec  5 03:22 Downloads
drwxr-xr-x. 2 root root    6 Dec  5 03:22 Music
-rw-r--r--. 1 root root  139 Mar 17 09:47 mycal.txt
-rw-------. 1 root root 2041 Oct 22 08:54 original-ks.cfg
drwxr-xr-x. 2 root root    6 Dec  5 03:22 Pictures
drwxr-xr-x. 2 root root    6 Dec  5 03:22 Public
drwxr-xr-x. 2 root root    6 Dec  5 03:22 Templates
drwxr-xr-x. 2 root root    6 Dec  5 03:22 Videos
[root@hell39 myroot]# history 10728  link -s /root/ myroot729  clear730  ln -s /root/ myroot731  ll732  cd myroot/733  pwd734  ll735  history736  history --help737  history 10[root@hell39 myroot]# !733
pwd
/home/myroot
[root@hell39 myroot]# 

P034_韩顺平图解Linux全面升级_时间日期指令 07:514

20210318 
[root@shell37 ~]# date +%y
21
[root@shell37 ~]# date +%Y
2021
[root@shell37 ~]# date +%m
03
[root@shell37 ~]# date +%d
18
[root@shell37 ~]# date "+%Y-%m-%d %H:%M:%S"
2021-03-18 06:50:04

P035_韩顺平图解Linux全面升级_查找指令(1) 13:33


 [root@shell37 shell]# find /opt -size +200M[root@shell37 shell]# find -name time.sh
./time.sh[root@shell37 shell]# updatedb
[root@shell37 shell]# locate time.sh
/opt/shell/time.sh[root@shell37 shell]# which ls
alias ls='ls --color=auto'/usr/bin/ls
[root@shell37 shell]# which reboot
/usr/sbin/reboot

P036_韩顺平图解Linux全面升级_查找指令(2) 08:22


[root@shell37 shell]# cat time.sh | grep sleepsleep 1
[root@shell37 shell]# cat -n time.sh | grep sleep4    sleep 1
[root@shell37 shell]# cat time.sh | grep -n sleep
4:  sleep 1
[root@shell37 shell]# grep -n "sleep" ./
grep: ./: Is a directory
[root@shell37 shell]# grep -n "sleep"  time.sh
4:  sleep 1

P037_韩顺平图解Linux全面升级_压缩和解压(1) 11:18


[root@shell37 shell2]# ll
total 6368
drwxr-xr-x. 4 root root    4096 Mar 18 22:29 shell
-rw-r--r--. 1 root root 6510585 Mar 18 22:28 shell2.zip
-rw-r--r--. 1 root root      46 Mar 18 22:30 whiletest.sh
[root@shell37 shell2]# gzip whiletest.sh
[root@shell37 shell2]# ll
total 6368
drwxr-xr-x. 4 root root    4096 Mar 18 22:29 shell
-rw-r--r--. 1 root root 6510585 Mar 18 22:28 shell2.zip
-rw-r--r--. 1 root root      75 Mar 18 22:30 whiletest.sh.gz
[root@shell37 shell2]# gunzip whiletest.sh.gz
[root@shell37 shell2]# ll
total 6368
drwxr-xr-x. 4 root root    4096 Mar 18 22:29 shell
-rw-r--r--. 1 root root 6510585 Mar 18 22:28 shell2.zip
-rw-r--r--. 1 root root      46 Mar 18 22:30 whiletest.sh[root@shell37 shell2]# ll
total 6364
drwxr-xr-x. 4 root root    4096 Mar  9 07:22 shell
-rw-r--r--. 1 root root 6510585 Mar 18 22:28 shell2.zip[root@shell37 shell2]# zip -r shell2.zip ./shell/[root@shell37 shell2]# ll
total 6364
drwxr-xr-x. 4 root root    4096 Mar  9 07:22 shell
-rw-r--r--. 1 root root 6510585 Mar 18 22:28 shell2.zip

P038_韩顺平图解Linux全面升级_压缩和解压(2) 09:59


[root@shell37 shell2]# ll
total 6368
drwxr-xr-x. 4 root root    4096 Mar 18 22:29 shell
-rw-r--r--. 1 root root 6510585 Mar 18 22:28 shell2.zip
-rw-r--r--. 1 root root      46 Mar 18 22:30 whiletest.sh
[root@shell37 shell2]# tar -zcvf  22.tar.gz whiletest.sh
whiletest.sh
[root@shell37 shell2]# ll
total 6372
-rw-r--r--. 1 root root     158 Mar 18 22:36 22.tar.gz
drwxr-xr-x. 4 root root    4096 Mar 18 22:29 shell
-rw-r--r--. 1 root root 6510585 Mar 18 22:28 shell2.zip
-rw-r--r--. 1 root root      46 Mar 18 22:30 whiletest.sh[root@shell37 shell2]# tar -zxvf 22.tar.gz
whiletest.sh
---将*** 解压到文件夹  shell2dir 下面
[root@shell37 shell2]# tar -zxvf 22.tar.gz -C shell2dir/
whiletest.sh

P039_韩顺平图解Linux全面升级_实用指令小结 04:57


第十章 Linux实操篇 组管理和权限管理


P040_韩顺平图解Linux全面升级_linux组的介绍 07:35


P041_韩顺平图解Linux全面升级_所有者 04:03


[root@shell37 home]# ls -ahl
total 8.0K
drwxr-xr-x.  6 root root     56 Mar 17 07:20 .
dr-xr-xr-x. 19 root root   4.0K Mar 16 07:51 ..
drwx------.  5 jack jack    128 Mar 17 07:11 jack
drwx------.  3 zwj    1002   78 Mar 17 06:52 kinghome
drwx------. 15 leo  leo    4.0K Dec 15 06:59 leo
drwx------.  3 zwj  mojiao   78 Mar 17 07:20 zwj
[root@shell37 home]# chown leo zwj
[root@shell37 home]# ls -ahl
total 8.0K
drwxr-xr-x.  6 root root     56 Mar 17 07:20 .
dr-xr-xr-x. 19 root root   4.0K Mar 16 07:51 ..
drwx------.  5 jack jack    128 Mar 17 07:11 jack
drwx------.  3 zwj    1002   78 Mar 17 06:52 kinghome
drwx------. 15 leo  leo    4.0K Dec 15 06:59 leo
drwx------.  3 leo  mojiao   78 Mar 17 07:20 zwj

P042_韩顺平图解Linux全面升级_所在组 08:56


[root@shell37 home]# groupadd monster
[root@shell37 home]# useradd -g monster fox
[root@shell37 home]# id fox
uid=1003(fox) gid=1005(monster) groups=1005(monster)
[root@shell37 home]# [fox@shell37 ~]$ pwd
/home/fox
[fox@shell37 ~]$ touch ok.txt
[fox@shell37 ~]$ ll
total 0
-rw-r--r--. 1 fox monster 0 Mar 18 23:04 ok.txt
[fox@shell37 ~]$ [root@shell37 ~]# clear
[root@shell37 ~]# groupadd fruit
[root@shell37 ~]# touch orange.txt
[root@shell37 ~]# ll
[root@shell37 ~]# chgrp fruit orange.txt
[root@shell37 ~]# ll

P043_韩顺平图解Linux全面升级_修改所在组 04:15



[root@shell37 ~]# clear
[root@shell37 ~]# id zwj
uid=1002(zwj) gid=1004(mojiao) groups=1004(mojiao)
[root@shell37 ~]# cat /etc/group[root@shell37 ~]# cat /etc/group | grep wudang
wudang:x:1003:
[root@shell37 ~]# usermod -g wudang zwj
[root@shell37 ~]# id zwj
uid=1002(zwj) gid=1003(wudang) groups=1003(wudang)

P044_韩顺平图解Linux全面升级_rwx权限 15:46


P045_韩顺平图解Linux全面升级_权限说明案例 06:48


[root@shell38 dev]# ll /dev
total 0
crw-rw----. 1 root video    10, 175 Mar 18 06:45 agpgart
crw-------. 1 root root     10, 235 Mar 18 06:45 autofs
drwxr-xr-x. 2 root root         140 Mar 18 06:45 block

  • 1
  • 2
  • 3
  • 4
  • 5

P046_韩顺平图解Linux全面升级_修改权限 09:32

-rwxrw---x. 1 root root   46 Mar  6 00:56 whiletest.sh
[root@shell37 shell]# chmod u=rwx,g=rw,o=x whiletest.sh
  • 1
  • 2

P047_韩顺平图解Linux全面升级_修改所有者和所在组 09:15

chown tom /home/test2.txt
chown -R tom /home/test
chgrp newgroup 文件/目录

P048_韩顺平图解Linux全面升级_权限管理应用实例(1) 21:57

P049_韩顺平图解Linux全面升级_权限管理应用实例(2) 17:43

P050_韩顺平图解Linux全面升级_权限管理应用实例(3) 09:50

目录 rwx 权限

x: 可以进入到该目,cd 到该目录
r: 是否可以在目录下执行 ll 读取目录下的数据
w: 执行更改 ,删除操作

P051_韩顺平图解Linux全面升级_权限管理应用实例(4) 14:34

梳理知识点

第十一章 定时任务调度

P052_韩顺平图解Linux全面升级_crond快速入门 11:01

crontab

P053_韩顺平图解Linux全面升级_crond时间规则 05:05

P054_韩顺平图解Linux全面升级_crond应用实例 14:55

P055_韩顺平图解Linux全面升级_at任务调度机制 12:36

at 定时任务

P056_韩顺平图解Linux全面升级_at任务调度实例 10:09

P057_韩顺平图解Linux全面升级_任务调度小结 09:49

crontab   定时任务调度
crontab  -e / -l  / -r
service crond restart

at 定时任务
at ****
Ctrl + D 两次 结束at命令的输入
很多种时间定义,用时候再找,没有必要学
atq ; --------- 查看有没有at
atrm 编号; ----- 删除某个at队列

第十二章 linux磁盘分区、挂载

P058_韩顺平图解Linux全面升级_磁盘分区机制 16:04

lsblk ---- list block

[root@shell37 ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   20G  0 disk
├─sda1   8:1    0  300M  0 part /boot
├─sda2   8:2    0    2G  0 part [SWAP]
└─sda3   8:3    0 17.7G  0 part /
sr0     11:0    1 1024M  0 rom
[root@shell37 ~]# lsblk -f
NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
sda
├─sda1 xfs          8786eecf-a821-4cbe-9487-c1928e125036 /boot
├─sda2 swap         fc0a630f-5a4d-4489-b58f-d9e652a8d69e [SWAP]
└─sda3 xfs          dd082c19-0431-4fce-9c8d-b84dca3dfad5 /
sr0
[root@shell37 ~]#

P059_韩顺平图解Linux全面升级_增加磁盘应用实例 23:02

linux vm 虚拟机挂载硬盘
内容比较多,详见单独文章
https://blog.csdn.net/wei198621/article/details/115023640

---- 查看对应关系
[root@shell37 dev]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   20G  0 disk
├─sda1   8:1    0  300M  0 part /boot
├─sda2   8:2    0    2G  0 part [SWAP]
└─sda3   8:3    0 17.7G  0 part /
sdb      8:16   0    1G  0 disk
└─sdb2   8:18   0 1023M  0 part   ------看到 sdb2已经创建

P060_韩顺平图解Linux全面升级_磁盘情况查询 07:57

[root@shell37 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        18G   12G  6.5G  64% /
devtmpfs        471M     0  471M   0% /dev
tmpfs           487M     0  487M   0% /dev/shm
tmpfs           487M  8.1M  479M   2% /run
tmpfs           487M     0  487M   0% /sys/fs/cgroup
/dev/sdb2       991M  2.6M  922M   1% /newdisk
/dev/sda1       297M  147M  151M  50% /boot
tmpfs            98M     0   98M   0% /run/user/0
[root@shell37 ~]#


最简单的 du 指令是 du /opt ,常用的 要加上 --max-depth 参数

[root@shell37 opt]# du --max-depth=1 /opt
0       /opt/rh
660332  /opt/software
20688   /opt/shell
8       /opt/schwing
0       /opt/containerd
0       /opt/schwing-web
0       /opt/schwing-web-log
16164   /opt/idea
14192   /opt/shell2
0       /opt/shell20210319
717752  /opt
[root@shell37 opt]# du -hac --max-depth=1 /opt
0       /opt/rh
645M    /opt/software
21M     /opt/shell
8.0K    /opt/schwing
0       /opt/containerd
0       /opt/schwing-web
0       /opt/schwing-web-log
16M     /opt/idea
4.0K    /opt/time.sh
6.3M    /opt/myshell.zip
14M     /opt/shell2
0       /opt/shell20210319
4.0K    /opt/cron.txt
701M    /opt
701M    total

P061_韩顺平图解Linux全面升级_磁盘实用指令 07:24


----- 显示所有的 /opt 目录下 (一级)文件 文件夹
[root@shell37 opt]# ls -l /opt
total 6372
drwx--x--x. 4 root root      28 Mar 12 18:43 containerd
-rw-r--r--. 1 root root     716 Mar 19 21:16 cron.txt
drwxr-xr-x. 2 root root      66 Mar 16 09:16 idea
-rw-r--r--. 1 root root 6510585 Mar 18 22:24 myshell.zip
drwxr-xr-x. 2 root root       6 Oct 30  2018 rh
drwxr-xr-x. 2 root root      72 Mar 12 21:44 schwing
drwxr-xr-x. 6 root root     100 Mar 12 20:31 schwing-web
drwxr-xr-x. 2 root root       6 Mar 12 20:31 schwing-web-log
drwxr-xr-x. 4 root root    4096 Mar  9 07:22 shell
drwxr-xr-x. 4 root root      91 Mar 18 22:42 shell2
drwxr-xr-x. 2 root root       6 Mar 19 05:56 shell20210319
drwxr-xr-x. 4 root root     282 Mar  5 06:16 software
-rw-r--r--. 1 root root      83 Mar 18 22:18 time.sh------ 显示 /opt 目录下 (以-开头的)文件
[root@shell37 opt]# ls -l /opt| grep "^-"
-rw-r--r--. 1 root root     716 Mar 19 21:17 cron.txt
-rw-r--r--. 1 root root 6510585 Mar 18 22:24 myshell.zip
-rw-r--r--. 1 root root      83 Mar 18 22:18 time.sh------列出 /opt 目录下 (以-开头的)文件  的个数
[root@shell37 opt]# ls -l /opt| grep "^-" | wc -l
3------列出 /opt 目录下 (以d开头的)文件夹  的个数
[root@shell37 opt]# ls -l /opt| grep "^d" | wc -l
10------递归列出所有  /opt 目录下 (以-开头的)文件  的个数
[root@shell37 opt]# ls -lR /opt| grep "^-" | wc -l
2512------递归列出所有  /opt 目录下 (以d开头的)文件夹  的个数
[root@shell37 opt]# ls -lR /opt| grep "^d" | wc -l
269tree 默认没有安装
[root@shell37 opt]# tree --help
bash: tree: command not found...
[root@shell37 opt]#
[root@shell37 opt]# yum install -y tree
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com[root@shell37 opt]# tree -L 1 /opt
/opt
├── containerd
├── cron.txt
├── idea
├── myshell.zip
├── rh
├── schwing
├── schwing-web
├── schwing-web-log
├── shell
├── shell2
├── shell20210319
├── software
└── time.sh

P062_韩顺平图解Linux全面升级_磁盘分区挂载小结 10:30


lsblk
lsblk -f fdisk /dev/sdb
---格式化
mkfs -t ext4 /dev/sdb1
-----挂载
mount /dev/sdb1 /newdisk
-----卸载
umount  /dev/sdb1
-----注意命令挂载,重启后分区失效
---- 编辑 /et/fstab   让挂载永久生效
-----磁盘整体情况查询
df  -h
-----目录情况查询
du   -hac  --max-depth /opt
---工作几个使用的查询磁盘使用情况语句
tree  默认centOS 没有安装,需要安装后使用
yum install -y tree
tree -L 2 /opt 

第十三章 网络配置


P063_韩顺平图解Linux全面升级_NAT网络原理图 13:42

vmware 上面的192.168.121.37 地址
[root@shell37 opt]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500inet 192.168.121.37  netmask 255.255.255.0  broadcast 192.168.121.255inet6 fe80::a2cd:d26a:151d:8896  prefixlen 64  scopeid 0x20<link>ether 00:0c:29:b0:37:c7  txqueuelen 1000  (Ethernet)RX packets 6951  bytes 7719128 (7.3 MiB)RX errors 0  dropped 0  overruns 0  frame 0TX packets 2287  bytes 352213 (343.9 KiB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
--------本机ipconfig 后显示  VMnet8
以太网适配器 VMware Network Adapter VMnet8:连接特定的 DNS 后缀 . . . . . . . :本地链接 IPv6 地址. . . . . . . . : fe80::d8ca:d064:1bb2:f289%10IPv4 地址 . . . . . . . . . . . . : 192.168.121.1子网掩码  . . . . . . . . . . . . : 255.255.255.0默认网关. . . . . . . . . . . . . : 

P064_韩顺平图解Linux全面升级_网络配置指令 07:16


P065_韩顺平图解Linux全面升级_网络配置实例 12:10


[root@shell37 opt]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
service network start
reboot

P066_韩顺平图解Linux全面升级_主机名和hosts映射 22:08

设置主机名 
----显示主机名
[root@shell37 opt]# hostname
shell37
[root@shell37 opt]# cat /etc/hostname
shell37设置host映射 
windos:  c:\Windows\System32\drivers\etc\hosts
linux:  /etc/hosts

  • 1
  • 2

域名解析过程
1.浏览器缓存
2.本地计算机中的DNS缓存 ipconfig /displaydns 可以查看
3. hosts文件中的 ip 域名 对应关系
4.外网真正的DNS服务器

----显示本地DNS缓存
C:\Users\wei19>ipconfig /displaydns

P067_韩顺平图解Linux全面升级_网络配置小结 09:42

网络配置原理
查看虚拟机的 IP  网关   等信息
ping  www.baidu.com
vim /etc/sysconfig/network-scripts/ifcfg-ens33
vim /etc/hosts
C:\Windows\System32\dirvers\etc\hosts
service network restart
reboot
hostnam
vim /etc/hostname

第十四章 进程管理

P068_韩顺平图解Linux全面升级_进程基本介绍 06:22

P069_韩顺平图解Linux全面升级_ps指令详解 ps -aux 10:21

ps  -aux    ---------  查看系统中正在运行的进程
  • 1

[root@shell37 opt]# ps -aux | grep sshd
root       4027  0.0  0.0 112708   976 pts/0    S+   01:13   0:00 grep --color=auto sshd
root       6883  0.0  0.0 112756   716 ?        Ss   Mar19   0:00 /usr/sbin/sshd -D
root       7924  0.0  0.0 160848   912 ?        Ss   Mar19   0:00 sshd: root@pts/0
[root@shell37 opt]#

P070_韩顺平图解Linux全面升级_父子进程 ps -ef 08:21

ps -ef : 可以看到父进程号

[root@shell37 opt]# ps -ef|more
UID         PID   PPID  C STIME TTY          TIME CMD
root          1      0  0 Mar19 ?        00:00:03 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
root          2      0  0 Mar19 ?        00:00:00 [kthreadd]
root          3      2  0 Mar19 ?        00:00:01 [ksoftirqd/0]
root          5      2  0 Mar19 ?        00:00:00 [kworker/0:0H]
root          7      2  0 Mar19 ?        00:00:00 [migration/0]

ps -aux 查看某系统进程占用内存 cpu 资源情况

[root@shell37 opt]# ps -axu|more
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root          1  0.0  0.4 193868  4584 ?        Ss   Mar19   0:03 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
root          2  0.0  0.0      0     0 ?        S    Mar19   0:00 [kthreadd]
root          3  0.0  0.0      0     0 ?        S    Mar19   0:01 [ksoftirqd/0]
root          5  0.0  0.0      0     0 ?        S<   Mar19   0:00 [kworker/0:0H]

P071_韩顺平图解Linux全面升级_终止进程 16:15

—开启一个新终端,用 jack2 登录

[root@shell37 ~]# ssh jack2@192.168.121.37
jack2@192.168.121.37's password:
Last login: Fri Mar 19 06:03:16 2021 from shell37
[jack2@shell37 ~]$ ll
total 0
-rw-r--r--. 1 jack2 police 0 Mar 19 06:04 jack2.txt
[jack2@shell37 ~]$

---------- root 所在terminal 执行 kill 我的登录进程后,我被踢出了
[jack2@shell37 ~]$ Connection to 192.168.121.37 closed by remote host.
Connection to 192.168.121.37 closed.

—在原有root 登录的终端,可以看到

[root@shell37 opt]# ps -ef | grep ssh
root       6883      1  0 Mar19 ?        00:00:00 /usr/sbin/sshd -D
root       7924   6883  0 Mar19 ?        00:00:00 sshd: root@pts/0,pts/1
root      16102  13939  0 01:37 pts/1    00:00:00 ssh jack2@192.168.121.37
root      16103   6883  0 01:37 ?        00:00:00 sshd: jack2 [priv]  ------------------- 此为jack2 登录的进程
jack2     16249  16103  0 01:38 ?        00:00:00 sshd: jack2@pts/2
root      16559   7943  0 01:38 pts/0    00:00:00 grep --color=auto ssh
root      61977  61758  0 Mar19 ?        00:00:00 /usr/bin/ssh-agent /bin/sh -c exec -l /bin/bash -c "env GNOME_SHELL_SESSION_MODE=classic gnome-session --session gnome-classic"
--------kill  16103  后 jack2 被强制退出了
[root@shell37 opt]# kill 16103

关闭SSH服务,查看效果

------6883   为ssh  服务本身,如果杀死,没有办法远程了 ,实际应该是关闭22端口
[root@shell37 opt]# ps -axu |grep sshd
root       6883  0.0  0.0 112756   972 ?        Ss   Mar19   0:00 /usr/sbin/sshd -D
root       7924  0.0  0.1 160848  1300 ?        Ss   Mar19   0:00 sshd: root@pts/0,pts/1
root      22879  0.0  0.0 112708   976 pts/0    S+   01:51   0:00 grep --color=auto sshd

---- 删除后执行登录,提示失败
[root@shell37 ~]# ssh root@192.168.121.37
ssh: connect to host 192.168.121.37 port 22: Connection refused

重新开启服务

-------- 启动ssh 服务
[root@shell37 ~]# /bin/systemctl start sshd.service
[root@shell37 ~]#
-----重新连接
[root@shell37 ~]# ssh jack2@192.168.121.37
jack2@192.168.121.37's password:
Last login: Sat Mar 20 01:38:08 2021 from shell37
[jack2@shell37 ~]$

killall 演示

[root@shell37 opt]# killall gedit
  • 1


P072_韩顺平图解Linux全面升级_pstree指令 04:11

[root@shell37 opt]# pstree
[root@shell37 opt]# pstree -p  -----显示进程ID
[root@shell37 opt]# pstree -u  ---- 显示进程所属用户
  • 1
  • 2
  • 3


P073_韩顺平图解Linux全面升级_服务管理(1) 13:42

后台程序/守护进程/服务
service 服务名 [start|stop|restart|reload|status]
7.0 以后用 systemctl 替换 service ,还可以使用 service 的程序在 /etc/init.d 目录下

[root@shell37 init.d]# cd /etc/init.d
[root@shell37 init.d]# ll
total 40
-rw-r--r--. 1 root root 18281 Aug 24  2018 functions
-rwxr-xr-x. 1 root root  4569 Aug 24  2018 netconsole
-rwxr-xr-x. 1 root root  7923 Aug 24  2018 network
-rw-r--r--. 1 root root  1160 Oct 30  2018 README
[root@shell37 init.d]# service netconsole status
netconsole module not loaded
[root@shell37 init.d]# service network status
Configured devices:
lo ens33
Currently active devices:
lo ens33 virbr0 br-479c90ff8129 br-93809f7c3dbc docker0
[root@shell37 init.d]#
[root@shell37 ~]# service network status
Configured devices:
lo ens33
Currently active devices:
lo ens33 virbr0 br-479c90ff8129 br-93809f7c3dbc docker0
[root@shell37 ~]# service network stop
Stopping network (via systemctl):                          [  OK  ]
[root@shell37 ~]# setup 可以看到所有的服务 

P074_韩顺平图解Linux全面升级_服务管理(2) 06:30

服务的运行级别 常用的是 3 5 两个运行级别 
[root@shell37 ~]# systemctl get-default
multi-user.target     ----  默认3 级别
[root@shell37 ~]# systemctl set-default graphical.target     ------ 修改为5级别
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
[root@shell37 ~]# systemctl get-default    ----再次查看是5 级别
graphical.target

P075_韩顺平图解Linux全面升级_服务管理(3) 06:40


[root@shell37 ~]# chkconfig --listNote: This output shows SysV services only and does not include nativesystemd services. SysV configuration data might be overridden by nativesystemd configuration.If you want to list systemd services use 'systemctl list-unit-files'.To see services enabled on particular target use'systemctl list-dependencies [target]'.netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@shell37 ~]# chkconfig --level 1 network on
[root@shell37 ~]# chkconfig --listNote: This output shows SysV services only and does not include nativesystemd services. SysV configuration data might be overridden by nativesystemd configuration.If you want to list systemd services use 'systemctl list-unit-files'.To see services enabled on particular target use'systemctl list-dependencies [target]'.netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off
network         0:off   1:on    2:on    3:on    4:on    5:on    6:off
[root@shell37 ~]# 

P076_韩顺平图解Linux全面升级_服务管理(4) 22:01

 

service 服务名 [start|stop|restart|status] 如: service network stop
systemctl [start|stop|restart|status] 服务名 如:systemctl stop network
//

 

service 管理的服务在 /etc/init.d — 由于 /etc/init.d 是个链接 init.d -> rc.d/init.d == ls -l rc.d/init.d
systemctl 管理的服务在 /usr/lib/systemd/system — ls -l /usr/lib/systemd/system



[root@shell37 etc]# systemctl is-enabled firewalld
disabled[root@shell37 etc]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: inactive (dead)Docs: man:firewalld(1)[root@shell37 etc]# systemctl list-unit-files | grep fire
firewalld.service                             disabled
[root@shell37 etc]# systemctl enable firewalld
Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.
[root@shell37 etc]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)Active: inactive (dead)Docs: man:firewalld(1)
[root@shell37 etc]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@shell37 etc]# systemctl is-enabled firewalld
disabled
[root@shell37 etc]# systemctl start firewalld
[root@shell37 etc]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: active (running) since Sat 2021-03-20 06:39:53 PDT; 7s agoDocs: man:firewalld(1)Main PID: 93179 (firewalld)Tasks: 2Memory: 30.0MCGroup: /system.slice/firewalld.service└─93179 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopidMar 20 06:39:51 shell37 systemd[1]: Starting firewalld - dynamic firewall daemon...
Mar 20 06:39:53 shell37 systemd[1]: Started firewalld - dynamic firewall daemon.
--- 当37 防火墙开启  无法telnet 到上面去,显示如下所示
[root@shell38 ~]# telnet 192.168.121.37 111
Trying 192.168.121.37...
telnet: connect to address 192.168.121.37: No route to host
--- 当37 防火墙关闭  正常连接上 37 111 端口的提示 (比较怪异,接受吧,中年! )
[root@shell38 ~]# telnet 192.168.121.37 111
Trying 192.168.121.37...
Connected to 192.168.121.37.
Escape character is '^]'.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

P077_韩顺平图解Linux全面升级_服务管理(5) 07:56

基本信息

基础状态
192.168.121.37 ---- 被访问机器
192.168.121.38 ---- 访问的机器

[root@shell37 ~]# netstat -anp |more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      6964/mongod
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd ----要处理的端口111
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      60873/X
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      7436/dnsmasq
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

step1 初始状态防火墙关闭,可以访问

[root@shell37 etc]# systemctl stop firewalld
[root@shell37 etc]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: inactive (dead) since Sat 2021-03-20 07:14:25 PDT; 5s agoDocs: man:firewalld(1)Process: 108629 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)Main PID: 108629 (code=exited, status=0/SUCCESS)

Mar 20 07:09:36 shell37 systemd[1]: Starting firewalld - dynamic firewall daemon….
Mar 20 07:09:36 shell37 systemd[1]: Started firewalld - dynamic firewall daemon.
Mar 20 07:14:24 shell37 systemd[1]: Stopping firewalld - dynamic firewall daemon….
Mar 20 07:14:25 shell37 systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@shell37 etc]#

37 防火墙关闭 , 38 可以访问

[root@shell38 ~]# telnet 192.168.121.37 111
Trying 192.168.121.37...
Connected to 192.168.121.37.
Escape character is '^]'.

step2 防火墙打开,38不可以访问37

[root@shell37 etc]# systemctl start firewalld
[root@shell37 etc]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: active (running) since Sat 2021-03-20 07:18:06 PDT; 2s agoDocs: man:firewalld(1)Main PID: 113334 (firewalld)Tasks: 2Memory: 22.1MCGroup: /system.slice/firewalld.service└─113334 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Mar 20 07:18:06 shell37 systemd[1]: Starting firewalld - dynamic firewall daemon….
Mar 20 07:18:06 shell37 systemd[1]: Started firewalld - dynamic firewall daemon.
[root@shell37 etc]#

[root@shell38 ~]# telnet 192.168.121.37 111
Trying 192.168.121.37...
telnet: connect to address 192.168.121.37: No route to host

step3 重复第一步 开启防火墙 ,38继续不可以访问37


[root@shell37 etc]# systemctl start firewalld
[root@shell37 etc]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: active (running) since Sat 2021-03-20 07:19:43 PDT; 1s agoDocs: man:firewalld(1)Main PID: 114504 (firewalld)Tasks: 2Memory: 21.5MCGroup: /system.slice/firewalld.service└─114504 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopidMar 20 07:19:43 shell37 systemd[1]: Starting firewalld - dynamic firewall daemon...
Mar 20 07:19:43 shell37 systemd[1]: Started firewalld - dynamic firewall daemon.
[root@shell37 etc]# 
[root@shell38 ~]# telnet 192.168.121.37 111
Trying 192.168.121.37...
telnet: connect to address 192.168.121.37: No route to host

step4 打开 111 端口 ,让38 可以访问37 111端口


------  增加开启端口
[root@shell37 etc]# firewall-cmd --permanent --add-port=111/tcp
success
----虽然上一步 提示成功了 ,但是显示的是 没有打开,因为没有reload
[root@shell37 etc]# firewall-cmd --query-port=111/tcp
no
------ 执行reload
[root@shell37 etc]# firewall-cmd --reload
success
-------显示 111 端口为开启状态
[root@shell37 etc]# firewall-cmd --query-port=111/tcp
yes
[root@shell37 etc]# 
----- 虽然防火墙关闭,但是111 端口是开启的
[root@shell38 ~]# telnet 192.168.121.37 111
Trying 192.168.121.37...
Connected to 192.168.121.37.
Escape character is '^]'.

P078_韩顺平图解Linux全面升级_动态监控系统 top (1) 09:49

top 指令图示解析 

P079_韩顺平图解Linux全面升级_动态监控系统(2) 08:01


P080_韩顺平图解Linux全面升级_监控网络状态 netstat 16:14

 最常用指令参数-anp ; netstat -anp
[root@shell37 ~]# netstat -anp |more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      6964/mongod
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      60873/X
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      7436/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      25371/sshd
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      6879/cupsd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      7144/master
tcp        0      0 192.168.121.37:22       192.168.121.1:63558     ESTABLISHED 82540/sshd: root@pt
tcp        0     52 192.168.121.37:22       192.168.121.1:63559     ESTABLISHED 82607/sshd: root@pt 

P081_韩顺平图解Linux全面升级_进程管理小结 11:02

进程管理 程序–静态 ;进程–动态 ps -ef ; ps -aux; kill -9 进程号; killall 进程名;删除同时会删除关联子进程 pstree service 服务名 [start|stop|status|restart|reload] — systemctl 替换它 service 管理在 /etc/init.d 目录中的服务 查看服务 setup 查看服务 服务运行级别 0-6 ,常用 3,5 chkconfig 给服务设置在不同运行级别开启还是关闭 systemctl [start|stop|status|restart|reload] 服务名 所有systemctl 服务在目录 /usr/lib/systemd/system 目录下 firewall 打开端口:firewall-cmd --permanent --add-port=端口号/协议 关闭端口:firewall-cmd --permanent --remove-port=端口号/协议 重新载入(重新载入,打开关闭方可生效):firewall-cmd --reload 查看端口:firewall-cmd --query-port=端口号/协议 动态监控 top (对比ps 指令) 监控网路状态 netstat -anp ;

第十五章 RPM 与 YUM


P082_韩顺平图解Linux全面升级_rpm管理(1) 08:13


-----1 查询所有rpm 包
[root@shell37 ~]# rpm -qa|more
numad-0.5-18.20150602git.el7.x86_64
pcre2-10.23-2.el7.x86_64
google-noto-emoji-color-fonts-20180508-4.el7.noarch
exiv2-libs-0.26-3.el7.x86_64
--------02 查询是否有firefox关键字的包
[root@shell37 ~]# rpm -q firefox
firefox-60.2.2-1.el7.centos.x86_64
--------03 查询firefox 包详情
[root@shell37 ~]# rpm -qi firefox
Name        : firefox
Version     : 60.2.2
Release     : 1.el7.centos
Architecture: x86_64
Install Date: Thu 22 Oct 2020 08:49:24 AM PDT
Group       : Unspecified
Size        : 216144933
--------04  查询firefox 包的安装文件路径
[root@shell37 ~]# rpm -ql firefox
/etc/firefox
/etc/firefox/pref
/usr/bin/firefox
/usr/lib64/firefox
/usr/share/man/man1/firefox.1.gz
---------05  rpm -ql  的反向操作,根据文件路径查找源自哪个rpm 包
[root@shell37 ~]# rpm -qf /usr/share/man/man1/firefox.1.gz
firefox-60.2.2-1.el7.centos.x86_64

P083_韩顺平图解Linux全面升级_rpm管理(2) —todo 07:36

[root@shell37 dev]# pwd
/dev
[root@shell37 dev]# ll | more
total 0
lrwxrwxrwx. 1 root root           3 Mar 20 16:40 cdrom -> sr0
drwxr-xr-x. 3 root root         200 Mar 20 16:02 snd
brw-rw----+ 1 root cdrom    11,   0 Mar 20 16:40 sr0  ---- cdrom 光驱 ---- /dev/sr0  光驱挂载到了 /run/media/root/VMware Tools  目录下
[root@shell37 VMware Tools]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        18G   12G  6.3G  65% /
devtmpfs        471M     0  471M   0% /dev
tmpfs           487M     0  487M   0% /dev/shm
tmpfs           487M   27M  460M   6% /run
tmpfs           487M     0  487M   0% /sys/fs/cgroup
/dev/sdb2       991M  2.6M  922M   1% /newdisk
/dev/sda1       297M  147M  151M  50% /boot
tmpfs            98M  8.0K   98M   1% /run/user/42
tmpfs            98M   32K   98M   1% /run/user/0
/dev/sr0         56M   56M     0 100% /run/media/root/VMware Tools未能加载光驱中的Firefox,取出rpm包,然后再安装

P084_韩顺平图解Linux全面升级_yum 06:47


[root@shell37 etc]# rpm -e firefox[root@shell37 etc]# yum list |grep firefox
firefox.i686                               78.8.0-1.el7.centos         updates
firefox.x86_64                             78.8.0-1.el7.centos         updates  [root@shell37 etc]# yum install firefox
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile

P085_韩顺平图解Linux全面升级_软件包管理小结 03:14

RPM : RedHat Package Manager rpm -wq | grep XXX rpm -qa |grep XXX rpm -qi XXX --软件包信息详情 rpm -qf /路径 ---- 查询文件所属软件包 rpm -e **** ----- 删除软件包 rpm -ivh RPM包全路径名称 -----
yum yum list |grep ** yum install ***

第十六章 JAVA EE 定制篇 搭建JavaEE 环境


P086_韩顺平图解Linux全面升级_安装配置JDK8 12:45

安装过程比较复杂,单独做了一个文件 Linux centos 安装Jdk8 https://blog.csdn.net/wei198621/article/details/113836286

P087_韩顺平图解Linux全面升级_安装配置tomcat8 07:16

内容比较多,单独放在一个文件中,以便日后访问 https://blog.csdn.net/wei198621/article/details/115051168  firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --reload firewall-cmd --query-port=8080/tcp

P088_韩顺平图解Linux全面升级_安装配置idea2020 07:03

步骤不算多,也放在了这个目录下面。 https://blog.csdn.net/wei198621/article/details/115051806 

P089_韩顺平图解Linux全面升级_安装配置mysql5.7 15:14

具体步骤需要单独文档,linux centos 安装 mysql5.7 https://blog.csdn.net/wei198621/article/details/115052757

P090_韩顺平图解Linux全面升级_小结 02:13


第十七章 大数据定制篇 --Shell 编程


P091_韩顺平图解Linux全面升级_shell编程快速入门 11:41


P092_韩顺平图解Linux全面升级_shell变量 12:49


[root@shell38 shcode]# echo $HOME
/root
[root@shell38 shcode]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/.dotnet/tools:/usr/local/java/jdk1.8.0_251/bin:/usr/local/java/jdk1.8.0_251/jre/bin:/root/bin
[root@shell38 shcode]# echo $PWD
/root/shcode
-----当前shell 的所有变量 : set
[root@shell38 shcode]# set |more
ABRT_DEBUG_LOG=/dev/null
BASH=/bin/bash
BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappen
d:interactive_comments:login_shell:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()

P093_韩顺平图解Linux全面升级_设置环境变量 09:41


P094_韩顺平图解Linux全面升级_位置参数变量 05:28


[root@shell38 shcode]# cat position.sh
#!/bin/bash
echo "$0"
echo "$1"
echo "$2"echo "$*"echo "$@"echo "$#"
[root@shell38 shcode]# chmod u+x position.sh [root@shell38 shcode]# sh position.sh 11 22 33 44
position.sh
11
22
11 22 33 44
11 22 33 44
4
[root@shell38 shcode]# 

P095_韩顺平图解Linux全面升级_预定义变量 04:09


P096_韩顺平图解Linux全面升级_运算符 11:57



[root@shell38 shcode]# vim expresh.sh
A1=$(((2+3)*4 ))
echo "res11=$A1"
#case 1  $[]
A2=$[(2+3)*4]
echo "res12=$A2"
#case 1  expr m + n
A3=`expr 2 + 3`
echo "$A3"
RES3=`expr $A3 \* 4`
echo "res13=$RES3"#case 2 $(())
B1=$(($1 + $2))
echo "$B1"
#case 2 $[]
B2=$[$1+$2]
echo "$B2"
#case 2  expr m + n
B3=`expr $1 + $2`
echo "$B3"[root@shell38 shcode]# sh expresh.sh 11 22
res11=20
res12=20
5
res13=20
33
33
33

P097_韩顺平图解Linux全面升级_条件判断 12:51

[root@shell38 shcode]# sh ifdaemon.sh equal big than [root@shell38 shcode]# cat ifdaemon.sh #!/bin/bash
if [ “ok”=“ok” ] then echo “equal” fi
#========================
if [ 23 -gt 22 ] then echo “big than” fi

P098_韩顺平图解Linux全面升级_单分支多分支 04:20


-- 如果大于等于60 输出 pass
--- 如果小于60 输出 unpass
[root@shell38 shcode]# sh iftest.sh 88
pass
[root@shell38 shcode]# sh iftest.sh 58
unpass
[root@shell38 shcode]# cat iftest.sh
#!/bin/bashif [ $1 -ge 60 ]
then
echo "pass"
elif [ $1 -lt 60 ]
then
echo "unpass"
fi

P099_韩顺平图解Linux全面升级_case语句 04:58


-- 参数 是 1  输出 星期一
---参数 是 2  输出 星期二
-- 参数是 其他 输出 other
[root@shell38 shcode]# cat casetest.sh
#!/bin/bash
case $1 in
"1")
echo "monday"
;;
"2")
echo "tuesday"
;;
*)
echo "other"
;;
esac[root@shell38 shcode]# sh casetest.sh 1
monday
[root@shell38 shcode]# sh casetest.sh 2
tuesday
[root@shell38 shcode]# sh casetest.sh 3
other
[root@shell38 shcode]# sh casetest.sh 33
other

P100_韩顺平图解Linux全面升级_for循环 12:12


[root@shell38 shcode]# cat testfor1.sh
#!/bin/bash
------$*  是一个整体对待
for i in "$*"
do echo "num is $i"
done
echo "======"
------$@ 分别对待
for i in "$@"
do echo "num is $i"
done[root@shell38 shcode]# ./testfor1.sh  100 200 300
num is 100 200 300
======
num is 100
num is 200
num is 300
[root@shell38 shcode]# cat testfor2.sh
#!/bin/bash
SUM=0
for(( i=1;i<=100;i++ ))
doSUM=$[$SUM+$i]
done
echo "sum is $SUM"
[root@shell38 shcode]# ./testfor2.sh
sum is 5050

P101_韩顺平图解Linux全面升级_while循环 04:26


[root@shell38 shcode]# cat testwhile.sh
#!/bin/bash
SUM=0
i=0
-------- 注意 while [ 表达式 ] ,这三者之间都有空格
while [ $i -le $1 ]
doSUM=$[$SUM+$i]i=$[$i+1]
doneecho "result is $SUM"
[root@shell38 shcode]# sh testwhile.sh 100
result is 5050[root@shell38 shcode]# 

P102_韩顺平图解Linux全面升级_read获取输入 05:20


[root@shell38 shcode]# cat testRead.sh
#!/bin/bash
read -p "pls input a num =" NUM1
echo "the num input is $NUM1"
echo "===================="
-------10s 内不输入数据自动退出
read -t 10 -p "pls input a num in 10 seconds " NUM2
echo "the num input is $NUM2"[root@shell38 shcode]# sh testRead.sh
pls input a num =11
the num input is 11
====================
pls input a num in 10 seconds 22
the num input is 22

P103_韩顺平图解Linux全面升级_系统函数 04:10


[root@shell38 shcode]# basename /home/aa/test.txt
test.txt
[root@shell38 shcode]# basename /home/aa/test.txt .txt
test
[root@shell38 shcode]# dirname /home/aa/test.txt
/home/aa

P104_韩顺平图解Linux全面升级_自定义函数 05:21


[root@shell38 shcode]# cat testfunction.sh
#!/bin/bash
function getSum(){SUM=$[$n1+$n2]echo "sum is $SUM"
}echo "pls input 2 nums "
read -p "num1 is " n1
read -p "num2 is " n2getSum $n1 $n2
[root@shell38 shcode]# ./testfunction.sh 22 33
pls input 2 nums
num1 is 22
num2 is 11
sum is 33

P105_韩顺平图解Linux全面升级_定时备份数据库(1) 07:24


P106_韩顺平图解Linux全面升级_定时备份数据库(2) 25:27

具体过程在 leo linux shell 脚本汇编 https://blog.csdn.net/wei198621/article/details/114904337

P107_韩顺平图解Linux全面升级_shell编程笔记梳理 03:44


第十八章 Python 定制篇 Python开发平台Ubuntu


P108_韩顺平图解Linux全面升级_ubuntu安装 09:32

没有安装成功,不仔细研究乌班图了,拜拜乌班图 https://blog.csdn.net/wei198621/article/details/115150075

P109_韩顺平图解Linux全面升级_ubuntu中文支持 02:45


P110_韩顺平图解Linux全面升级_ubuntu的root 04:12


P111_韩顺平图解Linux全面升级_hello python 01:42


P112_韩顺平图解Linux全面升级_APT原理机制图 09:45


P113_韩顺平图解Linux全面升级_APT更新源和实例 12:28


P114_韩顺平图解Linux全面升级_ubuntu远程登录和集群 19:24


P115_韩顺平图解Linux全面升级_python定制篇梳理 04:58


第二十章 CentOS8 安装


P116_韩顺平图解Linux全面升级_centos8安装和介绍 16:13

linux vmware 安装 centos8 https://blog.csdn.net/wei198621/article/details/115220528

第二十一章 日志管理

看懂下面几个目录,也就看懂日志了
[root@leoCentOS8 cron.daily]# ll
总用量 4
-rwxr-xr-x. 1 root root 189 1月   4 2018 logrotate
[root@leoCentOS8 cron.daily]# cat logrotate
#!/bin/sh/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit $EXITVALUE
[root@leoCentOS8 cron.daily]# 
-----------01  定义不同日志发往不同文件
[root@leoCentOS8 ~]# cat /etc/rsyslog.conf
... ....
# Log all the mail messages in one place.
mail.*                      -/var/log/maillog----------02  定义日志轮替规则  (logrotate.conf 是全局日志轮替策略)
[root@leoCentOS8 ~]# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
dateext
# uncomment this if you want your log files compressed
#compress
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# system-specific logs may be also be configured here.
[root@leoCentOS8 ~]#
-----------------03  对/etc/logrotate.conf的补充,分别定义某个日志轮替规则
[root@leoCentOS8 logrotate.d]# pwd
[root@leoCentOS8 logrotate.d]# ls
bootlog  chrony  dnf        iscsiuiolog  libvirtd.qemu  psacct  sssd                  syslog          wtmp
btmp     cups    firewalld  libvirtd     numad          samba   subscription-manager  wpa_supplicant/etc/logrotate.d

P117_韩顺平图解Linux全面升级_日志介绍和实例 08:51

在本地 192.168.121.38 机器上 登录 192.168.121.8 第一次登录,使用错误密码,不成功 第二次登录,使用正确密码,成功
[root@shell38 ~]# ssh root@192.168.121.8
The authenticity of host '192.168.121.8 (192.168.121.8)' can't be established.
ECDSA key fingerprint is SHA256:94op0q/+Shz+TV0vC8riIcq3docKVSbZtxMRjRuChqk.
ECDSA key fingerprint is MD5:76:ce:8e:f3:27:d3:63:83:7e:4f:53:fa:c0:8f:ab:aa.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.121.8' (ECDSA) to the list of known hosts.
root@192.168.121.8's password:
Permission denied, please try again.
root@192.168.121.8's password:
Activate the web console with: systemctl enable --now cockpit.socketLast failed login: Thu Mar 25 12:18:35 EDT 2021 from 192.168.121.38 on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Thu Mar 25 12:17:27 2021 from ::1
[root@leoCentOS8 ~]# 到 192.168.121.8 上面 /var/log/secure 目录上面查看登录信息
[root@leoCentOS8 log]# cat secure Mar 25 12:18:32 leoCentOS8 unix_chkpwd[2311]: password check failed for user (root)
Mar 25 12:18:32 leoCentOS8 sshd[2309]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.121.38  user=root
----- 第一次 通过 38 登录 8 ,使用错误密码,失败
Mar 25 12:18:35 leoCentOS8 sshd[2309]: Failed password for root from 192.168.121.38 port 56520 ssh2
----- 第一次 通过 38 登录 8 ,使用正确密码,成功
Mar 25 12:20:07 leoCentOS8 sshd[2309]: Accepted password for root from 192.168.121.38 port 56520 ssh2
Mar 25 12:20:07 leoCentOS8 sshd[2309]: pam_unix(sshd:session): session opened for user root by (uid=0)
[root@leoCentOS8 log]# pwd
/var/log
[root@leoCentOS8 log]# 

P118_韩顺平图解Linux全面升级_日志服务原理图 04:30


[root@leoCentOS8 log]# ps aux |grep 'rsyslog' |grep -v "grep"
root        1303  0.0  0.3 226672  6456 ?        Ssl  12:03   0:00 /usr/sbin/rsyslogd -n
[root@leoCentOS8 log]# systemctl list-unit-files | grep rsyslog
rsyslog.service                            enabled   

P119_韩顺平图解Linux全面升级_日志服务配置文件 11:11


[root@leoCentOS8 ~]# cat /etc/rsyslog.conf # Log all the mail messages in one place.
mail.*                                                  -/var/log/maillog# Log cron stuff
cron.*                                                  /var/log/cron# Everybody gets emergency messages
*.emerg                                                 :omusrmsg:*# Save news errors of level crit and higher in a special file.
uucp,news.crit                                          /var/log/spooler# Save boot messages also to boot.log
local7.*                                                /var/log/boot.log

P120_韩顺平图解Linux全面升级_自定义日志服务 05:24


[root@leoCentOS8 ~]# vim /etc/rsyslog.conf
......
local7.*                      /var/log/boot.log
# save all to leolog.log  将所有日志放到leolog.log 文件下
*.*                           /var/log/leolog.log[root@leoCentOS8 ~]# reboot
过滤所有ssh 的信息
[root@leoCentOS8 log]# cat leolog.log | grep sshd
Mar 26 08:45:05 leoCentOS8 systemd[1]: Reached target sshd-keygen.target.
Mar 26 08:45:06 leoCentOS8 sshd[1125]: Server listening on 0.0.0.0 port 22.
Mar 26 08:45:06 leoCentOS8 sshd[1125]: Server listening on :: port 22.
Mar 26 08:45:16 leoCentOS8 sshd[1665]: Accepted password for root from 192.168.121.1 port 53044 ssh2
Mar 26 08:45:16 leoCentOS8 sshd[1665]: pam_unix(sshd:session): session opened for user root by (uid=0)
Mar 26 08:46:37 leoCentOS8 sshd[1935]: Accepted password for root from 192.168.121.1 port 53066 ssh2
Mar 26 08:46:37 leoCentOS8 sshd[1935]: pam_unix(sshd:session): session opened for user root by (uid=0)
[root@leoCentOS8 log]# pwd
/var/log
[root@leoCentOS8 log]# 

P121_韩顺平图解Linux全面升级_日志轮替介绍 11:21


P122_韩顺平图解Linux全面升级_自定义日志轮替 06:38


P123_韩顺平图解Linux全面升级_日志轮替机制 03:13


[root@leoCentOS8 cron.daily]# ll
总用量 4
-rwxr-xr-x. 1 root root 189 1月   4 2018 logrotate
[root@leoCentOS8 cron.daily]# cat logrotate
#!/bin/sh/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit $EXITVALUE
[root@leoCentOS8 cron.daily]# 

P124_韩顺平图解Linux全面升级_内存日志 03:27


[root@leoCentOS8 cron.daily]# journalctl -n 10
-- Logs begin at Fri 2021-03-26 08:45:00 EDT, end at Fri 2021-03-26 09:53:49 EDT. --
3月 26 08:55:16 leoCentOS8 systemd[1]: Starting dnf makecache...
3月 26 08:55:17 leoCentOS8 dnf[2063]: 元数据缓存近期已刷新。
3月 26 08:55:17 leoCentOS8 systemd[1]: dnf-makecache.service: Succeeded.
3月 26 08:55:17 leoCentOS8 systemd[1]: Started dnf makecache.
3月 26 09:00:16 leoCentOS8 systemd[1]: Starting Cleanup of Tempor

2021韩顺平图解linux相关推荐

  1. 数据结构 - Java -韩顺平 图解Java数据结构和算法

    数据结构 Lesson 1 数据结构的知识总结 1. 几个经典的算法面试题 2. 线性结构与非线性结构 2.1 稀疏数组 sparsearray 2.2 队列 2.2.1 顺序队列: 2.2.2 环形 ...

  2. 2021韩顺平一周学会Linux 课程笔记

    2022/10/1~2022/10/8 确实有些匆忙,课程的一些定制篇跳过了.下面是随之记录的内容,分享一下. Linux目录结构 linux的文件系统是采用级层式的树状目录结构,在此结构中的最上层是 ...

  3. B站韩顺平老师Linux笔记(截止到85集)

    虚拟机的克隆 虚拟机的快照功能 共享文件夹 主机上的文件夹 虚拟机同步到的文件夹 远程文件的传输 Xftp Vim 输入i进入编辑模式 先按Esc再输入:就进入命令行模式了 输入wq就可以保存并且退出 ...

  4. 30天学会JAVA—练习题(2021韩顺平)——Day13

    装拆箱 Sting类 StringBuffer 类 Arrays类 public class A04 {public static void main(String[] args) {//参数数组Bo ...

  5. 学习韩顺平-Linux:

    学习韩顺平老师的Linux课程:[小白入门 通俗易懂]2021韩顺平 一周学会Linux 参考 2021韩顺平图解linux_狗剩学习笔记以习之. Linux: 到P104 左右 一.配置: conn ...

  6. linux韩顺平2021

    linux韩顺平2021 文章目录 linux韩顺平2021 p1 课程内容 基础篇 实际操作篇 2021高级篇 p2 应用领域 p3 概述 p4 Linux和Unix p5 vmware15.5安装 ...

  7. 韩顺平Linux教程学习笔记

    Linux系统学习笔记   新装了deepin v23系统,结果磁盘没设置好,玩崩了,百度半天修复不了,看看韩顺平老师的Linux操作课程,做做笔记(只记录对自己有用的).   B站网址 基础篇·Li ...

  8. 【韩顺平Linux】学习笔记1

    [韩顺平Linux]学习笔记1 一.网络连接的三种方式 二.虚拟机克隆 三.虚拟机快照 四.虚拟机迁移和删除 五.VMtools 六.Linux目录结构 七.远程登录和文件传输 一.网络连接的三种方式 ...

  9. 韩顺平 2021零基础学Java 学习笔记

    韩顺平 2021零基础学Java 学习笔记(1)(自用)_丨shallow丨的博客-CSDN博客_韩顺平java笔记 韩顺平 2021零基础学Java 学习笔记(2)(自用)_丨shallow丨的博客 ...

最新文章

  1. CentOS需要安装的JAVA环境的相关软件
  2. 什么是iu组装服务器,超频三全新款 IU服务器散热器全新登场
  3. 关于MULE ESB相关的介绍
  4. jQuery的this $this $(this)
  5. 教会你Linux Shell自动交互的三种方法
  6. Android Gradle实用技巧——APK文件名中加上SVN版本号,日期等
  7. python - zipfile模块
  8. r语言和python的区别-r语言和python的详细对比
  9. 高中计算机学考操作excel,高中信息技术学业水平考试Word、Excel操作题考点总结...
  10. 如何打出日语中的叠字符号「々」
  11. 打字测试软件 tt,打字测试(TT)
  12. Unity粒子系统-粒子光环
  13. 测试音响声音啸叫软件,公共广播专业音响系统啸叫声与电流声排除方法_航天广电软件...
  14. 实践数据湖iceberg 第三十四课 基于数据湖icerberg的流批一体架构-流架构测试
  15. servletjsp入门.....韩顺平笔记
  16. Ubuntu安装flash
  17. 几本经典的云计算方面的书籍下载-电子书下载
  18. kodi 解码器 android,智能电视最强播放器—KODI常见使用技巧全方位解读
  19. DeepLabCut AI Residency
  20. 中学生用计算机的警句,初中励志名言名句大全,适合中学生的名言警句,初中生励志名言格言...

热门文章

  1. kafka消息存储机制和原理
  2. 百度网盘青春版将不限速;Win10商店上线摸鱼App;Log4j维护者:只有三个人赞助Log4j项目 | EA周报...
  3. 网络曝光华为自研操作系统“鸿蒙” (图)
  4. Python搭建开发环境
  5. 数据挖掘——了解数据
  6. Letsencrypt简单教程调整
  7. 联想小新Pad Pro 2021平板(TB-J716F) 解BL锁ROOT过程命令记录
  8. DRC设计规则设置介绍-Design Compiler(四)
  9. 使用JDK的 keytool 生成JKS,修改查看JKS信息
  10. 爱了!京东新产算法宝典在Github上爆火,成功激起了老夫的少女心!