images\cherry_red.png1 Linux运维学习笔记
      images\cherry_blue.png1.1 基本操作命令
         images\cherry_orange.png1.1.1 权限管理
            images\cherry_cyan.png1.1.1.1 chmod
            images\cherry_cyan.png1.1.1.2 chown
            images\cherry_cyan.png1.1.1.3 setfacl
            images\cherry_cyan.png1.1.1.4 chattr
         images\cherry_orange.png1.1.2 用户管理
            images\cherry_cyan.png1.1.2.1 useradd(添加用户)
            images\cherry_cyan.png1.1.2.2 passwd(修改用户密码)
            images\cherry_cyan.png1.1.2.3 userdel(删除用户角色)
            images\cherry_cyan.png1.1.2.4 usermod(修改用户信息)
            images\cherry_cyan.png1.1.2.5 groupadd(添加工作组)
            images\cherry_cyan.png1.1.2.6 groupdel(删除工作组)
         images\cherry_orange.png1.1.3 文件管理
            images\cherry_cyan.png1.1.3.1 cat
            images\cherry_cyan.png1.1.3.2 mv
            images\cherry_cyan.png1.1.3.3 scp,rsync文件传输
               images\cherry_orange_dark.png1.1.3.3.1 scp
            images\cherry_cyan.png1.1.3.4 rz
            images\cherry_cyan.png1.1.3.5 awk
               images\cherry_orange_dark.png1.1.3.5.1 案例
            images\cherry_cyan.png1.1.3.6 cp复制
            images\cherry_cyan.png1.1.3.7 more
            images\cherry_cyan.png1.1.3.8 less
            images\cherry_cyan.png1.1.3.9 mkdir
            images\cherry_cyan.png1.1.3.10 diff
            images\cherry_cyan.png1.1.3.11 head
            images\cherry_cyan.png1.1.3.12 tail
            images\cherry_cyan.png1.1.3.13 sed
            images\cherry_cyan.png1.1.3.14 sort
            images\cherry_cyan.png1.1.3.15 uniq (去重语句)
            images\cherry_cyan.png1.1.3.16 grep
               images\cherry_orange_dark.png1.1.3.16.1 grep(2)
            images\cherry_cyan.png1.1.3.17 xargs
            images\cherry_cyan.png1.1.3.18 tr
            images\cherry_cyan.png1.1.3.19 cut
            images\cherry_cyan.png1.1.3.20 od
            images\cherry_cyan.png1.1.3.21 dos2unix
            images\cherry_cyan.png1.1.3.22 cpio
            images\cherry_cyan.png1.1.3.23 tee
            images\cherry_cyan.png1.1.3.24 column
            images\cherry_cyan.png1.1.3.25 swapon
         images\cherry_orange.png1.1.4 软件包管理
            images\cherry_cyan.png1.1.4.1 yarn
            images\cherry_cyan.png1.1.4.2 zip
         images\cherry_orange.png1.1.5 备份策略
            images\cherry_cyan.png1.1.5.1 tar
            images\cherry_cyan.png1.1.5.2 cp
      images\cherry_blue.png1.2 系统工作常用命令
         images\cherry_orange.png1.2.1 ab(压力测试)
            images\cherry_cyan.png1.2.1.1 ab常见问题
         images\cherry_orange.png1.2.2 nohup
            images\cherry_cyan.png1.2.2.1 bg fg
         images\cherry_orange.png1.2.3 crontab
         images\cherry_orange.png1.2.4 find
            images\cherry_cyan.png1.2.4.1 find
         images\cherry_orange.png1.2.5 tcpdump
         images\cherry_orange.png1.2.6 ifconfig
         images\cherry_orange.png1.2.7 netstat(网络通信情况)
         images\cherry_orange.png1.2.8 ps (查看系统进程)
         images\cherry_orange.png1.2.9 top (系统运维状态)
         images\cherry_orange.png1.2.10 alias
         images\cherry_orange.png1.2.11 pidof
         images\cherry_orange.png1.2.12 kill与killall与pkill
         images\cherry_orange.png1.2.13 uptime(系统负载信息)
         images\cherry_orange.png1.2.14 free(系统内存情况)
         images\cherry_orange.png1.2.15 last(登陆日志)
         images\cherry_orange.png1.2.16 fdisk(磁盘分区)
         images\cherry_orange.png1.2.17 strace
         images\cherry_orange.png1.2.18 lsmod
         images\cherry_orange.png1.2.19 ssh
            images\cherry_cyan.png1.2.19.1 sshpass
         images\cherry_orange.png1.2.20 ftp (sftp)
         images\cherry_orange.png1.2.21 du
         images\cherry_orange.png1.2.22 umask(文件权限)
         images\cherry_orange.png1.2.23 df (磁盘占用情况)
         images\cherry_orange.png1.2.24 curl
         images\cherry_orange.png1.2.25 date
         images\cherry_orange.png1.2.26 lsof
         images\cherry_orange.png1.2.27 chrony
         images\cherry_orange.png1.2.28 cpu运行状态
         images\cherry_orange.png1.2.29 lshw
         images\cherry_orange.png1.2.30 vim
         images\cherry_orange.png1.2.31 lsb_release -a (系统版本信息)
      images\cherry_blue.png1.3 网络基础
         images\cherry_orange.png1.3.1 ifconfig
         images\cherry_orange.png1.3.2 route
         images\cherry_orange.png1.3.3 nslookup
         images\cherry_orange.png1.3.4 ping网关
         images\cherry_orange.png1.3.5 ISO/OSI七层模型
         images\cherry_orange.png1.3.6 TCP/IP三次握手(四次挥手)
            images\cherry_cyan.png1.3.6.1 三次握手
            images\cherry_cyan.png1.3.6.2 四次挥手
         images\cherry_orange.png1.3.7 IP地址网段(可用IP地址)(广播地址)
         images\cherry_orange.png1.3.8 网络连接数
         images\cherry_orange.png1.3.9 mtr
         images\cherry_orange.png1.3.10 ip
      images\cherry_blue.png1.4 系统管理类
         images\cherry_orange.png1.4.1 进程与线程
            images\cherry_cyan.png1.4.1.1 pstree
         images\cherry_orange.png1.4.2 系统安全
            images\cherry_cyan.png1.4.2.1 记录一次远程挖矿病毒
            images\cherry_cyan.png1.4.2.2 漏洞修补
         images\cherry_orange.png1.4.3 nfs远程挂载
            images\cherry_cyan.png1.4.3.1 nfs自动挂载
         images\cherry_orange.png1.4.4 查询系统用户登录情况
         images\cherry_orange.png1.4.5 权限优化
         images\cherry_orange.png1.4.6 备份策略
         images\cherry_orange.png1.4.7 Raid(磁盘阵列)
         images\cherry_orange.png1.4.8 资源查看(监控)
            images\cherry_cyan.png1.4.8.1 dstat(网络监控)
         images\cherry_orange.png1.4.9 启动流程
         images\cherry_orange.png1.4.10 系统优化
         images\cherry_orange.png1.4.11 cpu
      images\cherry_blue.png1.5 Shell编程
         images\cherry_orange.png1.5.1 数组类型
         images\cherry_orange.png1.5.2 if 条件判断
         images\cherry_orange.png1.5.3 for
         images\cherry_orange.png1.5.4 文本截取
         images\cherry_orange.png1.5.5 随机字符串
         images\cherry_orange.png1.5.6 网站检测
            images\cherry_cyan.png1.5.6.1 nmap
         images\cherry_orange.png1.5.7 Debug
         images\cherry_orange.png1.5.8 declare
      images\cherry_blue.png1.6 网络服务类
         images\cherry_orange.png1.6.1 网关
         images\cherry_orange.png1.6.2 SSH服务
         images\cherry_orange.png1.6.3 DHCP + FTP
         images\cherry_orange.png1.6.4 DNS服务
            images\cherry_cyan.png1.6.4.1 智能DNS
         images\cherry_orange.png1.6.5 Apache配置
            images\cherry_cyan.png1.6.5.1 Apache 三种工作模式
         images\cherry_orange.png1.6.6 Apache优化
            images\cherry_cyan.png1.6.6.1 CDN
         images\cherry_orange.png1.6.7 Nginx配置
            images\cherry_cyan.png1.6.7.1 nginx开启SSL证书
            images\cherry_cyan.png1.6.7.2 Session一致性解决方案
            images\cherry_cyan.png1.6.7.3 异步非阻塞方式
            images\cherry_cyan.png1.6.7.4 Nginx反向代理配置出现问题
            images\cherry_cyan.png1.6.7.5 nginx 负载均衡算法
            images\cherry_cyan.png1.6.7.6 nginx status
         images\cherry_orange.png1.6.8 Nginx优化
            images\cherry_cyan.png1.6.8.1 Nginx请求PHP(Tomcat)过程
            images\cherry_cyan.png1.6.8.2 gzip压缩
            images\cherry_cyan.png1.6.8.3 缓存优化
            images\cherry_cyan.png1.6.8.4 反向代理
         images\cherry_orange.png1.6.9 http状态码
      images\cherry_blue.png1.7 数据库管理类
         images\cherry_orange.png1.7.1 集群部署(Amoeba)
         images\cherry_orange.png1.7.2 索引
         images\cherry_orange.png1.7.3 误操作Drop语句如何解决?
         images\cherry_orange.png1.7.4 Redis(缓存数据库)
            images\cherry_cyan.png1.7.4.1 Redis_
      images\cherry_blue.png1.8 Good Luck
      images\cherry_blue.png1.9 Linux(实际工作可能常用命令)
      images\cherry_blue.png1.10 LeetCode(Bash)
         images\cherry_orange.png1.10.1 统计词频
         images\cherry_orange.png1.10.2 有效电话号码
   images\cherry_red.png2 三剑客
      images\cherry_blue.png2.1 正则表达式
         images\cherry_orange.png2.1.1 扩展正则表达式
      images\cherry_blue.png2.2 grep(...过滤)
      images\cherry_blue.png2.3 sed(...替换)
         images\cherry_orange.png2.3.1 sed删除,增加
         images\cherry_orange.png2.3.2 sed 替换
      images\cherry_blue.png2.4 awk(...取列统计)
         images\cherry_orange.png2.4.1 awk模式匹配
         images\cherry_orange.png2.4.2 awk数组
☐ 匹配一些有规律的东西
☐ 使用一些符号表达重复出现,大小写,开头/结尾含义

images\116-1.png

应用场景: 过滤有规律的内容,日志分析等


1. 正则注意事项

• 所有的符号英文符号
• 学习正则,通过grep命令学习,grep加上单引号
• 注意系统的字符集格式
• grep,egrep 加上颜色 alias grep='grep --color=auto' alias egrep='egrep --color=auto'
• 配合参数进行学习 例如 grep -o


正则符号
基础正则 ^ $ ^$ . *.* [a-z] [^abc]
扩展正则 + | () {} ?


正则 VS 通配符
正则(re)高级匹配,进行过滤(匹配字符) grep,sed,awk,find,rename(ubuntu),expr

通配符 (pathname extension 或 glob)Linux下面大多数命令


cat -A 显示隐藏的符号

☐ ^ 以...开头的行
☐ $ 以...结尾的行
☐ ^$ 空行, 表示这一行没有任何内容(空格也表示一个符号!)一般是排除文件中的空行
images\116-2.png


☐ .(点) 表示任何一个字符,不匹配空行
☐ \ 转义字符: 去除原有特殊含义,(转义字符序列) \n 回车换行 \t tab键
☐ * 前一个字符连续出现0次或0次以上 (0* 2* ! 连续表示出现 0次或者0次以上!
☐ .* 所有内容,任何任意内容 正则表达式的贪婪性,.*连续出现的时候,表现出尽可能的贪婪性
☐ 【】 【abc】1次匹配一个字符,匹配一次(a,或者b,或者c 一次)【a-z】【A-Z】【a-Z0-9】(匹配大小写加字符)
【】中括号里面的内容会被去掉特殊含义!!
【^abc】取反排除,表示处理a,或b,或c以外的字符