Linux on call · Chapter 30 of 30
Interview with Dev
By the end of this chapter you can answer five classic Linux interview questions in the terminal, each one several chapters of this course put together. Build it in your browser: a real editor and terminal, AI that explains, and tests that tell you when it works.
- Part: The 2 am page
- 5 tasks
- Linux
- In the all labs plan
The first 2 chapters of Linux on call are free. This one comes with the all labs plan.
Why you need this
The app survived the night, and Dev, the CTO, has heard all about it. Ravi calls you Tapri's admin now; Dev wants to make it official. "Five questions," he says, "answered with the terminal, not with words."
These are the questions every Linux, DevOps or backend interview asks in some form: what a file really is, where output goes, which program runs, what a permission means, how to search many files at once. Each one sounds easy and has a trap. A memorised answer ("a hard link is like a shortcut", "just grep for it") is half right, and an interviewer hears that at once. Proving the skill means doing it on a real machine, showing the evidence, and getting the trap right.
What you build: 5 tasks
Each task has tests. You write the code in the lab's editor and press Check.
- Task 1 · interview question
Interview: make a hard link and save its inode
Interview question: make a hard link, and show that both names are one file.
1. Make menu-link.txt a hard link to menu.txt. Use ln. Do not make a symbolic link.
2. Run ls -li on both names. The inode numbers should be the same.
3. Save only that inode number in inode.txt.
To pass: menu-link.txt is a hard link to menu.txt (the same inode), and it still has the menu. inode.txt has that inode number and nothing else.
- Task 2 · interview question
Interview: both streams in all.log, and the exit code saved
Interview question: catch everything a script prints, and its exit code.
1. Run ./noisy.sh once and look. It prints on both streams: normal output and errors.
2. Run ./noisy.sh again, and send both streams into all.log.
3. As the very next command, save $? in exit-code.txt.
To pass: all.log has all four lines noisy.sh prints, in the order it prints them, and nothing else. exit-code.txt has the exit code of ./noisy.sh, only the number. You read it with $? in the chapter folder.
- Task 3 · interview question
Interview: save which tapri-status runs in which.txt
Interview question: when two programs have the same name, which one runs?
1. Read env.sh. Then run source env.sh, so it changes the PATH of your shell.
2. Ask the shell which tapri-status it runs. Use type, which or command -v.
3. Save only the full path it prints in which.txt.
To pass: which.txt has the full path of the tapri-status that runs, and nothing else. You asked with type, which or command -v in the chapter folder, and the command worked.
- Task 4 · interview question
Interview: open the vault, and explain x on a folder
Interview question: what does the x permission do on a folder?
1. Run ls -ld /srv/ch30/vault. One permission is missing for you.
2. Give that permission back to yourself (the owner) with chmod. Never give others write permission.
3. Read /srv/ch30/vault/recipe.txt with cat.
4. In dir-x.txt, write one sentence in your own words: what does x let you do with a folder?
To pass: you can read /srv/ch30/vault/recipe.txt, and others cannot write to the folder. dir-x.txt says what x lets you do with a folder.
- Task 5 · interview question
Interview: find the .conf files that mention port 8080
Interview question: which config files talk about port 8080?
1. Use find and grep together on the conf/ folder, at any depth.
2. Keep only files whose names end in .conf. A backup copy with another ending does not count.
3. Keep only files with 8080 as a number on its own. A longer number that has 8080 inside it does not count.
4. Save the file paths in hits.txt, one on each line, like conf/some.conf.
To pass: hits.txt has exactly the right .conf files, one path on each line, starting with conf/, in any order, and nothing else. You ran find or grep in the chapter folder, and it worked.
What you will learn
- Answer with evidence: a number from the system, a file you can show, a command that proves it.
- Five skills from across the course: inodes and links (chapter 11), streams and exit codes (chapters 8 and 25), the PATH (chapter 18), folder permissions (chapter 14), and searching many files (chapters 5 and 7).
- The traps: the ones each question hides, found by trying things on a practice folder first.
More in The 2 am page
Build "Interview with Dev" yourself
Tapri’s ordering app moves onto a Linux server, and the server is now yours to run. A real editor and terminal in your browser, AI that explains, and a Check that says when it works.
The first 2 chapters of Linux on call are free. This one comes with the all labs plan.