1、查找/var目录下不属于root、lp、gdm的所有文件
find /var -not \( -user root -o -user lp -o -user gdm \) -ls
2、统计/etc/init.d/functions文件中每个单词的出现次数,并排序(用grep和sed两种方法分别实现)
cat /etc/init.d/functions | sed -r 's@[^[:alpha:]]+@\n@g' | sort | uniq -c | sort -n
grep-Eo"[[:alpha:]]+"/etc/init.d/functions |sort|uniq-c
3、利用sed取出ifconfig命令中本机的IPv4地址
ifconfig ens33 | sed -n '2p' | sed 's@.*inet @@' | sed 's@ netmask.*$@@'
ifconfig ens33 | sed -rn '2s/.*t (.*) net.*/\1/p'
ifconfig | sed -rn "s/.*inet (.*)netmask.*/\1/p" | head -n1
4、总结yum的配置和使用,包括yum仓库的创建
客户端配置文件指定对应服务器访问方式如下几种
yum install 安装
yum groupinstall 组安装
yum remove 卸载
yum groupremove 组卸载
yum list 显示所有包
yum clean all 清除缓存
yum makecache 建立缓存
建立yum服务器:
mkdir /mnt/cdrom
mount /dev/sr0 /mnt/cdrom
vim /etc/yum.repos.d/base.repo
[base]
name=centos
baseurl=file:///mnt/cdrom
gpgcheck=0
yum install httpd -y
systemctl start httpd
mkdir -pv centos/{6,7}/os/x86-64/
mount /dev/sr0 /var/www/html/cetos/7/os/x86-64/
mount /dev/sr0 /var/www/html/cetos/6/os/x86-64/
配置yum客户端
cat /etc/yum.repos.d/base.repo
[base]
name=centos
baseurl=http://yum服务器ip/centos/releasever/os/releasever/os/releasever/os/basearch
gpgcheck=0
5、编写协调初始化脚本reset.sh、包括别名、提示符颜色、yum仓库配置文件
6、安装tree、lftp、telnet等包
yum -y install tree lftp telnet
7、在Centos7上编译安装apache2.4源码包,并启动此服务
yum groupinstall "Development tools"
yum -y install apr-devel apr-util-devel openssl-devel pcre-devel
useradd -r(系统账号) -u(指定用户ID账号) 80 -d(指定家目录) /data/www/ -s /sbin/nologin apache
tar xf httpd-2.4.23.tar.bz2
./configure --prefix=/usr/local/apache
make && make install
echo 'PATH=/app/httpd/bin:$PATH' > /etc/profile.d/httpd.sh (放入PATH变量)
. /etc/profile.d/httpd.sh 使PATH变量生效
apachectl start
vim /etc/man_db.conf 添加一个MANPATH /app/httpd/man