运维岗位面试题-大智慧

大智慧(互联网金融领域 )运维岗位面试题html


试题转至:http://www.tiejiang.org/17116.htmlmysql


一、显示/test目录下的全部目录面试

 答案:ls |find . -type d -maxdepth 1    (只显示一级)sql

    ls -F | grep "/$"            (-F 若是目录,结尾跟符号/)shell

    ls -l |grep '^d' |awk '{print $9}'    (过滤出‘d’开头的行)数据库


二、将文件/etc/a 下中除了 b文件外的全部文件压缩打包放到/home/a下,名字为a.gzwindows

 方法一:bash

    cd /etc/a     网络

    for i in `ls |grep -v "b"`;do  tar -rvf /home/a/a.tar.gz $i;done  (-r追加)运维

 方法二:

    tar --exclude /etc/a/b -zPcvf /home/a/a.gz /etc/a    (--exclude排除指定文件)


三、给一个脚本赋予执行权限的命令及选项

    答:chmod 


四、umask022表明什么意思

    答:建立文件是,文件的权限为666-umask的值

            目录的权限为777-umask的值


五、如何查看test进程所打开的全部文件

    答:lsof -c  test

  扩展:

    1)查看谁正在使用某个文件

    lsof   /filepath/file

    

    2)列出谁在使用某个端口

    lsof -i :3306

测试

root@vmUbu:/home/dell/shell# lsof /home/dell/shell
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
bash    58890 root  cwd    DIR    8,1     4096 6029645 /home/dell/shell
lsof    58957 root  cwd    DIR    8,1     4096 6029645 /home/dell/shell
lsof    58958 root  cwd    DIR    8,1     4096 6029645 /home/dell/shell


root@vmUbu:/home/dell/shell# lsof -i :22
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
sshd      930 root    3u  IPv4  19254      0t0  TCP *:ssh (LISTEN)
sshd      930 root    4u  IPv6  19256      0t0  TCP *:ssh (LISTEN)
sshd    58810 root    3u  IPv4 197435      0t0  TCP 192.168.142.132:ssh->192.168.142.1:20728 (ESTABLISHED)
sshd    58874 dell    3u  IPv4 197435      0t0  TCP 192.168.142.132:ssh->192.168.142.1:20728 (ESTABLISHED)


六、获取eth0网卡上80端口的数据包信息

    答:tcpdump port 80

测试

root@vmUbu:/home/dell/shell# tcpdump port 22
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
21:34:50.580888 IP 192.168.142.132.ssh > 192.168.142.1.20728: Flags [P.], seq 2769795073:2769795269, ack 2189754246, win 255, length 196
21:34:50.780363 IP 192.168.142.1.20728 > 192.168.142.132.ssh: Flags [.], ack 196, win 255, length 0
21:34:51.624393 IP 192.168.142.132.ssh > 192.168.142.1.20728: Flags [P.], seq 196:376, ack 1, win 255, length 180
21:34:51.624647 IP 192.168.142.132.ssh > 192.168.142.1.20728: Flags [P.], seq 376:524, ack 1, win 255, length 148
21:34:51.624842 IP 192.168.142.1.20728 > 192.168.142.132.ssh: Flags [.], ack 524, win 253, length 0
^C
5 packets captured
10 packets received by filter
0 packets dropped by kernel
root@vmUbu:/home/dell/shell#


七、删除 /a/b下的全部文件及目录

    答:mkdir -p /tmp/a/b ; mv /a/b/* /tmp/a/b/ 

            (有经验的运维人员,必定要给本身“留一手”,不要直接用rm)

      rm /tmp/a/b/*

八、经常使用的网络管理工具(5种以上)

    答:

        ifconfig

        ip

        ping

        traceroute

        nslookup

        curl

        netstat

        lsof

        

九、ftp、https、smtp、pops、ssh的端口号

    答:

        ftp 20,21    21控制,20数据

        https 443

        stmp 25

        pops 110

        ssh 22


十、如何在windows server 2003/2008上开启支持内存3-4G

    答:略


十一、请用iptables控制来自192.168.1.2主机的80端口请求

    答:

    iptables  -A INPUT -p tcp -s 192.168.1.2 --dport 80 -j ACCEPT (容许)

    iptables  -A INPUT -p tcp -s 192.168.1.2 --dport 80 -j REJECT (拒绝)

    iptables  -A INPUT -p tcp -s 192.168.1.2 --dport 80 -j DROP (拒绝)

    iptables  -A INPUT -p tcp -s 192.168.1.2 --dport 80 -j LOG  (容许,并记录日志)

          


十二、请用shell脚本建立一个组class、一组用户,用户名为stdX X从01-30,并归属class组

    答:

    groupadd class

    for i in {1..30};do useradd -g class std$i;done


1三、在mysql客户端查询工具中,如何获取当前的全部链接进程信息

    答:

    mysql>show full processlist;


1四、如何删除已满的数据库日志信息

    答:

    方法一:在my.cnf中的[mysqld]段下面加入:

        expire-logs-days=7    (设置自动清除7天钱的logs)

        重启mysql;

     方法二:登陆进mysql,

        执行:

        purge binary logs to 'mysql-bin.000003';           

        (删除mysql-bin.000003以前的而没有包含mysql-bin.000003)

相关文章
相关标签/搜索