面试题大全,快来分享哦!
33.用shell编程,判断一文件是不是字符设备文件,如果是将其拷贝到/dev目录下?
参考答案:
#!/bin/bash
directory=/dev
for file in anaconda ks.cfg install.log install.log.syslog
do
if [ f $file ]
then
cp $file $directory/$file.bak
echo " HI, $LOGNAME $file is backed up already in $directory !!"
fi
done
34、简述Apache两种工作模式,以及它们之间的区别。
答案:最主要的两种模式是prefork模式与worker模式。prefork每个子进程只有一个线程,效率高但消耗内存大,是unix下默认的模式;worker模式每个子进程有多个线程,内存消耗低,但一个线程崩溃会牵连其它同子进程的线程。
35、用iptables 添加一个规则允许192.168.0.123访问本机3306端口 iptables I INPUT 1 p tcp m tcp dport 3306 s 192.168.0.123 j ACCEPT
36、修改第一块网卡的路径是什么。
/etc/sysconfig/network-scripts/ifcfg eth0
37、使用shell,建立class1用户组,再批量建立stu1 stu30的用户,并指定用户组为
class1。
vi autoaddusr
#!/usr/bin/php q
<?php
exec("groupadd class1");
for($i=1; $i<=30; $i++){
exec("useradd G class1 stu".$i);
}
?>
chmod +x autoaddusr
./autoaddusr
38、个人对该工作的未来如何规划,需要加强哪些能力。