Pipelines and Command Chaining

Updated

October 31, 2026

Pipelines and Command Chaining

Pipelines connect the stdout of one process to the stdin of another:

cat /var/log/auth.log | grep "Failed password" | awk '{print $11}' | sort | uniq -c | sort -nr

Conditional Execution: && and ||

# Execute second command ONLY if first succeeds:
mkdir -p /tmp/deploy && cp dist.tar /tmp/deploy/

# Execute second command ONLY if first fails:
systemctl status nginx || systemctl restart nginx