Essential Linux Ops Interview Q&A: TCP, HTTP, Proxy, and More
A comprehensive guide to common Linux operations interview questions, covering environment variables, TCP characteristics and handshake, proxy principles, TCP vs UDP trade‑offs, OOP vs procedural programming, HTTP request flow and status codes, deadlock concepts, TCP states, and inter‑process communication mechanisms.
This article compiles common interview questions and answers for Linux operations engineers, covering environment variables, TCP characteristics, three‑way handshake, proxy implementation, TCP vs UDP, object‑oriented vs procedural programming, HTTP request process, status codes, deadlock, TCP connection states, and inter‑process communication mechanisms.
1. Linux environment variables
Temporary: export MYNAME="new name" then echo $MYNAME outputs new name.
Permanent: modify /etc/profile, e.g., export CLASSPATH=./java_HOME/lib;$JAVA_HOME/jre/lib, then run source /etc/profile to apply.
2. Characteristics of TCP connections
Connection‑oriented (client/server model)
Full‑duplex
Reliability through flow control, congestion control, and error control
Byte‑stream based
3. Why does TCP require a three‑way handshake?
Two handshakes cannot guarantee both sides have received each other's sequence numbers. The three‑step process ensures the client’s SYN is acknowledged, the server’s SYN‑ACK is acknowledged, and the client’s final ACK confirms the connection, allowing both ends to synchronize state.
4. Proxy implementation principles
Proxies are classified as HTTP, FTP, or SOCKS, and as transparent or non‑transparent. Typical workflow:
Client establishes a TCP connection to the proxy server.
Client sends a GET request containing the target URL.
Proxy resolves the URL to an IP (possibly via DNS), strips the URL, rebuilds the packet, and forwards it.
Proxy communicates with the real server using its own IP as the source.
5. TCP vs UDP advantages and disadvantages
TCP : reliable, stable, provides connection establishment, acknowledgments, flow control, congestion control, and orderly termination; drawbacks are higher latency, greater resource consumption, and susceptibility to certain attacks.
UDP : fast, lower overhead, stateless; drawbacks are lack of reliability, potential packet loss, and unsuitability for poor network conditions.
Typical use cases: TCP for HTTP/HTTPS, FTP, email (POP/SMTP); UDP for latency‑critical applications where occasional loss is acceptable.
6. Difference between object‑oriented and procedural programming
Procedural programming breaks a problem into sequential steps implemented as functions, called one after another.
Object‑oriented programming models the problem as interacting objects, focusing on behavior and responsibilities rather than step‑by‑step procedures.
7. HTTP request process and principles
HTTP is stateless and follows a request/response model:
Establish a TCP connection.
Browser sends request line.
Browser sends request headers.
Server responds.
Server sends response headers.
Server sends response body.
Server closes the TCP connection (or keeps it alive).
HTTP/1.0 defaults to short connections; HTTP/1.1 defaults to persistent (keep‑alive) connections using the header Connection: keep-alive. Persistent connections reduce the overhead of repeatedly opening and closing TCP sessions but require server‑side resource management.
8. Common HTTP status codes
2xx (Success): 200 OK, 202 Accepted, 205 No Content
3xx (Redirection): 301 Moved Permanently, 302 Found, 303 See Other, 305 Use Proxy, 307 Temporary Redirect
4xx (Client error): 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 405 Method Not Allowed, 408 Request Timeout
5xx (Server error): 500 Internal Server Error, 503 Service Unavailable
9. What is a deadlock?
A deadlock occurs when two or more processes wait indefinitely for resources held by each other.
Four necessary conditions: mutual exclusion, hold‑and‑wait, no preemption, circular wait.
Prevention methods include ordered resource allocation and the Banker's algorithm.
10. CLOSE_WAIT state
Occurs after a socket receives a FIN from the peer but has not yet sent its own FIN. It should be short‑lived; prolonged CLOSE_WAIT often indicates the application is not closing the socket after reading EOF.
11. TIME_WAIT state
Entered by the actively closing side and lasts for 2 MSL (Maximum Segment Lifetime) to ensure all delayed packets are discarded and to allow reliable termination of a full‑duplex TCP connection.
12. Inter‑process communication mechanisms
Common IPC methods: pipes, message queues, shared memory (fastest), semaphores, file mapping, anonymous/named pipes.
Signed-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.
