awk Interview Questions and Answers¶
Introduction¶
These questions test whether you understand what awk does, when to use it, and how to verify the result on Linux.
Beginner Questions¶
What does awk do?
It processes structured text by records and fields.
Show a basic command.
awk '{ print $1 }' /etc/passwd
Intermediate Questions¶
Name useful options.
-F: set the field separator.NR: current record number.print: print selected fields or values.
Show a common administrator command.
awk -F: '{ print $1, $7 }' /etc/passwd
Scenario-Based Questions¶
How would you handle awk print columns?
awk -F: '{ print $1 }' /etc/passwd
What would you verify afterward?
awk --version
Expected output should look similar to:
root
bin
daemon
Practical Task Questions¶
Practice in a lab by running a safe version of the command, explaining the target, and showing the verification output.
Quick Review¶
awk '{ print $1 }' /etc/passwd
awk -F: '{ print $1, $7 }' /etc/passwd
awk --version
Related Guides¶
Summary¶
A strong awk answer includes the purpose, a correct example, a common mistake, and a verification command with output you can interpret.