Linux Operations Skills Quiz
This quiz tests your understanding of Linux operations skills used in Kubernetes environments.
Multiple Choice Questions
- Which command makes environment variables available to child processes?
- A) set
- B) export
- C) declare
- D) env
Show Answer
Answer: B) export
- When is
.bashrcexecuted?- A) Only for login shells
- B) For all shell sessions
- C) For non-login interactive shells
- D) Always with .bash_profile
Show Answer
Answer: C) For non-login interactive shells
- What does
${REPLICAS:-3}mean?- A) Set REPLICAS to 3
- B) Use 3 if REPLICAS is unset or empty
- C) Subtract 3 from REPLICAS
- D) Error
Show Answer
Answer: B) Use 3 if REPLICAS is unset or empty
- What does
awk 'NR>1 {print $1}'do?- A) Print first field of all lines
- B) Print only the first line
- C) Print first field excluding header
- D) Print lines with first field
Show Answer
Answer: C) Print first field excluding header
- What is the role of
ginsed -i 's/old/new/g'?- A) Case insensitive
- B) Replace all matches in line
- C) Replace once
- D) Enable regex
Show Answer
Answer: B) Replace all matches in line
- What does
-rdo injq -r?- A) Recursive search
- B) Reverse order
- C) Raw string output without quotes
- D) Read-only
Show Answer
Answer: C) Raw string output without quotes
- What does
ssh -L 8080:localhost:80 user@servermean?- A) Forward server 8080 to local 80
- B) Forward local 8080 to server 80
- C) Forward server 80 to local 8080
- D) Forward local 80 to server 8080
Show Answer
Answer: B) Forward local 8080 to server 80
- What does
warepresent in vmstat?- A) Web application CPU
- B) I/O wait time percentage
- C) Warning count
- D) Active processes
Show Answer
Answer: B) I/O wait time percentage
- Which command creates an LVM Physical Volume?
- A) lvcreate
- B) vgcreate
- C) pvcreate
- D) fscreate
Show Answer
Answer: C) pvcreate
- What does
curl -s -o /dev/null -w "%{http_code}" URLoutput?- A) Response body
- B) Response headers
- C) HTTP status code
- D) Response time
Show Answer
Answer: C) HTTP status code
Short Answer Questions
- What command executes file contents in the current shell?
Show Answer
Answer: source (or .)
- What is the JSON parsing tool?
Show Answer
Answer: jq
- What SSH option is used for bastion jump?
Show Answer
Answer: ProxyJump (or -J)
- What command monitors disk I/O?
Show Answer
Answer: iostat
- What is the path to the Pod service account token?
Show Answer
Answer: /var/run/secrets/kubernetes.io/serviceaccount/token
This is the default projected-token path; it may be absent if automount is disabled. Tokens rotate.
Practical Questions
- Write a script with required DATABASE_URL and TIMEOUT default 30.
Show Answer
bash
#!/bin/bash
: "${DATABASE_URL:?DATABASE_URL required}"
TIMEOUT=${TIMEOUT:-30}- Write a command to output Pods whose regular and init containers have at least 3 combined restarts as JSON.
Show Answer
bash
kubectl get pods -A -o json | jq '[.items[] | select(([(.status.containerStatuses[]?, .status.initContainerStatuses[]?) | .restartCount] | add // 0) >= 3)]'- Write an rsync command to sync yaml files through bastion.
Show Answer
bash
rsync -avzP --prune-empty-dirs --include='*/' --include='*.yaml' --exclude='*' -e "ssh -J bastion" /src/ user@host:/dest/Advanced Questions
- Write a node diagnostic script.
Show Answer
bash
#!/bin/bash
echo "=== System ===" && uptime && free -h && df -h
echo "=== kubelet ===" && systemctl status kubelet --no-pager- Explain ConfigMap env vars vs volume mount differences.
Show Answer
- Environment Variables: Loaded at Pod start, requires restart for changes
- Volume mount: Updates propagate eventually (kubelet sync period plus cache/watch delay). The application must reread/reload the file. subPath mounts do not receive updates.
Verification References
- https://kubernetes.io/docs/concepts/storage/volumes/#local
- https://kubernetes.io/docs/concepts/storage/storage-classes/#local
- https://kubernetes.io/docs/tasks/run-application/access-api-from-pod/
- https://kubernetes.io/docs/concepts/configuration/configmap/
- https://kubernetes.io/docs/reference/kubectl/generated/kubectl_wait/
- https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
- https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html
- https://download.samba.org/pub/rsync/rsync.1
- https://github.com/mikefarah/yq
- https://busybox.net/downloads/BusyBox.html
- https://github.com/docker-library/official-images/blob/master/library/busybox