1、查找/var目录下不属于root、lp、gdm的所有文件
find /var -not -user root lp gd
2、统计/etc/init.d/functions文件中每个单词的出现次数,并排序(用grep和sed两种方法分别实现)cat /etc/init.d/functions |tr -c 'a-zA-Z' ' '|tr -s ' ' '\n'|sort|uniq -c
grep -o '[[:alpha:]+]' /etc/init.d/functions |sort|uniq -c
cat /etc/init.d/functions|sed -r 's/[^a-zA-Z]/\n/g'|sort|uniq -c|sed -n '1!p'
3、利用sed取出ifconfig命令中本机的IPV4地址
ip addr show eth0|sed -rn 's#(.inet )(.)/.*#\2#p'
4、总结yum的配置和使用包括yum仓库的创建
yum仓库可以有https、http、ftp、和本地文件源
yum仓库配置文件必须在/etc/yum.repod文件夹下面以.repo文件结尾
[base]
name=base
baseurl=file:///mnt/
#安装包路径
gpgcheck=0 #是否验证
enable=1
5、编写系统初始化脚本reset.sh ,包括别名,提示符颜色,yum仓库配置文件
vim reset.sh
#!/bin/bash
cat > /etc/yum.repos.d/httpd.repo <<EOF
[base]
name=cdrom
baseurl=file:///mnt/
gpgcheck=0
EOF
PS1="[\e[1;33m][\u@\h \W]\$[\e[0m]"
alias nt='cd /etc/sysconfig/network-scripts/'
6、安装tree、ftp、lftp,telnet等包
yum -y install tree ftp lftp telnet
7、在centos7上编译安装apache2.4源码包,并启动此服务
useradd -r -u 80 -d /data/www/ -s /sbin/nologin httpd
tar xf httpd-2.4.25.tar.bz2
cd httpd-2.4.25
./configure --prefix=/app/httpd --sysconfdir=/etc/httpd24 --enable-ssl --disable-status
make && make install
echo 'PATH=/app/httpd/bin:$PATH' > /etc/profile.d/httpd.sh
. /etc/profile.d/httpd.sh
systemctl start httpd
转载于:https://blog.51cto.com/14201372/2378749