What is piping in Linux?
Why Interviewers Ask This
Mid-level Linux / Shell Scripting roles require deep understanding of this topic. Interviewers ask this to separate candidates who truly understand the mechanics from those who only know surface-level concepts.
Answer
Piping connects the standard output (stdout) of one command to the standard input (stdin) of another using the | operator. This allows chaining multiple commands to process data in a pipeline. Example: ps aux | grep nginx | awk '{print $2}' — lists processes, filters for nginx, then extracts PIDs. Pipes are created by the kernel as in-memory buffers; data flows left to right. All commands in a pipeline run concurrently. The exit status of a pipeline is the exit status of the last command (unless set -o pipefail is enabled, which makes it the status of the last failing command — important for robust scripts).
Common Mistake
Candidates often give textbook answers here. Interviewers are more impressed when you relate the concept to a specific problem you solved in a real Linux / Shell Scripting project.