sed Interview Questions and Answers¶
Introduction¶
These questions test whether you understand what sed does, when to use it, and how to verify the result on Linux.
Beginner Questions¶
What does sed do?
It edits text streams with search, replace, print, and delete operations.
Show a basic command.
sed 's/old/new/' file.txt
Intermediate Questions¶
Name useful options.
-n: suppress automatic printing.-i: edit files in place.s/old/new/: replace matching text.
Show a common administrator command.
sed -n '1,20p' /etc/ssh/sshd_config
Scenario-Based Questions¶
How would you handle sed replace text?
sed 's/http/https/g' urls.txt
What would you verify afterward?
sed --version
Expected output should look similar to:
https://example.com
https://cloudarks.com
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¶
sed 's/old/new/' file.txt
sed -n '1,20p' /etc/ssh/sshd_config
sed --version
Related Guides¶
Summary¶
A strong sed answer includes the purpose, a correct example, a common mistake, and a verification command with output you can interpret.