当前位置:网站首页>shell-第八章练习
shell-第八章练习
2022-07-25 10:28:00 【weixin_51808099】
1、删除/etc/grub2.conf文件中所有以空白开头的行行首的空白字符
[[email protected] zuoye]# sed 's/^ *//' /etc/grub2.cfg
2、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
[[email protected] zuoye]# sed -r 's/^# +//' /etc/fstab
3、在/root/install.log每一行行首增加#号
[[email protected] zuoye]# sed 's/^./#&/' hostip
4、在/etc/fstab文件中不以#开头的行的行首增加#号
[[email protected] zuoye]# sed 's/^[^#]/#&/' /etc/fstab
5、利用sed 取出ifconfig命令中本机的IPv4地址
[[email protected] zuoye]# ifconfig |grep ens224 -1|sed -n 3p| sed -r "s/.*inet[[:space:]]*//" | sed -r "s/[[:space:]]*netmask.*//"
6、关闭本机SELinux的功能
[[email protected] zuoye]# sed 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config
7、在/etc/hosts配置文件中添加内容
[[email protected] zuoye]# sed '1 a\sy' /etc/passwd
边栏推荐
- Reinforcement Learning 强化学习(四)
- TPS calculation in performance test [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]
- SQL语言(六)
- 企业实践开源的动机
- MySQL advanced statement (I) (there is always someone who will make your life no longer bad)
- HDD杭州站全程体验有感
- mysql主从复制与读写分离
- 史上最全的立创元器件封装库导入AD详细教程(一直白嫖一直爽)
- PostgreSQL踩坑 | ERROR: operator does not exist: uuid = character varying
- [树] 100. 相同的树
猜你喜欢
随机推荐
From the perspective of open source, analyze the architecture design of SAP classic ERP that will not change in 30 years
最详细的mysql索引解析(文末附赠思维导图)
100W了!
Learn NLP with Transformer (Chapter 3)
Understand the life cycle and route jump of small programs
Shell 脚本参数传递时有 \r 换行符问题
Disabled and readonly and focus issues
Learn NLP with Transformer (Chapter 6)
用Unity不会几个插件怎么能行?Unity各类插件及教程推荐
PostgreSQL踩坑 | ERROR: operator does not exist: uuid = character varying
Tree dynamic programming
接口流量突增,如何做好性能调优?
爬虫基础一
Reinforcement learning (III)
【flask高级】结合源码详解flask的运行机制(出入栈)
Learning Weekly - total issue 63 - an open source local code snippet management tool
STM32CubeMX学习记录--安装配置与使用
Redis sentry, high availability executor
MySQL | GROUP_CONCAT函数,将某一列的值用逗号拼接
How to notify users of wechat applet version update?








