Unix interview questions and answers for shell and production support roles

Unix interview questions check whether you can work from a shell on any Unix-like system: how files, inodes and links really work, how redirection and pipes move data between small tools, and how to write a script that runs the same under POSIX sh, from cron and on a server you did not build. Expect command questions, a text-processing task on a log file, and production-support scenarios such as a batch job that fails only at night or a disk that stays full after files are deleted.

By Published 9 min read

Who gets Unix questions, and what is different from a Linux round

Unix rounds show up in production support, application support, batch operations, middleware and banking technology interviews, and as a screening section for developers who will deploy to shared servers. The questions lean toward the shell itself rather than one distribution: text processing, file semantics, job control and scripts that survive a minimal environment. Many large employers still run AIX, Solaris or HP-UX next to Linux, so interviewers like candidates who know which habits are portable and which are GNU extensions. If the job is mostly administering Linux machines (systemd units, package managers, LVM, SELinux), prepare with Linux interview questions as well.

  1. Quick-fire commandsShort questions read off a list: which command shows open files, how to count lines matching a pattern, what a permission string means.
  2. A text-processing taskYou get a sample log or CSV and are asked for the top errors, a count per hour or the slowest endpoint, usually on a shared screen or whiteboard.
  3. A script review or write-upA short shell script with quoting bugs, a missing exit code check or a bash-only feature that breaks under sh.
  4. Support scenariosSomething broke overnight. The interviewer wants the order of your checks, not one lucky command.

Unix fundamentals questions

First-round and fresher questions
QuestionWhat it testsWhat a strong answer shows
What is the difference between the kernel and the shell?ArchitectureThe kernel manages processes, memory, devices and files through system calls. The shell is an ordinary user program that reads commands, expands them and asks the kernel to run them.
What is an inode, and what does it not contain?FilesystemsAn inode holds a file's metadata and pointers to its data: owner, mode, size, timestamps, link count. It does not hold the name. Names live in directory entries that point to inode numbers.
Hard link versus symbolic link?File semanticsA hard link is a second directory entry for the same inode, so it survives deleting the original name and cannot cross filesystems. A symbolic link is a small file holding a path; it can cross filesystems and breaks if the target moves.
What are file descriptors 0, 1 and 2?I/O modelStandard input, standard output and standard error. Every open file, pipe or socket a process holds is another small integer in the same table.
What happens between typing a command and seeing output?Shell mechanicsThe shell splits words, expands variables, globs and command substitutions, sets up redirections, finds the program through PATH, forks a child that execs it, then waits and records the exit status.
Why does ./deploy.sh run but deploy.sh says command not found?PATH lookupThe current directory is not on PATH, which is deliberate. A bare name is only searched in PATH directories; ./ gives an explicit path.
What does permission string -rwxr-x--- mean, and what is a umask of 027?PermissionsOwner can read, write and run; group can read and run; others get nothing (750). A umask of 027 removes write from group and everything from others on newly created files.
What is a daemon?ProcessesA background process with no controlling terminal, usually started at boot or by a service manager, such as cron, sshd or syslogd.
Is Linux Unix?ContextLinux is Unix-like and largely POSIX compatible, but the UNIX name is a trademark for systems certified against the Single UNIX Specification. AIX, Solaris and HP-UX are the traditional commercial Unix systems; the BSDs share Unix ancestry.
What does $? hold, and how do && and || use it?Exit statusThe exit status of the last command, where 0 means success. a && b runs b only if a succeeded; a || b runs b only if a failed.
First-round and fresher questions. Scroll sideways on a small screen.

Pipes and filters questions

Most Unix rounds include at least one "answer this question from a log" task. Interviewers watch whether you build the pipeline one stage at a time and check each stage's output, and whether you know why sort must come before uniq.

# app.log lines look like: 2026-12-01T10:15:02 ERROR payment Timeout calling gateway

# Which components log the most errors?
grep ' ERROR ' app.log | cut -d' ' -f3 | sort | uniq -c | sort -rn | head -5

# Errors per hour: the first 13 characters are the date and hour.
grep ' ERROR ' app.log | cut -c1-13 | uniq -c
Top error sources and errors per hour from an application log where field 3 is the component name. `cut` picks a field without numbered awk variables.
  • Why does `uniq -c` give wrong counts on unsorted input? It only collapses adjacent duplicate lines. Sort first, count, then sort the counts numerically in reverse.
  • cut or awk? cut is enough for a fixed single-character delimiter. Use awk when fields are separated by runs of spaces, when you need arithmetic, or when you group and sum.
  • How do you show lines with ERROR but not ones that mention retry? grep ERROR app.log | grep -v retry. Add -i for case, -w for whole words and -c to count instead of print.
  • How do you replace text in a file safely across systems? sed -i is a GNU and BSD extension with different syntax on each. The portable form writes to a temporary file and moves it back: sed 's/old/new/' f > f.tmp && mv f.tmp f.
  • How do you act on every file find returns when names contain spaces? Use find ... -exec cmd {} +, which is portable and batches arguments. -print0 with xargs -0 is common on GNU and BSD systems, but check before relying on it on older commercial Unix.
  • What does `tee` do in a pipeline? It copies standard input to a file and to standard output, so you can save an intermediate stage while the pipeline continues.
  • How do you watch a log that gets rotated? tail -f keeps reading the old file descriptor after rotation. tail -F, where available, reopens the name when the file is replaced.
  • What is a here-document for? Feeding several lines of input to a command inside a script, such as SQL to a database client, without a temporary file. Quoting the delimiter (<<'EOF') turns off variable expansion inside it.
# latency.txt lines look like: /api/orders 200 120
awk -v col=1 '
  { count[$col]++; total[$col] += $NF }
  END { for (k in count) printf "%-14s %3d req  %7.1f ms avg\n", k, count[k], total[k] / count[k] }
' latency.txt | sort -k4 -rn
Average latency per endpoint. `col` keeps the column number in one place, and `$NF` is the last field (milliseconds). Uses only POSIX awk features.

Redirection, quoting and POSIX sh questions

Intermediate shell questions
QuestionWhat it testsWhat a strong answer shows
What is the difference between cmd > out.log 2>&1 and cmd 2>&1 > out.log?Redirection orderRedirections apply left to right. The first sends stdout to the file, then points stderr at the same place. The second points stderr at the old stdout (the terminal) before stdout moves, so errors still hit the screen.
Why quote "$file"?Word splittingUnquoted expansions are split on spaces and glob-expanded, so a filename with a space becomes two arguments and a * in data expands to filenames.
Single versus double quotes?ExpansionSingle quotes are literal. Double quotes allow variable and command substitution but block word splitting and globbing.
Backticks or $(...)?Command substitutionBoth run a command and insert its output. $(...) nests cleanly and is easier to read, and it is POSIX.
Name some bash features that break under /bin/sh.Portability[[ ]], arrays, function name {, == inside [ ], echo -e, source instead of ., and $'...' strings. On some systems /bin/sh is dash or a Korn-style shell, not bash.
Why prefer printf to echo in scripts?Portabilityecho handles -n, -e and backslashes differently across shells and systems. printf behaves the same everywhere.
What does set -eu do, and what are its limits?Defensive scripts-e exits on an unchecked failing command and -u on an unset variable. Failures inside conditions, in most pipeline stages, and in some command substitutions do not trigger -e, so check critical steps explicitly.
What is trap used for?CleanupRunning a command on exit or on a signal, typically removing temporary files or a lock file even when the script is interrupted.
Intermediate shell questions. Scroll sideways on a small screen.
#!/bin/sh
set -eu
file=${1:?usage: wait_for_file.sh PATH [TIMEOUT_SECONDS]}
limit=${2:-300}
waited=0
while [ ! -s "$file" ]; do
  if [ "$waited" -ge "$limit" ]; then
    echo "gave up on $file after ${limit}s" >&2
    exit 1
  fi
  sleep 5
  waited=$((waited + 5))
done
echo "found $file after ${waited}s"
Wait for an upstream batch file and fail with a clear message after a timeout. POSIX sh only, so it behaves the same under dash, ksh or bash.

Processes, jobs and scheduling questions

  • `ps -ef` or `ps aux`? -ef is the System V style found on every Unix. aux is BSD style; GNU ps accepts both, while some commercial Unix ps commands do not take the BSD form.
  • How do you keep a job running after you log out? nohup cmd > job.log 2>&1 &, or a terminal multiplexer such as screen or tmux where installed. A real recurring job belongs in cron or the site's scheduler.
  • `kill` versus `kill -9`? Plain kill sends SIGTERM, which the program can catch to finish writes and remove locks. SIGKILL cannot be caught, so use it last, after you know what state you are leaving behind.
  • How do you find which process holds a file or port? lsof where installed, or fuser on the file. On a system without lsof, the vendor's process tools or /proc entries may be the fallback.
  • **Read this crontab line: 30 2 * * 1-5 /opt/batch/load.sh.** Minute 30, hour 2, any day of the month, any month, Monday to Friday. Mention that % has a special meaning in crontab and must be escaped.
  • What is the difference between cron and at? cron repeats on a schedule; at runs a job once at a given time.
  • `jobs`, `fg` and `bg`? Job control for the current shell: list background jobs, bring one to the foreground, or resume a stopped one in the background.

Production support scenarios for experienced candidates

Scenarios interviewers describe and where a calm answer starts
ScenarioLikely causeWhat to check first
A script works when you run it but fails from cron.EnvironmentCron gives a minimal PATH and no login profile, starts in a different directory, and has no terminal. Use full paths, set PATH and cd at the top, and redirect output to a log so cron failures are visible.
df says the filesystem is full but du finds far less.Deleted but open filesA process still holds a deleted log open, so the blocks are not freed. Find it with lsof +L1 where available, then restart or signal it to reopen its logs.
Disk has free space but you cannot create files.Inodesdf -i shows inode exhaustion, often from millions of tiny session or temp files.
rm *.log fails with "argument list too long".Argument size limitThe expanded glob exceeds the kernel's argument limit. Use find . -name '*.log' -exec rm {} + or move up a level.
The script fails with bad interpreter: /bin/sh^M.Line endingsThe file was saved with Windows CRLF line endings. Strip carriage returns with tr -d '\r' or the editor, and fix the source of the file.
kill -9 does not remove a process.Process stateA zombie is already dead and waits for its parent to collect its status; deal with the parent. A process stuck in uninterruptible I/O wait clears only when the I/O returns.
The overnight load finished but downstream says the file was empty.OrderingThe reader picked up the file while it was still being written. Write to a temporary name and rename when complete, since a rename on the same filesystem is atomic.
The server feels slow and users are calling.Triage orderLoad average with uptime, then vmstat for run queue, memory and swap, iostat for disk wait, and recent changes. These tools exist on most Unix flavors, though columns differ.
Scenarios interviewers describe and where a calm answer starts. Scroll sideways on a small screen.

Questions about commercial Unix

If the job description names AIX, Solaris or HP-UX, expect a few questions about how that system differs from Linux. Nobody expects you to know every vendor tool, but you should know where to look and say so honestly. Tool names below are the commonly cited ones; confirm details for the release the team runs.

Where the same job is done differently
TaskTypical Linux habitWhat to expect elsewhere
Manage servicessystemctlSolaris uses SMF (svcs, svcadm); AIX uses the System Resource Controller (lssrc, startsrc) and the SMIT menus.
Install softwareapt, dnf or yumVendor package tools, such as pkg on newer Solaris, installp on AIX and swinstall on HP-UX.
Volumes and filesystemsLVM, ext4, XFSAIX volume groups with JFS2, ZFS on Solaris. The concepts carry over, the commands do not.
Text toolsGNU grep, sed, awk with extensionsThe vendor's POSIX versions, which may lack flags like grep -P or sed -i. GNU tools are sometimes installed separately under another path.
Where the same job is done differently. Scroll sideways on a small screen.
  • How do you write scripts that run on both Linux and AIX? Target POSIX sh, use printf, avoid GNU-only flags, test on both, and keep a small wrapper for the few commands that truly differ.
  • What would you check first on an unfamiliar Unix box? uname -a, the shell in use, the uptime, mounted filesystems and free space, the crontab of the service account, and where the application writes its logs.

Fictional example

Answering "The 2 a.m. job failed, but it runs fine for you"
Interviewer
A shell script loads a settlement file every weeknight from cron. Last night it exited with an error. You run it by hand this morning and it works. Walk me through it.
Candidate
First I would read what the 2 a.m. run left behind: the job's own log and cron's mail or log entry, so I know the exit code and the last line it printed. Then I would compare environments, because by hand I have my login profile and cron does not. The usual suspects are a command not on cron's PATH, a relative path that only works from my home directory, or a variable set in my profile. I would also check timing: whether the upstream file had fully arrived at 2 a.m., since this morning it obviously had. To prove it, I would run the script with env -i and a minimal PATH from a different directory. The fix would be full paths and an explicit environment at the top of the script, plus a wait-for-file step with a timeout so a late upstream fails clearly instead of loading half a file.

A one-week Unix practice plan

  • Day 1: links, inodes and file descriptors. Create a hard link and a symlink, delete the original and explain what each still shows with ls -li.
  • Days 2 and 3: take any log file and answer five questions with pipelines: top errors, errors per hour, unique users, slowest requests, first and last timestamp. Say each stage aloud.
  • Day 4: rewrite one of your bash scripts in POSIX sh and run it under dash or ksh. Fix every quoting and echo issue you find.
  • Day 5: cron and environments. Schedule a script, break it with a relative path, then fix it and capture its output in a log.
  • Days 6 and 7: rehearse the scenarios above out loud, one minute each, starting every answer with what you would look at before changing anything.

Related reading: operating system interview questions covers the theory under processes and memory, Linux system administrator interview questions covers fleet administration, and VMware interview questions covers the virtual machines many Unix and Linux servers run on.

Support interviewers grade the path you take through an incident, and it is hard to hear your own path while you are talking. Natively, an AI interview assistant for Mac and Windows, can transcribe a mock support round on your computer so you can check afterward whether you read the logs before you restarted anything. During practice it can look at a screenshot of a log excerpt or a failing script and suggest what to test next, and with Pro or the free trial it can draw on the résumé and job description you add. Your transcripts and notes stay available for review.

Questions people ask

What Unix questions are asked in interviews?

Inodes and links, file descriptors and redirection, permissions, grep, sed, awk, find and xargs pipelines, POSIX sh versus bash, cron syntax, process signals, and support scenarios such as a job that fails only from cron.

What is the difference between Unix and Linux for an interview?

Linux is a Unix-like system, so the shell, files and processes work the same way. Unix rounds stress portable habits that also work on AIX, Solaris or HP-UX, while Linux rounds go deeper into systemd, package managers and distribution tooling.

What Unix commands should I know for production support interviews?

grep, cut, sort, uniq, awk, sed, find, xargs, tail, ps, kill, lsof or fuser, df and du, vmstat, iostat and crontab. Be ready to chain them into a pipeline that answers a question about a log.

Why does a shell script work by hand but fail in cron?

Cron runs with a minimal PATH, no login profile, a different working directory and no terminal. Use full paths, set the environment at the top of the script and send output to a log file.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP