Home » Top 25+ Unix Interview Questions and Answers

Top 25+ Unix Interview Questions and Answers

by hiristBlog
0 comment

Unix is a multiuser operating system. It was created in the 1970s at Bell Labs by Ken Thompson and Dennis Ritchie. Unix became the base for systems like Linux and macOS. It uses a strong command-line interface and is known for being stable. Today, it powers enterprise systems, production environments, and critical infrastructure at leading tech companies. That’s why Unix interview questions are common in tech job interviews, especially for system admin, DevOps, or backend roles. This guide shares the top 25+ Unix questions and answers to help you get ready.

Fun Fact – Over 100% of the world’s top 500 supercomputers run on Unix-based or Unix-like operating systems.

Basic Level Unix Interview Questions

These are the most common basic Unix questions asked in interviews to test your understanding of commands and core concepts.

  1. What is the difference between Unix and Linux?

Unix is the original operating system, developed in the 1970s. Linux is a Unix-like system built later as open-source. Unix is mostly used in commercial systems, while Linux is free and widely adopted in servers and development environments.

  1. How do you list all files in a directory, including hidden ones?

Use ls -a to list all files. This includes hidden files, which start with a dot (e.g., .bashrc). The -a option tells the system not to skip these files, which are often used for configuration or system settings.

  1. What does the ‘chmod’ command do in Unix?

The chmod command is used to change the permissions of files and directories. You can grant or remove read (r), write (w), and execute (x) access for the owner, group, or others using numeric values or symbolic characters like chmod 755 filename.

  1. How can you check the current working directory in Unix?

Use the pwd command, short for “print working directory.” It displays the full absolute path of your current location in the file system. This helps you know exactly where you are when navigating folders or running scripts in the terminal.

  1. What is a symbolic link in Unix and how is it created?

A symbolic link is a reference to another file or directory, like a shortcut. It’s created using ln -s source target. If the original file is removed, the link breaks. Symbolic links are helpful for managing files across different locations.

  1. What is the use of the ‘grep’ command in Unix?

grep searches for a pattern or string in files. For example, grep error logfile.txt will find lines containing “error” in that file.

Also Read - Top 70+ Linux Interview Questions and Answers

Intermediate Level Unix Interview Questions

Here is a list of intermediate-level Unix interview questions and answers that cover practical tasks, scripting, and problem-solving scenarios.

  1. How do you schedule a job using ‘cron’ in Unix?

Use crontab -e to open your user’s cron table. Add a line with a proper cron expression, such as 0 3 * * * /path/script.sh, which runs the script daily at 3 AM. Save and exit. The cron daemon handles execution.

  1. What is the difference between a soft link and a hard link?
See also  Top 25+ Web API Interview Questions and Answers

A soft link is like a shortcut pointing to a file name, and it breaks if the original file is deleted. A hard link points to the same inode as the original file, so it remains valid even if the original is removed.

  1. How can you redirect both standard output and standard error to a file?

To capture both outputs, use: command > file.txt 2>&1. This sends the standard output (1) to the file and redirects the standard error (2) to the same location. It’s commonly used in scripts to collect logs in one file.

  1. What is the purpose of the ‘awk’ command in Unix?

awk is a powerful text processing tool. It scans files line by line, splits them into fields, and performs actions. For instance, awk ‘{print $2}’ data.txt prints the second column from each line of a file with structured text.

  1. How do you count the number of lines in a file using a Unix command?

Run wc -l filename to count lines. wc stands for word count, and the -l flag tells it to return just the number of lines. It’s a quick way to check file length in logs or reports.

  1. How can you find and delete files older than 7 days in a directory?

Use: find /path -type f -mtime +7 -exec rm {} \;. It searches for files older than 7 days based on last modification time. Once found, it deletes them using the rm command. This is useful for cleanup scripts.

Advanced Level Interview Questions on Unix for Experienced Professionals 

This section features Unix operating system interview questions designed to challenge experienced professionals.

  1. How does the ‘nice’ and ‘renice’ command affect process priority in Unix?

The nice command is used when starting a process to set its priority level. A higher nice value means lower priority, so the process gets less CPU time. renice changes the priority of an already running process without restarting it.

  1. Explain how signals work in Unix and how to handle them.

Signals are software interrupts used to communicate with processes. For example, SIGTERM requests graceful termination, while SIGKILL forcefully ends it. You can trap signals in shell scripts using the trap command to clean up resources or perform actions before exit.

  1. What are inodes in Unix and why are they important?

An inode is a data structure that stores metadata about a file, such as owner, size, timestamps, and permissions—but not its name. Unix uses the inode number to locate and access the actual file content on the disk.

  1. How can you monitor real-time system resource usage in Unix?

You can use commands like top, htop, or glances to view real-time CPU, memory, and process activity. For historical or I/O-related stats, tools like vmstat, iostat, or sar provide detailed information for performance tuning and troubleshooting.

  1. What is the difference between ‘fork’ and ‘exec’ system calls?

fork() creates a new child process by duplicating the parent. It runs independently with a new PID. exec() replaces the current process image with a new program. Together, they allow spawning and running a different executable in the child.

Scenario Based Unix Interview Questions

This section includes Unix scenario based interview questions to test how well you solve real problems in a Unix environment.

  1. A script suddenly stops running in production. How would you debug it in Unix?
See also  Top 20+ HashMap Interview Questions With Answers

Start by checking the script’s log file for any visible errors. Use ps or top to confirm whether the process is still running. If it’s a cron job, inspect /var/log/cron. Also, review recent code changes, permissions, or system limits that might interrupt execution.

  1. A file is taking too long to process. How do you identify the bottleneck using Unix tools?

Use the time command to measure how long each section takes. Check system load with top, memory stats with vmstat, and disk activity using iotop. The collected data helps identify whether the delay comes from CPU load, memory pressure, or disk I/O issues.

  1. How would you handle a ‘disk full’ error in a live Unix environment?

Run df -h to locate the full partition. Then use du -sh * | sort -h to spot space-heavy files or folders. Archive, compress, or remove old logs and temporary data. If needed, consider moving files to another disk or expanding storage.

  1. What steps would you take if a critical process keeps getting killed automatically?

Check /var/log/messages and run dmesg to see if out-of-memory kills are involved. Monitor memory usage with free -m, and adjust process limits using ulimit. If a script or external process is sending kill signals, trace it using auditd or system audit logs.

Unix Viva Questions

Here are common Unix operating system interview questions often asked in viva rounds to check your basic knowledge and quick thinking.

  1. What is a process ID in Unix?

A process ID (PID) is a unique number given to each running process. The system uses it to track and manage processes.

  1. What is the function of the ‘ps’ command?

The ps command shows information about running processes. It lists their PID, status, memory use, and the command that started them.

  1. What is a zombie process?

A zombie process is a completed process that hasn’t been fully removed. It still has an entry in the process table because its parent didn’t read its exit status.

  1. How can you terminate a running process in Unix?

Use the kill command followed by the PID. For example, kill 1234. If it doesn’t stop, use kill -9 1234 to force it.

  1. What does the ‘top’ command display?

The top command shows real-time system stats. It lists active processes, CPU and memory use, load average, and uptime. It’s useful for quick monitoring.

Other Important Unix Interview Questions

This section highlights additional Unix operating system interview questions that are useful for quick revision and last-minute interview preparation.

Basic Unix Commands for Interview

This list covers basic interview questions on Unix commands that are often asked to check your command-line skills and daily usage knowledge.

  1. What does the ‘ls -l’ command display?
  2. How do you copy files from one directory to another in Unix?
  3. What command is used to move or rename files?
  4. What does the ‘cat’ command do?
  5. How can you search for a string in a file using Unix commands?

Unix Command Interview Questions for Experienced

This section includes advanced interview questions for Unix commands to assess how well you handle complex tasks in real-time environments.

  1. How do you use the ‘find’ command with multiple conditions?
  2. Explain the use of the ‘xargs’ command with an example.
  3. How do you use ‘sed’ to replace text in a file?
  4. How can you view the last 100 lines of a large log file efficiently?
  5. What is the difference between ‘>>’ and ‘>’ in Unix?
See also  Top 50 Java OOPS Interview Questions and Answers

Production Support Unix Interview Questions

Here are production support interview questions in Unix that test your ability to troubleshoot, monitor, and manage systems in live environments.

  1. How do you check the health of a Unix system under load?
  2. What command would you use to check system logs in Unix?
  3. How do you identify high CPU-consuming processes in Unix?
  4. How do you troubleshoot a hanging script in production?
  5. How do you monitor real-time logs from a growing file in Unix?

Note – Unix interview questions for production support often include real-time issues, log analysis, process monitoring, file handling, and basic shell scripting.

Tips to Prepare for Unix Interview

Here are some useful tips to help you get ready for a Unix interview. Focused preparation like this can really improve your chances.

  • Review basic to advanced Unix commands and understand what each one does.
  • Practice common interview questions with real explanations and examples.
  • Create and run shell scripts to build confidence.
  • Use man pages to explore command options and flags.
  • Set up a Unix-like environment using Linux on a virtual machine or WSL.
  • Study file permissions, process management, and cron jobs.
  • Learn how to read logs and debug scripts.
  • Take mock interviews to improve response time and clarity.

Wrapping Up

These 25+ Unix interview questions cover the most important topics you need to know – from basic commands to real-world scenarios. Practice regularly, understand each concept, and stay confident.

Looking for Unix job opportunities? Visit Hirist – India’s leading job portal for IT professionals. Find top Unix roles suited to your skills and experience.

FAQs

What is the most commonly used Unix command for interview preparation?

One of the most common Unix commands for interview prep is ls, which lists directory contents. Interviewers also ask about grep, find, chmod, and awk. These cover file handling, searching, and scripting basics.

What are the key Unix commands asked in interview rounds?

Some of the key Unix commands asked in interview include –
ps (view processes)
kill (stop processes)
df and du (disk space usage)
crontab (schedule tasks)
sed and awk (text processing)
Understanding how and when to use them is often more important than just memorizing syntax

What type of Unix interview questions are asked for 5 years experienced professionals?

For 5 years experience, Unix interview questions often focus on real-world problem-solving. You may be asked about performance tuning, writing shell scripts, using awk, sed, handling cron jobs, process monitoring, log analysis, and troubleshooting in production environments. Scenario-based and scripting questions are common.

What is the average salary for Unix professionals in India?

According to AmbitionBox, the average salary for Unix and Linux roles in India varies by position and experience level. Unix Engineers earn between ₹3.7 Lakhs to ₹19 Lakhs per year. Unix Developers earn ₹2.4 Lakhs to ₹15.1 Lakhs. Linux and Unix Administrators earn ₹3.0 Lakhs to ₹11.0 Lakhs annually.

How should I answer Unix interview questions confidently?

Focus on explaining your thought process clearly. Give real examples from your experience. Practice common commands and scenarios in a test environment. Keep answers simple.

Which are the top companies hiring Unix professionals in India?

Leading tech firms hiring Unix professionals include TCS, Infosys, Wipro, IBM, HCLTech, Capgemini, and Cognizant. Product-based companies like Oracle, Cisco, and Dell also offer Unix roles, especially for system engineers and DevOps specialists.

You may also like

Latest Articles

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?
-
00:00
00:00
Update Required Flash plugin
-
00:00
00:00
Close
Promotion
Download the Hirist app Discover roles tailored just for you
Download App