1.查找/var目录下不属于root、lp、gdm的所有文件
find /var -not \( -user root -o -user lp -o -user gdm \)
2.统计/etc/init.d/functions文件中每个单词的出现次数,并排序(grep和sed2中方法实现)
egrep -o "[[:alpha:]]+" /etc/init.d/functions |sort -n|uniq -c
sed -r "s/[^[:alpha:]]+/\n/g" /etc/init.d/functions |sort -n|uniq -c
3.利用sed取出ifconfig命令中本机IPv4地址
ifconfig ens33| sed -rn "s/(^.*inet )(.*) net.*$/\2/p"
192.168.224.128
4.总结yum的配置和使用,包括yum仓库的创建
yum install 包名 安装包
yum remove 包名 卸载包
yum clean 清除yum缓存
yum makecache 构建缓存
yum history 安装历史事件
[base]
name=CentOS
baseurl=file:///misc/cd
https://mirrors.aliyun.com/centos/$releasever/os/$basearch
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[epel]
name=EPEL
baseurl=https://mirrors.aliyun.com/epel/$releasever/$basearch
https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/$basearch
gpgchek=0
enabled=1
5.编写系统初始化脚本reset.sh。包括别名,提示符颜色,yum仓库配置文件
alias cdnet='cd /etc/sysconfig/network-scripts/'
PS1="\[\e[1;32m\][\u@\h \w]\\$\[\e[0m\]"
mkdir -p /etc/yum.repos.d/yum.bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/yum.bak
touch /etc/yum.repos.d/Base.repo
cat>/etc/yum.repos.d/Base.repo<<EOF
[base]
name=CentOS
baseurl=file:///misc/cd
https://mirrors.aliyun.com/centos/$releasever/os/$basearch
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
> EOF
6.安装tree,lftp,telnet等包
yum install yum -y
yum install lftp -y
yum install telnet -y
7.在centos7上编译安装apache2.4源码包,并启动此服务