InterviewStack.io LogoInterviewStack.io

Command Line and Shell Scripting Questions

Practical skills using command line interfaces and writing simple shell scripts for automation and system administration across operating systems. For Linux this includes navigation and file operations, file permissions, process and service inspection, log viewing, package and systemctl management, common text processing and search utilities such as grep, find, sed, and awk, piping and redirection, environment variables, command substitution, and interactive use of editors and remote access tools. Shell scripting fundamentals include variables, conditionals, loops, functions, argument handling, basic debugging, and using bash to automate repetitive tasks. The scope also covers essential Windows command line and shell basics where relevant, including interactive commands, simple PowerShell cmdlets for process and service management, file and permission commands, and differences in syntax and environment when performing equivalent administrative tasks on Windows. Candidates may be evaluated on writing short scripts, composing command pipelines to accomplish tasks, and explaining tradeoffs between interactive commands and scripted automation.

EasyTechnical
90 practiced
Write a small POSIX-compatible bash script named `checkfile.sh` that accepts a single filename argument and prints whether the file exists, is readable, writable, executable, and its size in bytes. Include usage instructions and exit codes for the following conditions: missing arg, not found, success.
MediumTechnical
79 practiced
Design a resilient file transfer workflow to move daily batch files from an on-prem server to an S3 staging bucket through a bastion host: use rsync over SSH to transfer to a staging host, verify checksums, then use `aws s3` with retries to upload. Include retry logic, checksum verification, and how to resume partial transfers.
EasyTechnical
86 practiced
Explain the Linux file permission and ownership model: user/group/other, rwx bits and numeric modes. Given a dataset directory that should allow group access to 'data' group but deny world access, provide the commands to set permissions, change ownership to user 'etl' and group 'data', set a setgid bit so new files inherit the group, and explain edge cases (umask, ACLs).
HardTechnical
65 practiced
Design and implement a robust bash script that orchestrates an incremental ETL using AWS S3 and `aws` CLI: 1) list new files in a source S3 prefix since the last run, 2) obtain a lock to prevent concurrent runs, 3) download and transform files, 4) upload results, and 5) mark originals as archived (move). The script must be idempotent, handle transient failures with retries/exponential backoff, and preserve atomicity. Outline the logic and show key aws-cli snippets.
HardSystem Design
67 practiced
Design an observability approach for shell-script driven ETL jobs. Specify what metrics (durations, records processed, failures), logs, and traces the scripts should emit, how to expose metrics for scraping (e.g., Prometheus textfile collector or Pushgateway), and give example lines a script would emit to `/var/lib/node_exporter/textfile_collector/`.

Unlock Full Question Bank

Get access to hundreds of Command Line and Shell Scripting interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.