What this topic covers
8 subtopics- Text tools13
- Shell7
- Files6
- Permissions6
- System5
- Pipes and redirection4
- Processes3
- Users1
- Beginner 15
- Intermediate 15
- Advanced 15
About this topic
Linux questions appear in IT-services technical rounds, DevOps and backend interviews, and in day-to-day work on servers. The pipelines and shell snippets here were run in bash to produce their answers (output words are shown separated by single spaces), and permission strings were computed from the numeric modes.
Free preview
Sample questions
Try each one first, then open the answer for the explanation and why the other options are wrong.
After chmod 755 deploy.sh, what does ls -l show as the permission string?
Show answer and explanation
Explanation
Each digit is r = 4, w = 2, x = 1 for owner, group and others: 7 = rwx, 5 = r-x. A typical mode for scripts and programs.
Why the other options are wrong
- AThat is 744.
- CThat is 777.
- DThat is 644.
What does this pipeline print?
printf 'b\na\nb\nc\nb\na\n' | sort | uniq -c | sort -rn | head -1Show answer and explanation
Explanation
sort groups equal lines, uniq -c counts each group, sort -rn puts the biggest count first, head -1 keeps the top line. This is the classic "most frequent line" idiom (e.g. top IP addresses in an access log). uniq only merges adjacent lines, which is why sort comes first.
Why the other options are wrong
- ALeast frequent.
- Bb appears 3 times.
- Da appears twice.
/usr/bin/passwd has mode 4755. What does ls -l show, and why does it need that bit?
Show answer and explanation
Explanation
The s replaces the owner's x. Setuid programs are prime attack targets, so they must be small and careful.
Why the other options are wrong
- BIt is a file.
- CThe 4 sets setuid.
- Dt is the sticky bit (1).