Linux Host and Filesystem Fundamentals
Hudson River TradingSoftware Engineer · Technical ScreenLast updated
Review practical Linux fundamentals: memory and swap interpretation, safe directory enumeration, process-versus-thread trade-offs, filesystem links, and option-safe file deletion. Also explain responsible recovery steps after an accidental recursive delete.
Linux Host and Filesystem Fundamentals
Clarifying Questions to Ask
- Which Linux distribution and shell should be assumed?
- Are privileged commands allowed, or should the answer work as an ordinary user?
- Is the system local, containerized, or running under an orchestration platform?
Part 1: Inspect Memory and Explain Swap
How would you inspect memory usage on a Linux host? Explain what swap is, why it exists, and why low “free” memory or nonzero swap use is not automatically evidence of a problem.
Candidate hint: Separate process memory, reclaimable cache, memory pressure, and historical swap placement.
What This Part Should Cover
- Useful commands and fields rather than one unexplained number
- Available memory, cache, swap, and pressure interpretation
- Limits of a single snapshot
Part 2: Working Directory and Listing Without ls
Which command prints the current working directory? Give at least two safe ways to enumerate entries in the current directory without using ls, including hidden entries where practical.
Candidate hint: Be explicit about recursion, dotfiles, quoting, and unusual filenames.
What This Part Should Cover
pwdsemantics- Shell expansion or
find-based alternatives and their caveats - Filename-safe output when results feed another command
Part 3: Threads and Processes
Compare a Linux process with a thread. Discuss address spaces, resources, scheduling, communication, isolation, and failure implications.
Candidate hint: Avoid saying that threads are not scheduled entities; focus on what is shared and what is private.
What This Part Should Cover
- Shared versus isolated state
- Context, communication, synchronization, and fault boundaries
- Practical performance trade-offs without absolute claims
Part 4: Symbolic and Hard Links
Explain the difference between a symbolic link and a hard link. Cover inode relationships, filesystem boundaries, directories, deletion of the target name, and how common tools display them.
Candidate hint: Ask what directory entry each link points to and what keeps file data alive.
What This Part Should Cover
- Path indirection versus another name for one inode
- Lifetime and broken-link behavior
- Cross-filesystem and directory restrictions
Part 5: Delete a File Named -rf
A regular file in the current directory is literally named -rf. How can you delete that exact file without it being interpreted as command options? Explain why the command is safe.
Candidate hint: Either terminate option parsing or make the operand stop beginning with a hyphen.
What This Part Should Cover
- A correctly quoted, exact operand
--or an explicit relative path- Awareness that quoting alone does not change a leading hyphen into a non-option
Part 6: Recover After an Accidental Recursive Delete
Suppose a recursive removal deleted the current directory's contents. Is there a general shell command that restores those files? Explain what deletion changes and give a responsible immediate response and recovery order.
Candidate hint: Distinguish unlinking names from securely erasing blocks, but do not promise that unallocated data is recoverable.
What This Part Should Cover
- No universal undo and why continued writes reduce recovery chances
- Backups, snapshots, version control, and still-open file descriptors
- Filesystem-specific recovery as a last resort, not a guarantee
Follow-up questions
- Why can a process be killed by a memory limit while the host still reports available memory?
- How would you pass arbitrary filenames safely from `find` to another command?
- Why can an open file continue consuming disk after its pathname is deleted?
- How do bind mounts differ from symbolic links?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.