Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

面試常出現的 10 個 Linux 實務問題與解答

面試常出現的 10 個 Linux 實務問題與解答

1. 日常備份是壓縮格式,現在要查兩個月前的某份日誌,如何在不解壓的前提下完成?

答案:用 zcat,它可以直接讀取 gzip 壓縮檔的內容。

# zcat phpshell-2.4.tar.gz

2. 要追蹤系統中發生的事件,該怎麼做?

答案:靠 syslogd 這個背景常駐程式。它負責收集系統訊息並寫入指定日誌檔,產生的檔案位於 /var/log/syslog,是排查 Linux 問題時最有用的線索之一。

面試常出現的 10 個 Linux 實務問題與解答

3. 如何禁止特定 IP 訪問 FTP 伺服器?

答案:用 tcp wrapper。先在 /etc/vsftpd.conf 中把 tcp_wrapper=YES 打開,再把可疑 IP 寫進 /etc/host.deny:

# vi /etc/hosts.deny
#
# hosts.deny  This file contains access rules which are used to
# deny connections to network services that either use
# the tcp_wrappers library or that have been
# started through a tcp_wrappers-enabled xinetd.
#
vsftpd:172.16.16.1

4. Telnet 與 SSH 的差別?

答案:兩者都是遠端管理協議,但 Telnet 明文傳輸資料,SSH 在通訊前需要交換密鑰並全程加密,因此 Telnet 的安全性遠不如 SSH。

5. 要終止 X server,但殺行程時收到無法結束的錯誤訊息,怎麼辦?

答案:X server 無法像一般服務那樣用 /etc/init.d/gdm stop 正常結束,需要按下特殊的按鍵組合 Ctrl + Alt + BackSpace 讓它重啟。

6. ping 與 ping6 的差別?

答案:功能相同,但 ping6 用於 IPv6 位址。

7. 要在家目錄找出所有 *.tar 並一次刪除?

答案:find 搭配 xargs。

# find /home/ -name '*.tar' | xargs rm -rf

8. locate 與 slocate 的差別?

答案:slocate(secure locate)只搜尋該使用者有權限訪問的檔案,locate 則會搜尋資料庫中所有已更新的結果。

9. 要在當前目錄所有 .txt 檔中搜尋「Tecmint」這個字串?

答案:用 find 搭配 xargs 與 grep 遞迴搜尋。

# find -name "*.txt" | xargs grep "Tecmint"

10. 要向所有已連線的使用者廣播「Server is going down for maintenance」?

答案:用 wall 指令。

# echo please save your work, immediately. The server is going down for Maintenance at 12:30 Pm, sharply. | wall

面試常出現的 10 個 Linux 實務問題與解答


via: https://www.tecmint.com/useful-random-linux-interview-questions-and-answers/

譯者:ThomazL 校對:wxy 本文由 LCTT 原創翻譯,Linux 中國 榮譽推出

Copyright © Linux教程網 All Rights Reserved