Explain the mechanism, then give the command that checks it. These are short answers to the Linux internals prompts in the preparation list. Assume Linux; service examples use systemd.

All six interview guides.

Commands, execution, and boot

What happens when we type ls in a terminal?

The shell parses input, expands arguments, handles redirection, and resolves ls through aliases, functions, or PATH. For an external executable it starts a process and executes the binary; after that process exits, the shell collects its exit status.

What are the internal workings of the ls command on Unix?

ls reads directory entries, fetches metadata needed by its options, sorts/formats results, and writes output. ls -l may also resolve user and group names. In a lab, inspect strace -f /usr/bin/ls -l /tmp; exact calls vary.

What are a linker and a loader?

A linker combines object files and resolves symbols when producing a binary or library. The kernel's executable loader creates the program image; for dynamically linked executables, a dynamic loader maps libraries and performs runtime relocation.

What are system calls?

System calls are controlled entry points into kernel services, including files, processes, memory, and networking. Examples: openat, read, write, mmap, execve. A library call is not necessarily a system call; it may execute entirely in userspace.

How does strace work?

It normally uses Linux's ptrace interface to observe system-call entry/exit and signals, decoding arguments, results, and errors. strace -f -p PID follows children as well; attachment needs permission and adds overhead. It does not show every userspace function call. See ptrace.

How does ls * work?

The shell expands * into matching non-hidden names before launching ls, unless shell settings change that behavior. Matching directory arguments can make ls list their contents. Use ls -d -- * to list the matched names themselves; unmatched patterns depend on shell settings.

What argument size is too large?

An exec request can exceed the platform's argument/environment limits or an individual string limit and fail with E2BIG. getconf ARG_MAX shows the current aggregate limit; do not memorize one universal size. Use find ... -exec command {} + for bounded batches. See execve.

What does xargs -I ls {} mean?

As written, ls is the replacement string consumed by -I; {} becomes the command to execute. The likely intended form is xargs -I {} ls -- {}. For arbitrary filenames, use find . -maxdepth 1 -type f -print0 | xargs -0 -r -I {} ls -ld -- {} on GNU tools. xargs options define this parsing.

What happens during boot, from power on to a login prompt?

Firmware initializes hardware and selects a boot target. A bootloader or firmware mechanism loads the kernel and usually an initramfs; the kernel initializes subsystems, early userspace mounts the real root, and PID 1 starts services and login facilities. UEFI, embedded systems, and different init systems change the details.

How do you load a Linux kernel?

Normally install a kernel, modules, and an initramfs as required, update the boot configuration, and boot that image through the bootloader or UEFI mechanism. modprobe loads a kernel module, not a replacement kernel. kexec is a separate mechanism for entering another kernel without a normal firmware reboot.

What does uname do?

It prints system identification; plain uname normally prints the kernel name. uname -a includes the fields available on that implementation. It is not a reliable Linux distribution/version query; use /etc/os-release for that.

What does uname -r do?

It prints the release of the running kernel. Installing a newer kernel does not change this output until that kernel is running.

Processes and communication

fork() versus clone(): what differs?

fork() creates a child with a separate address space, implemented with copy-on-write on Linux. clone() offers flags controlling resource sharing, including memory, descriptor tables, and thread-group membership. Inherited descriptors after fork can still share an open file description and offset. See fork and clone.

What are the different types of exec calls?

Exec replaces the current program image; it does not create another process, and the PID normally stays the same. l takes an argument list, v a vector, p searches PATH, and e accepts an explicit environment. execve is the underlying Linux interface for many library variants.

Name three states a process can be in.

R: running or runnable. S: interruptible sleep. D: uninterruptible sleep, often waiting on I/O. Also know T for stopped and Z for zombie; state D alone does not identify a disk fault.

What is a zombie process?

A child has exited but its parent has not collected its status using a wait-family call. The kernel retains a small process-table record; the child is no longer executing.

Can you kill a zombie process?

No: it has already exited. Fix the parent's reaping behavior; controlled parent termination can allow an appropriate subreaper or namespace init to adopt and reap the child. Diagnose the parent before changing its lifecycle.

List ways to catch a signal for a program without source code.

To observe delivery, use strace -e trace=signal -p PID or a debugger configured to stop on signals. /proc/PID/status exposes masks and dispositions. Installing a handler inside the program requires changing its behavior; a shell trap cannot inject one. SIGKILL and SIGSTOP are uncatchable. See Linux signals.

How is a network process terminated?

Prefer the service manager's stop operation, or send SIGTERM and allow bounded cleanup before escalating. Exit releases the process's descriptor references; sockets held elsewhere can survive, and TCP state can outlive the process. FIN versus RST depends on socket state and how closure occurs.

How do you make a process a service?

Give it a service-manager unit defining executable, identity, environment, dependencies, stop behavior, restart policy, and logs. Reload the manager, start it, and verify an actual request. See the webserver supervision example.

In Linux, if we have 0 and 1, what is 2?

Assuming file descriptors: 0 is standard input, 1 standard output, 2 standard error. They are conventions and can be redirected or closed. Ask for context if the interviewer means something else.

What is IPC?

Interprocess communication includes pipes, Unix/domain or network sockets, shared memory, signals, and message queues. Shared memory avoids repeated payload copies but needs synchronization; sockets provide a transport and framing must still be defined.

What is the size limit of a pipe?

A pipe has finite buffer capacity, queryable with fcntl(F_GETPIPE_SZ) on Linux; defaults and tunability vary. PIPE_BUF is the bound for atomic writes, not total capacity. A blocking write to a full pipe waits; with no readers, writing causes SIGPIPE/EPIPE. See pipe(7).

What limits the number of pipes?

Available file descriptors, system-wide file resources, kernel memory, and pipe-specific per-user limits. Each ordinary pipe creates two descriptors. Inspect ulimit -n and the relevant fs.pipe-* sysctls rather than quoting a fixed pipe count.

Memory and kernel controls

How is virtual memory managed on Linux?

Page tables map process virtual pages to physical pages or describe mappings populated later. Page faults let the kernel supply data, allocate memory, handle copy-on-write, or reject an invalid access. A large virtual allocation can succeed without that much RAM being resident. See the kernel memory overview.

How does Linux memory management work?

It combines allocation, page caching, reclaim, swap, and limits. RSS measures resident pages; virtual size includes mappings that may not be resident. Compare free -h, /proc/PID/status, and cgroup limits. A process can hit its cgroup limit while the host still has available RAM.

Explain pagination, or paging.

In this context the intended term is probably paging: managing memory in fixed-size pages. A minor page fault requires no storage read; a major fault requires I/O to obtain the page. Page sizes vary by architecture and mapping; huge pages are larger than base pages.

What is swap space?

A disk partition or file used as backing for evicted anonymous memory; Linux can also use compressed swap devices such as zram. Some swap use can persist after pressure ends. Sustained swap-in/out correlated with latency is stronger evidence of current pressure.

What is DMA?

Direct memory access lets devices transfer data to/from memory without the CPU copying each byte. The CPU and drivers still arrange buffers and coordinate access; cache coherence and IOMMU mappings can matter.

What should you check in slabtop?

Kernel object caches, their sizes, active objects, and growth over time. A large cache alone does not prove a leak; distinguish reclaimable cache from retained allocations and compare with /proc/meminfo. slabtop -o takes one snapshot.

What is sysfs?

A virtual filesystem usually mounted at /sys exposing kernel objects, device relationships, and attributes. Some attributes are writable controls; changing them changes kernel/device behavior. It is not a directory of persistent device configuration files.

Explain taskset.

It reads or sets CPU affinity: the CPUs on which a task is eligible to run. taskset -pc PID inspects affinity. Affinity does not reserve CPU capacity; thread-specific affinity and cgroup restrictions also matter. See taskset.

What are kernel parameters?

Configuration affecting kernel behavior. Some are boot command-line options, some module parameters, and some runtime controls. Examples include memory overcommit and networking limits; check the scope and version of the particular parameter before changing it.

Can sysctl set these parameters?

It can read/write parameters exposed through /proc/sys, subject to permissions and namespaces. sysctl vm.swappiness reads one; sysctl -w NAME=VALUE changes a writable parameter at runtime. Persistence needs the host's configuration mechanism, and not every kernel setting is a sysctl. See the kernel sysctl documentation.

Five-minute drill

Explain why a process can have 100 GB of virtual memory, modest RSS, and still be healthy. Then explain why its child shares a file offset after fork, why a zombie ignores kill, and what pipe capacity has to do with PIPE_BUF.

Expected: distinguish mappings from resident pages, shared open file descriptions from separate address spaces, exited children from running processes, and buffering from write atomicity. Next: filesystems and storage.