Top Linux Ops Interview Questions with Ready‑to‑Use Scripts
Explore essential Linux operations interview topics—including key Nginx modules, load‑balancing architectures, network connection checks, file‑descriptor tuning, traffic analysis with tcpdump, IP discovery scripts, log‑retention strategies, system hardening tips, SecureCRT shortcuts, and a nightly backup cron job—all with ready‑to‑run command examples.
31. Commonly used Nginx modules and their purposes
rewrite – URL rewriting
access – source control
ssl – encryption
ngx_http_gzip_module – compression
ngx_http_proxy_module – proxy
ngx_http_upstream_module – backend server list
ngx_cache_purge – cache purge
32. Typical web‑server load‑balancing architectures
Nginx
HAProxy
Keepalived
LVS
33. Checking HTTP concurrent requests and TCP connection states
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'Use ulimit -n to view the maximum open file descriptors (default 1024). Increase limits by editing /etc/security/limits.conf:
soft nofile 10240
hard nofile 10240Reboot for changes to take effect.
34. Find the IP address that accessed port 80 most frequently
tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr | head -2035. Bash script to list online IPs in 192.168.1.0/24
for ip in $(seq 1 255); do
ping -c 1 192.168.1.$ip > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo 192.168.1.$ip UP
else
echo 192.168.1.$ip DOWN
fi
done & wait36. Keep only the latest 7 days of Apache logs in /app/logs
One approach is to delete files older than seven days:
find /app/logs -type f -mtime +7 -exec rm -f {} \;37. General Linux system hardening tips
Create non‑root users and grant sudo privileges
Change default SSH port and disable root remote login
Enable automatic time synchronization
Use domestic yum mirrors
Disable SELinux and iptables (unless external access is needed)
Increase file descriptor limits
Trim unnecessary startup services (crond, rsyslog, network, sshd)
Tune kernel parameters via /etc/sysctl.conf Prefer English locale to avoid encoding issues
Lock critical system files
Clear /etc/issue to hide OS version on login screen
38. Extract the IP address of eth0 using cut (alternatives with awk or sed )
# cut method
ifconfig eth0 | sed -n '2p' | cut -d ':' -f2 | cut -d ' ' -f1
# awk method 1
ifconfig eth0 | awk 'NR==2' | awk -F ':' '{print $2}' | awk '{print $1}'
# awk with multiple delimiters
ifconfig eth0 | awk 'NR==2' | awk -F '[: ]+' '{print $4}'
# sed method
ifconfig eth0 | sed -n '/inet addr/p' | sed -r 's#^.*addr:\([^ ]*\).*#\1#'39. SecureCRT shortcut keys and their functions
Ctrl +a – move cursor to line start
Ctrl +e – move cursor to line end
Ctrl +c – terminate current program
Ctrl +d – delete character under cursor or exit if at end
Ctrl +l – clear screen
Ctrl +u – cut text before cursor
Ctrl +k – cut text after cursor
Ctrl +y – paste previously cut text
Ctrl +r – search command history
Tab – command or path completion
Ctrl +Shift +c – copy
Ctrl +Shift +v – paste
40. Cron job to backup /var/www/html nightly with timestamped archive
# a.sh
#!/bin/bash
cd /var/www/ && /bin/tar zcf /data/html-$(date +%m-%d%H).tar.gz html/
# crontab entry
0 0 * * * /bin/sh /root/a.shSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
