天天看點

linux運維12k面試題目帶答案分享

使用grep找出/etc/passwd檔案中以root開頭以bash結尾的行,并顯示行号

使用find查找/usr/最近7天修改過的檔案複制到/dir

把/etc/passwd的第1-3行内容另存 testx.txt

grep -n ‘^root.*bash’ /etc/passwd

find /usr/ -type f +mtime +7 -name ‘*’ |xargs -i cp{}/dir/;

sed -n ‘1,3p’ /etc/passwd >>test.txt

  1. Nginx反向代理配置,此類url www.jkkcss.cn/refuse,禁止通路,傳回403

    location www.jkkcss.cn/refse {

    return 403:

    }

  2. 如何使用iptables将本地80端口的請求轉發到8081端口,目前主機IP為192.168.10.1,其中本地網卡eth0:

    iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 8081 -j DNAT --to 192.168.10.1:80

  3. 如何檢視Linux系統目前的狀态,cpu記憶體的使用情況及負載

    top

    free -h

  4. nginx如何重定義或者添加發往後端伺服器的請求頭

    headers-more-nginx-module 子產品用于添加,修改,或者清除 請求/響應頭

    more_set_headers 用于添加、修改、清除響應頭

    more_clear_headers 用于清除響應頭

    more_set_input_headers 用于添加、修改、清除請求頭

    more_clear_input_headers 用于清除請求頭

    </

繼續閱讀