Linux Interview Questions with an Open Deleted-File Case

Linux interview questions are easier to answer when you distinguish the object, the process and the operation. These original questions cover commands, files, permissions, services, memory, networking and administration. A worked disk-space ticket shows why deleting a log's name may not release its occupied space while an application still holds it open.

Aug 27, 2023 - 00:27
Updated: 
103.5k

Linux Administration in IT Infrastructure · Interview preparation

Linux Interview Questions with an Open Deleted-File Case

Quick answer: Linux interview questions are easier to answer when you distinguish the object, the process and the operation. These original questions cover commands, files, permissions, services, memory, networking and administration. A worked disk-space ticket shows why deleting a log's name may not release its occupied space while an application still holds it open. The case uses fictional records and upstream documentation rather than a claimed Linux execution. Use the answer cues to explain what you would check before proposing a change.

Key takeaways

  • Distinguish filesystem accounting from a directory walk.
  • Check open references before disrupting an application.
  • Explain the identity and environment of each operation.
  • Separate activation, persistence and application health.
  • Verify recovery instead of trusting a backup filename.

Table of Contents

How do you explain Linux fundamentals clearly?

1. What is Linux? A kernel used with user-space tools and other components in distributions. The kernel, distribution and shell are related but distinct. 2. What makes Linux multi-user? Multiple identities and processes can use resources under access-control and scheduling rules. Root privileges do not justify unrelated administrative actions. 3. What is a shell? A program that interprets commands and supports features such as expansion, redirection and pipelines. Available syntax depends on the selected shell. 4. Absolute or relative path? An absolute path starts from the process's root view; a relative path is interpreted from a relevant working directory or directory handle. 5. Why learn man pages? They document options, return values and version-specific behaviour. Identify the command and manual section rather than copying a matching word from an unrelated page.

Why can df remain high after a large log is deleted?

6. Do df and du measure the same thing? The df manual describes filesystem space accounting, while the du manual summarizes usage associated with selected directory entries. Compare the same filesystem and units before treating a difference as a fault. In this fictional ticket, an administrator removes a large log name, but the application still holds that file open. The directory walk no longer includes the removed name, while the underlying object can continue occupying space. 7. What does unlink actually remove? The unlink manual explains removal of a name and the conditions for releasing the file. A last open reference matters even after the last name is gone. 8. What should you check before restarting anything? Identify the correct process and open object, account for other links and confirm the application's supported log-reopen procedure. The process file-descriptor manual describes the per-process descriptor view and its access constraints.

Supplied observationReasoningUseful next check
df remains highAllocated filesystem space remainsConfirm filesystem, units and time
du no longer counts the removed log nameThe directory walk has changedReview the original file and link information
Application retains an open descriptor to that objectUnlinked data can remain allocatedConfirm identity and supported log-reopen procedure
Last open reference closes, with no links remainingSpace can become reusableMeasure the same filesystem again

Which file and permission questions require precise answers?

9. What do ls and grep show? Directory-entry information and selected text lines respectively. Hidden entries, metadata and matching rules depend on options. 10. What do read, write and execute mean? For a regular file they govern reading contents, modifying contents and execution subject to other rules. Directory permissions instead concern listing, entry changes and traversal. 11. chmod, chown or chgrp? They change mode, owner or group. Broad permission grants can create exposure without correcting the actual identity or path problem. 12. What is umask? A creation mask used under the applicable permission rules, not a command that retroactively repairs existing files. 13. Hard link or symlink? A hard link names the same object within the applicable filesystem; a symlink stores a pathname and can point to a missing target. 14. What do tar and compression provide? Packaging and encoding are separate operations. Check metadata preservation and a restore sample; compressed does not mean encrypted.

How should you discuss processes, memory and services?

15. What do ps and top answer? They expose process information and changing activity. Interpret process identity, elapsed time and workload before declaring a fault. 16. Is kill synonymous with force termination? It sends a signal. Choose the application's graceful stop path where possible; an uncatchable kill can prevent cleanup. 17. What does free memory mean? Linux uses memory for caches as well as processes. Inspect suitable availability and workload indicators instead of calling all nonempty memory a leak. 18. What is swap? Backing for eligible memory pages; behaviour depends on policy and pressure. Swap presence alone does not establish a problem. 19. Start versus enable? The service-manager manual distinguishes present activation from configured activation links. Check the application's required operation after reviewing the unit and journal.

What should package, account and scheduling answers include?

20. How do apt and dnf differ? They belong to different packaging ecosystems. State the target distribution, trusted repositories and intended transaction before recommending an operation. 21. How do you create a user responsibly? Identify the required login capability, ownership, primary group and supplementary groups. Account creation does not automatically establish all application permissions. 22. What do sudo and su change? Configured privileged execution and user context respectively. Know which identity performed the operation and preserve the appropriate audit trail. 23. What is cron for? Scheduled execution under a defined environment. A command that works interactively can fail under a different identity, working directory or environment. 24. How do environment variables affect programs? They supply process environment values inherited by children unless changed. Shell-local variables and exported environment values are not identical.

How do storage, networking and security checks fit together?

25. What do mount and fstab establish? Current filesystem attachment and a configuration source for persistent mounting. Verify the actual target and required boot behaviour separately. 26. What should a remote-access answer mention? Addressing, routes, name resolution, listening service, host identity and credentials. A successful ping does not validate all of those layers. 27. Why inspect SELinux rather than disabling it? The SELinux manual explains mandatory policy in addition to ordinary discretionary permissions. Review the intended operation and relevant denial context. 28. How should backups be discussed? Specify what is protected, retention, access, recovery point and restore acceptance. A copied file or an rsync completion message is not a complete recovery test.

QuestionAnswer that helps an operator
Why did deleting a log not free space?Compare names, open references and filesystem accounting
Why does a scheduled job fail?Compare identity, directory and environment
Why does a service fail after reboot?Check persistent configuration and dependencies
Is a backup usable?Restore a sample and verify the required operation

How can you give a strong troubleshooting answer?

29. What should you do before changing a system? Define the failing operation, preserve relevant records and choose the smallest useful check. Separate read-only diagnosis from a proposed change requiring approval. 30. How should you close the deleted-log answer? State that the supplied open reference explains why removing the name need not release the occupied space. Confirm the application's supported reopening mechanism and arrange a controlled action with its owner, rather than killing an arbitrary process or truncating an unknown descriptor. For a follow-up, suppose the application has no such open file. The original explanation no longer follows. Check other causes, including a different filesystem, permissions that limited the directory walk, hard-link accounting or filesystem-specific allocation. Keep measurements comparable and make the diagnosis fit the records. This is more useful than promising that one cleanup command always fixes a full disk.

Related reading: RHCSA interview questions; Directory deletion and pathname semantics.

References

Frequently Asked Questions

Linux is the kernel, while a distribution combines it with user-space tools, packaging, defaults and other components.

A file can remain allocated while another name or an open reference keeps it alive, subject to filesystem semantics.

They answer different accounting questions, and open deleted files, traversal scope, units and filesystem details can explain differences.

Identify the correct object and use the application's supported controlled procedure with its owner before considering disruptive action.

The case is a fictional set of records explained using upstream documentation; no kernel behaviour or filesystem mutation was executed.

Enablement and current activation are different, and neither replaces an application-specific check of the required operation.

Memory accounting includes useful caches and other allocations, so evaluate availability, trends and workload rather than one percentage.

Choose a small administrative task, explain its identity and expected result, and rehearse a verification and recovery decision.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Aayushi Sinha

With a passion for staying on the cutting edge of technology trends, I am dedicated to delivering content that not only informs but also inspires. Whether you need in-depth analysis pieces, informative guides, or thought-provoking opinion pieces, I craft content that resonates with tech enthusiasts and professionals alike.