一、有文件file1 1、查询file1 里面空行的所在行号 awk ‗{if($0~ /^$/)print NR}‘ file or grep -n ^$ file |awk ‗BEGIN{FS=‖:‖}{print $1}‘ 2、查询file1 以abc 结尾的行 grep abc$ file1 3、打印出file1 文件第1 到第3 行 sed -n ‘1,3p‘ file1 head -3 file1 二、如何将本地80 端口的请求转发到8080 端口,当前主机IP 为192
1 Iptables -A PREROUTING -d 192
1 -p tcp -m tcp –dport 80 -j DNAT –to-destination 192
1:8080 三、crontab 在11 月份内,每天的早上6 点到12 点中,每隔2 小时执行一次/usr/bin/httpd
sh 怎么 实现 0 6-12/2 * 11 * /usr/bin/httpd
sh 四、编写个shell 脚本将/usr/local/test 目录下大于100K 的文件转移到/tmp 目录下 #
/bin/bash for file in `ls /root` do if [ -f $file ]; then if [ `ls -l $file|awk '{print $5}'` -gt 10000 ]; then mv $file /tmp/ fi fi done 五、简述raid0 raid1 raid5 三种工作模式的工作原理及特点
RAID 0:连续以位或字节为单位分割数据,并行读/写于多个磁盘上,因此具有很高的数据 传输率,但它没有数据冗余,因此并不能算是真正的RAID 结构
RAID 0 只是单纯地提高 性能,并没有为数据的