随笔分类 -  系统运维_CentOS7运维笔记

摘要:linux文件同步工具-rsync [root@centos7 tmp]# yum install -y rsync rsync可以增量的同步,只同步变更的文件 把/etc/passwd 同步到/tmp/1.txt 可以同步实时变更的文件 rsync -av /etc/passwd /tmp/1.t 阅读全文
posted @ 2018-01-31 02:19 zhaocundang 阅读(461) 评论(0) 推荐(0) 编辑
摘要:linux任务计划 任务计划:特定时间备份数据,重启服务,shell脚本,单独的命令等等。 任务计划配置文件:cat /etc/crontab [root@centos7 ~]# cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/ 阅读全文
posted @ 2018-01-30 05:37 zhaocundang 阅读(433) 评论(0) 推荐(0) 编辑
摘要:iptables规则备份和恢复 保存和备份iptables规则Service iptables save //会把规则保存到/etc/sysconfig/iptables把iptables规则备份到my.ipt文件中Iptables-save > my.ipt恢复刚才备份的规则iptables-re 阅读全文
posted @ 2018-01-27 02:05 zhaocundang 阅读(386) 评论(0) 推荐(0) 编辑
摘要:案例1:把80端口,22端口,21端口放行 22端口指定IP访问,其它IP拒绝。 shell脚本实现: [root@centos7 ~]# vim /usr/local/sbin/iptables.sh #!/bin/sh ipt="/usr/sbin/iptables" #定义ipt 变量,绝对路 阅读全文
posted @ 2018-01-26 05:02 zhaocundang 阅读(285) 评论(0) 推荐(0) 编辑
摘要:Linux网络相关 Linux网络相关 ifocnfig 查看网卡ip(yum install net-tools) ip add 查看网卡 ip add = ifocnfig ifconfig 不显示down掉的网卡,只显示正在工作的网卡。 ifconfig -a 显示当前正在使用的网卡和down 阅读全文
posted @ 2018-01-25 00:26 zhaocundang 阅读(219) 评论(0) 推荐(0) 编辑
摘要:iostat sysstat 包里面包括 sar 和 iostat [root@centos7 ~]# iostat Linux 3.10.0-693.2.2.el7.x86_64 (centos7.4) 2018年01月23日 _x86_64_ (1 CPU) avg-cpu: %user %ni 阅读全文
posted @ 2018-01-23 22:54 zhaocundang 阅读(207) 评论(0) 推荐(0) 编辑
摘要:w/uptime 查看系统负载 w查看系统负载,uptime跟w一样。 [root@centos7 ~]# w 22:34:10 up 6 days, 23:10, 4 users, load average: 0.00, 0.01, 0.05 USER TTY FROM LOGIN@ IDLE J 阅读全文
posted @ 2018-01-23 01:00 zhaocundang 阅读(401) 评论(0) 推荐(0) 编辑
摘要:以冒号: 为分隔符打印出来;打印第一段1; -F 分隔符 [root@localhost awk]# awk -F ':' '{print $1}' test.txt root bin daemon adm lp sync 打印所有的段0 [root@localhost awk]# awk -F 阅读全文
posted @ 2018-01-18 00:16 zhaocundang 阅读(1121) 评论(0) 推荐(0) 编辑
摘要:sed 能实现grep查找的功能,还可以替换指定的字符。 匹配查找文件中root字符(其中的 -n表示段落,p表示打印出来print) [root@localhost sed]# sed -n '/root/'p test.txt root:x:0:0:root:/root:/bin/bash op 阅读全文
posted @ 2018-01-16 22:27 zhaocundang 阅读(491) 评论(0) 推荐(0) 编辑
摘要:什么是正则: 正则就是一串有规律的字符串。 正则三剑客: grep/egrep (egrep是grep的扩展),sed, awk grep grep过滤指定关键词 [root@localhost grep]# grep 'nologin' passwd -c 行数 [root@localhost g 阅读全文
posted @ 2018-01-15 22:21 zhaocundang 阅读(208) 评论(0) 推荐(0) 编辑
摘要:shell特殊符号cut命令 特殊符号 * 通配符,任意个任意字符 ? 任意一个字符 # 注释字符 \ 脱义字符 c=$a$b echo $c | 管道符 cat 1.txt |less cat 1.txt |more cut 截取字符串 显示头2行 cat /etc/passwd |head 阅读全文
posted @ 2018-01-12 19:12 zhaocundang 阅读(316) 评论(0) 推荐(0) 编辑
摘要:8.6 管道符和作业控制 8.7/8.8 shell变量 8.9 环境变量配置文件 管道符和作业控制 管道符:表示把一个文件的输出内容传送到后面的命令 grep 用来过滤指定关键词的命令 “|” 为管道符 ls | wc -l 统计当前路径下文件的个数 [root@localhost xiaobo] 阅读全文
posted @ 2018-01-12 01:19 zhaocundang 阅读(258) 评论(0) 推荐(0) 编辑
摘要:8.1 shell介绍 8.2 命令历史 8.3 命令补全和别名 8.4 通配符 8.5 输入输出重定向 什么是shell? shell是一个命令解释器,提供用户和及其之间的交互 致辞特定语法,比如逻辑判断、循环 每个用户都可以有自己特定的shell CentOS7默认shell为bash (Bou 阅读全文
posted @ 2018-01-11 00:42 zhaocundang 阅读(144) 评论(0) 推荐(0) 编辑
摘要:7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装 yum更换国内源 cd /etc/yum.repo.d/ 删除源 rm -f dvd.repo rm -f CentOS-Base.repo 自己编辑一个源或者下载一个源文件: curl -O http://mirro 阅读全文
posted @ 2018-01-10 00:02 zhaocundang 阅读(282) 评论(0) 推荐(0) 编辑
摘要:7.1 安装软件包的三种方法 7.2 rpm包介绍 7.3 rpm工具用法 7.4 yum工具用法 7.5 yum搭建本地仓库 三种方法 rpm工具 >类型windows下的exe程序 yum 工具 >可以解决rpm之间的依赖关系,自动安装包 源码包 >程序的源代码,但是需要编译器编译,编译成可执行 阅读全文
posted @ 2018-01-09 00:25 zhaocundang 阅读(187) 评论(0) 推荐(0) 编辑
摘要:6.5 zip压缩工具 6.6 tar打包 6.7 打包并压缩 zip压缩工具 zip压缩工具 xz,bzip2,gzip都不支持压缩目录 zip可以压缩目录 压缩文件 zip 2.txt.zip 2.txt [root@localhost ~]# zip 2.txt.zip 2.txt addin 阅读全文
posted @ 2018-01-07 22:08 zhaocundang 阅读(3999) 评论(0) 推荐(1) 编辑
摘要:5.5 进入编辑模式 5.6 vim命令模式 5.7 vim实践 5.5 进入编辑模式 5.6 vim命令模式 5.7 vim实践 进入编辑模式 小写i在当前字符前插入 大写I 在光标所在行的行首插入 大写O 在光标上面一行插入编辑 小写o在光标下面一行插入编辑 小写a 在光标后面插入写(a是aft 阅读全文
posted @ 2018-01-04 22:30 zhaocundang 阅读(321) 评论(0) 推荐(0) 编辑
摘要:5.1 vim介绍 5.2 vim颜色显示和移动光标 5.3 vim一般模式下移动光标 5.4 vim一般模式下复制、剪切和粘贴 vim 是vi的升级版本 vim 带有颜色显示 安装vim : yum install -y vim-enhanced vim分三种模式:一般模式、编辑模式、命令模式 一 阅读全文
posted @ 2018-01-03 18:51 zhaocundang 阅读(431) 评论(0) 推荐(0) 编辑
摘要:4.10/4.11/4.12 lvm讲解 4.13 磁盘故障小案例 lvm讲解 lvm讲解 磁盘故障小案例 磁盘故障小案例 阅读全文
posted @ 2018-01-02 21:15 zhaocundang 阅读(187) 评论(0) 推荐(0) 编辑
摘要:4.5/4.6 磁盘格式化 4.7/4.8 磁盘挂载 4.9 手动增加swap空间 磁盘格式化 查看centos7支持的文件系统格式 cat /etc/filesystem,centos7默认的文件系统格式xfs centos7根/和boot就是xfs centos6:ext4 之前的版本:ext3 阅读全文
posted @ 2017-12-29 19:55 zhaocundang 阅读(459) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示