Guru99

50 Unix Interview Questions and Answers (2024)

Mary Brent

Unix Interview Questions and Answers for Freshers

1) what is unix.

It is a portable operating system that is designed for both efficient multi-tasking and multi-user functions. Its portability allows it to run on different hardware platforms. It was written is C and lets users do processing and control under a shell.

👉 Free PDF Download: Unix Interview Questions & Answers

2) What are filters?

The term filter is often used to refer to any program that can take input from standard input, perform some operation on that input, and write the results to standard output. A Filter is also any program that can be used between two other programs in a pipeline.

Unix Interview Questions

3) What is a typical syntax being followed when issuing commands in shell?

Typical command syntax under the UNIX shell follows the format:

Command [-argument] [-argument] [–argument] [file]

4) Is there a way to erase all files in the current directory, including all its sub-directories, using only one command?

5) what is the chief difference between the –v and –x option s to set.

The –v option echoes each command before arguments and variables have been substituted for; the –x option echoes the commands after substitution has taken place.

6) What is Kernel?

Kernel is the UNIX operating system is the master program that controls the computer’s resources, allotting them to different users and performing different tasks. However, the kernel doesn’t deal directly with a user. Instead, it starts up a separate, interactive program, called a shell, for each user when he/she logs on.

7) What is Shell?

A shell acts as an interface between the user and the system. As a command interpreter, the shell takes commands and sets them up for execution.

8) What are the key features of the Korn Shell?

  • history mechanism with a built-in editor that simulates emacs or vi
  • built-in integer arithmetic
  • string manipulation capabilities
  • command aliasing
  • job control

9) What are some common shells and what are their indicators?

  • sh – Bourne shell
  • csh – C SHell
  • bash – Bourne Again Shell
  • tcsh – enhanced C Shell
  • zsh – Z SHell
  • ksh – Korn SHell

10) Differentiate multiuser from multitask.

Multiuser means that more than one person can use the computer at the same time. Multitask means that even a single user can have the computer work on more than one task or program at the same time.

11) What is command substitution?

Command substitution is one of the steps being performed every time commands are processed by the shell. The shell executes only those commands that are enclosed in backquotes. This will then replace the standard output of the command and displayed on the command line.

12) What is a directory?

Every file is assigned to a directory. A directory is a specialized form of a file that maintains a list of all files in it.

13) What is inode?

14) you have a file called tonky in the directory honky. later you add new material to tonky. what changes take place in the directory, inode, and file.

The directory entry is unchanged since the name and inode number remain unchanged. In the inode file, the file size, time of last access, and time of last modification are updated. In the file itself, the new material is added.

15) Describe file systems in UNIX

Understanding file systems in UNIX has to do with knowing how files and inodes are stored on a system. What happens is that a disk or portion of a disk is set aside to store files and the inode entries. The entire functional unit is referred to as a file system.

Unix Interview Questions for Experienced

16) differentiate relative path from an absolute path..

Relative path refers to the path relative to the current path. An absolute path, on the other hand, refers to the exact path as referenced from the root directory.

17) Explain the importance of directories in a UNIX system

Files in a directory can be a directory itself; it would be called a subdirectory of the original. This capability makes it possible to develop a tree-like structure of directories and files, which is crucial in maintaining an organizational scheme.

18) Briefly describe the Shell’s responsibilities

  • program execution
  • variable and file name substitution
  • I/O redirection
  • pipeline hookup
  • environment control
  • interpreted programming language

19) What are shell variables?

Shell variables are a combination of a name ( identifier), and an assigned value, which exists within the shell. These variables may have default values, or whose values can be manually set using the appropriate assignment command. Examples of shell variable are PATH, TERM, and HOME.

20) What are the differences among a system call, a library function, and a UNIX command?

A system call is part of the programming for the kernel. A library function is a program that is not part of the kernel but which is available to users of the system. UNIX commands, however, are stand-alone programs; they may incorporate both system calls and library functions in their programming.

21) What is Bash Shell?

It is a free shell designed to work on the UNIX system. Being the default shell for most UNIX-based systems, it combines features that are available both in the C and Korn Shell.

22) Enumerate some of the most commonly used network commands in UNIX

  • telnet – used for remote login
  • ping – an echo request for testing connectivity
  • su – user switching command
  • ftp – file transfer protocol used for copying files
  • finger – information gathering command

23) Differentiate cmp command from diff command.

The cmp command is used mainly to compare two files byte by byte, after which the first encountered mismatch is shown. On the other hand, the diff command is used to indicate the changes that is to be made in order to make the two files identical to each other.

24) What is the use of -l when listing a directory?

-l, which is normally used in listing command like ls, is used to show files in a long format, one file per line. Long format refers to additional information that is associated with the file, such as ownership, permissions, data, and filesize.

25) What is piping?

26) what is a superuser.

A superuser is a special type user who has open access to all files and commands on a system. Note that the superuser’s login is usually root, and is protected by a so-called root password.

27) How do you determine and set the path in UNIX?

Each time you enter a command, a variable named PATH or path will define in which directory the shell will search for that command. In cases wherein an error message was returned, the reason maybe that the command was not in your path, or that the command itself does not exist. You can also manually set the path using the “set path = [directory path]” command.

28) Is it possible to see information about a process while it is being executed?

Every process is uniquely identified by a process identifier. It is possible to view details and status regarding a process by using the ps command.

29) What is the standard convention being followed when naming files in UNIX?

One important rule when naming files is that characters that have special meaning are not allowed, such as * / & and %. A directory, being a special type of file, follows the same naming convention as that of files. Letters and numbers are used, along with characters like underscore and dot characters.

30) Why is it that it is not advisable to use root as the default login?

The root account is very important, and with abusive usage, can easily lead to system damage. That’s because safeguards that normally apply to user accounts are not applicable to the root account.

Unix Interview Questions and Answers for 5+ Years Experience

31) what is the use of the tee command.

The tee command does two things: one is to get data from the standard input and send it to standard output; the second is that it redirects a copy of that input data into a file that was specified.

32) Differentiate cat command from more command.

When using the cat command to display file contents, large data that does not fit on the screen would scroll off without pausing, therefore making it difficult to view. On the other hand, using the more command is more appropriate in such cases because it will display file contents one screen page at a time.

33) What is parsing?

Parsing is the process of breaking up of a command line into words. This is made possible by using delimiters and spaces. In the event that tabs or multiple spaces are part of the command, these are eventually replaced by a single space.

34) What is pid?

Pid is short for Process ID. It is used primarily to identify every process that runs on the UNIX system, whether it runs on the foreground or runs in the background. Every pid is considered unique.

35) How does the system know where one command ends and another begins?

Normally, the newline character, which is generated by the ENTER or RETURN key, acts as the signpost. However, the semicolon and the ampersand characters can also serve as command terminators.

36) What are Virtual Terminals?

Virtual Terminals are similar to Terminal that you have been using so far. They are used for executing commands and offering input. The only difference is that you cannot use the mouse with the Virtual Terminals. Therefore, you need to know the keyboard shortcuts.

Virtual Terminals

Virtual Terminals enable a number of users to work on different programs at the same time on the same computer. This is the reason they are one of the most distinguished features of Linux.

37) What is wild-card interpretation?

When a command line contains wild-card characters such as ‘*’ or ‘?’. They are replaced by the shell with a sorted list of files whose pattern matches the input command. Wild-card characters are used to setup a list of files for processing, instead of having it specified one at a time.

38) What is the output of this command? $who | sort –logfile > newfile

In this command, the output from the command “who” becomes the input to the “sort” command. At the same time, “sort” opens logfile, arranges it together with the output from the command “who”, and places the final sorted output to the file newfile.

39) How do you switch from any user type to a super user type?

In order to switch from any user type to a superuser, you use the su command. However, you will be asked to key in the correct superuser password before full access privileges are granted to you.

40) What would be the effect of changing the value of PATH to: .:/usr/della/bin: /bin: /usr/bin

This would cause the shell to look in the /usr/della/bin directory after looking in the current directory and before looking in the /bin directory when searching for a command file.

41) Write a command that will display files in the current directory, in a colored, long format.

Answer: ls -l –color

42) Write a command that will find all text files in a directory such that it does not contain the word “amazing” in any form (that is, it must include the words Amazing, AMAZING, or aMAZINg)

43) write a command that will output the sorted contents of a file named in.txt and place the output in another file named out.txt, while at the same time excluding duplicate entries., 44) write a command that will allow a unix system to shut down in 15 minutes, after which it will perform a reboot., 45) what command will change your prompt to myprompt.

To change a prompt, we use the PS1 command, such as this:

46) What does this command do? cat food 1 > kitty

Answer: it redirects the output of cat food into the file kitty; the command is the same as:cat food > kitty

47) What is wrong with this interactive shell script?

echo What month is this?read $monthecho $month is as good a month as any.

Answer: Initially, the question mark should be escaped (\?) so that it is not interpreted as a shell metacharacter. Second, it should be read month, not read $month.

48) Write a shell script that requests the user’s age and then echoes it, along with some suitable comment.

49) write a script that prints out date information in this order: time, the day of week, day number, month, year(sample output: 17:34:51 pdt sun 12 feb 2012), 50) write a script that will show the following as output:.

Give me a U!

Give ma a N!

Give me a I!

Give me a X!

Answer:for i in U N I Xdo

These interview questions will also help in your viva(orals)

  • UNIX / Linux Tutorial for Beginners: Learn Online in 7 days
  • 15 BEST Linux Books (2024 Update)
  • Telnet vs SSH – Difference Between Them
  • Linux Quiz, Online Mock Test & MCQ Question and Answers
  • 14 Best FREE SFTP Server for Windows (2024)
  • 6 Best Free TFTP Server for Windows (Apr 2024 List)
  • 10 BEST Linux Distros (2024)
  • How to Unzip Files in Linux and Ubuntu

Browse Course Material

Course info.

  • Dr. Katrina LaCurts

Departments

  • Electrical Engineering and Computer Science

As Taught In

  • Computer Design and Engineering
  • Computer Networks
  • Operating Systems
  • Software Design and Engineering

Learning Resource Types

Computer system engineering, unix assignment part 1.

Read “ The UNIX Time-Sharing System (PDF) ” by Dennis Ritchie and Ken Thompson. Recitation 4 will focus on the first four sections of the paper; Recitation 5 will focus on the rest.

To help you as you read:

  • By the end of section three, you should understand the differences between ordinary files, directories, and special files.
  • By the end of section four (along with section three), you should be able to explain what happens when a user opens a file. For instance, if a user opens /home/example.txt , what does the UNIX file system do in order to find the file’s contents? You should understand this in detail (e.g., at the i-node level). 

As you read, you may also find it helpful to think about the following:

  • What things in UNIX are named?
  • How does naming in UNIX compare to naming in DNS? How do layering and hierarchy apply (if at all)? 

Questions for Recitation

Before you come to this recitation , write up (on paper) a brief answer to the following (really—we don’t need more than a sentence or so for each question):

  • What is UNIX?
  • How is its filesystem designed?
  • Why was it designed to work that way?

As always, there are multiple correct answers for each of these questions.

facebook

You are leaving MIT OpenCourseWare

unix assignment questions with answers

  • Onsite training

3,000,000+ delegates

15,000+ clients

1,000+ locations

  • KnowledgePass
  • Log a ticket

01344203999 Available 24/7

Top 40 Unix Interview Questions and Answers

Explore a comprehensive collection of Unix Interview Questions and Answers designed to help you ace your next job interview. Whether you're a seasoned Unix pro or a newcomer, our blog offers valuable insights and expert guidance on handling Unix Interview Questions with confidence. Prepare for success with our in-depth knowledge and expert tips.

stars

Exclusive 40% OFF

Training Outcomes Within Your Budget!

We ensure quality, budget-alignment, and timely delivery by our expert instructors.

Share this Resource

  • LINUX Fundamentals Course
  • macOS Mojave Troubleshooting and Support Training
  • Linux Shell Programming
  • UNIX Shell Programming
  • Ubuntu Linux Server Administration Training

course

Table of Contents  

1) UNIX Interview Questions on basic UNIX commands 

2) UNIX Interview Questions on file and directory operations 

3) UNIX Interview Questions on UNIX permissions and ownership 

4) UNIX Interview Questions on process management 

5) UNIX Interview Questions on UNIX shell scripting 

6) UNIX Interview Questions on advanced UNIX concepts 

7) Conclusion 

UNIX Interview Questions on basic UNIX commands   

This section of the blog will expand on some commonly asked UNIX Commands interview questions. 

Q1) How do you list files in a directory?   

Ans: The ls command is fundamental in UNIX. By default, when executed, it displays the files and directories in the current directory. It provides a quick visual overview of directory contents, ensuring efficient navigation and file management. 

Q2) How can you list files with detailed information?   

Ans: To get a detailed listing of files, you can employ the ls -l command. This displays permissions, the number of links, file owner, file group, file size, and the time of the last modification. It's especially useful when monitoring file details and attributes. 

Q3) How do you navigate to parent or root directories?   

Ans: The command cd .. is employed to navigate to the parent directory, offering a step backwards in the directory tree. To directly navigate to the root directory, which is the base of the file system hierarchy, you use cd /. 

Q4) How do you view the contents of a file?   

Ans: The cat command, short for "concatenate and display", is versatile. Primarily, it is used to view the contents of a file, streaming its content to the standard output. This command provides a quick way to read small files or check file content without opening in an editor. 

Q5) How would you display the first 10 lines of a file?   

Ans: Utilising the head command proves beneficial for this. By default, executing head followed by a filename displays the file's initial ten lines. It's a great way to preview the beginning of large files or logs. 

Q6) How can you view the last lines of a file?   

Ans: The tail command serves this purpose efficiently. In its standard form, it exhibits the last ten lines of a file. It is particularly handy for real-time monitoring logs or checking recent file updates. 

Q7) How do you create an empty file in UNIX?   

Ans: The touch command is the tool of choice. When executed with a filename, e.g., touch filename.txt, it either creates an empty file or updates the timestamp of an existing one. It's a swift way to generate files or refresh their access times. 

Q8) How can you delete a file?   

Ans: To delete a file, the rm command is used. For example, executing rm filename.txt will remove the specified file after confirmation. Care should be exercised as this deletion is irreversible in standard file systems. 

Q9) How would you search for a specific pattern or word in a file?   

Ans: The grep command, derived from "Global Regular Expression Print", is indispensable. To search for a pattern within a file, you'd use grep "pattern" filename.txt. It scans the file line by line, printing lines that match the specified pattern – an essential tool for data parsing and content discovery. 

Q10) How can you search for files by name in a directory?   

Ans: The find command stands out for this task. For example, find . -name "example.txt" will search the current directory (denoted by ".") and its subdirectories for a file named "example.txt". This highly powerful command offers various flags and parameters for refined searching. 

Unlock the power of UNIX with our UNIX Fundamentals Course – join today!  

UNIX Interview Questions on file and directory operations   

This section of the blog will expand on some commonly asked UNIX Interview Questions and answers on file and directory operations.   

Q11) How do you create a directory in UNIX?   

Ans: In UNIX , the mkdir command is used to create directories. By executing mkdir directory_name, a new directory with the given name is created in the current location. The command is simple yet powerful, with options like -p, which allows the creation of nested directories in a single command. It's essential for organising files and ensuring structured data storage. 

Q12) How do you remove a directory?   

Ans: Directories can be removed using the rmdir command for empty directories. For instance, rmdir directory_name will remove the named directory, provided it's empty. However, if you need to remove a directory and its contents, the rm command with the -r (recursive) option, like rm -r directory_name, becomes useful. Caution is advised, as this operation is irreversible and can quickly delete large amounts of data. 

Q13) How do you move or rename a file or directory?   

Ans: The mv command serves the dual purpose of moving and renaming files or directories. To rename a file, mv old_filename new_filename is used. Similarly, to move a file to a different directory, the format is mv filename target_directory/. The same logic applies to directories. It’s a versatile command that aids in organising and re-structuring file locations and names. 

Q14) How can you copy files or directories?   

Ans: To duplicate files or directories, UNIX offers the cp command. For copying files, the syntax is cp source_file destination_directory/. If duplicating a directory, the -r option (meaning recursive) must be added, as in cp -r source_directory destination_directory/. This ensures all sub-files and sub-directories are replicated too. The cp command is fundamental when backing up data or creating duplicate research resources. 

Q15) How would you find the size of a file or directory?   

Ans: The du command, standing for "disk usage", can be employed to ascertain the size of files and directories. du -sh filename would display the size of a file, while du -sh directory_name reveals the total size of a directory. The -s provides a summary and -h displays sizes in a human-readable format (like KB, MB). It's an invaluable command for monitoring space utilisation and managing storage effectively. 

Q16) How can you create a symbolic link to a file or directory?   

Ans: Symbolic links (often called symlinks or soft links) can be crafted using the ln command with the -s option. The general form is ln -s target source_link. This creates a symbolic link named source_link that points to the target. Unlike hard links, symbolic links can reference directories or files across different file systems. They are especially useful for creating shortcuts or ensuring multiple paths to a single resource. 

Unlock the power of UNIX: Sign up for our UNIX Shell Programming Course today!  

UNIX Interview Questions on UNIX permissions and ownership   

This section of the blog will expand on some commonly asked UNIX Interview Questions and answers on permissions and ownership.   

Q17) How are UNIX file permissions represented?   

Ans: UNIX file permissions are typically represented using a combination of characters: r (read), w (write), and x (execute). These permissions are set for three different categories: the file's owner (user), the file's group (group), and others (other). A typical permission set might look like rw-r--r--, where the owner has read and write permissions, while the group and others have only read permissions. This symbolic notation can also be represented numerically, with read as 4, write as 2, and execute as 1, making the previous example 644. 

Q18) How do you change file permissions?   

Ans: The chmod command, short for "change mode", is employed to modify file or directory permissions. You can use symbolic or numerical notation with this command. For instance, chmod u+x filename adds execute permission for the user (owner), while chmod 755 filename sets permissions to rwxr-xr-x. The command offers flexibility, allowing users to control access to their files and directories precisely. 

Q19) How can you change the owner or group of a file?   

Ans: The chown command is used to change the owner of a file or directory. For instance, chown newowner filename would change the file's owner to "newowner". If you want to change both the owner and the group simultaneously, you will use a syntax like chown newowner:newgroup filename. For altering only the group, the chgrp command is used. As with most UNIX commands, care should be taken with these tools, ensuring that ownership is only granted to trusted users. 

Q20) What is the significance of the 'sticky bit' in permissions?   

Ans: The sticky bit is a permission setting that safeguards the files within a directory. When set on a directory, it ensures that only the owner of a file can either delete or rename the file, irrespective of the directory's permissions. This is especially useful in shared directories, like /tmp, preventing users from accidentally or maliciously deleting others' files. Symbolically, the sticky bit is represented as a t in the execute field for others, such as drwxrwxrwt. 

Q21) What's the difference between a hard link and a symbolic (or soft) link in terms of permissions?   

Ans: A hard link is an additional reference to the same inode on the disk, meaning it effectively "points" to the same data. Permissions changes on a hard link directly modify the original file since they reference the same data. Conversely, a symbolic (or soft) link is a separate file that points to another file's location. Permissions for the symlink are independent of the target file. Additionally, symlinks have their own set of permissions, but these largely affect the symlink itself and not the access to the target file. 

Q22) How can you set the setuid, setgid, and sticky bits using chmod?  

A: The setuid, setgid, and sticky bits are special permissions in UNIX that allow for enhanced security and functionality: 

a) setuid: When set on an executable file, it ensures that the program runs with the privileges of the owner of the file rather than the user who runs it. Using chmod, you can set the setuid bit with the symbol u+s or numerically as 4000. For instance, chmod u+s filename or chmod 4755 filename. 

b) setgid: This works similarly to setuid but for group permissions. It can be set on a file with g+s or 2000. When set on a directory, it ensures that files created within inherit the directory's group ownership. Use the command like chmod g+s directoryname or chmod 2755 directoryname. 

c) sticky bit: As mentioned earlier, it ensures that only the file owner can delete or rename files in a directory where it's set. You can set the sticky bit with o+t or numerically as 1000. For example, chmod o+t directoryname or chmod 1755 directoryname. 

Master UNIX administration with our expert-led Administrating UNIX Systems Course – join now!  

UNIX Interview Questions on process management   

This section of the blog will expand on some commonly asked UNIX Interview Questions and answers on process management.     

Q23) What is a 'process' in UNIX?  

Ans: In UNIX, a 'process' is a running instance of a program, possessing its memory space and assigned a unique process ID (PID). It can be in various states, like running, sleeping, or terminated, and is managed by the kernel. 

Q24) How can you view running processes?  

Ans: The ps command displays currently running processes, showing details like PID, terminal type, CPU time, and the command itself. For a comprehensive list, ps -ef or ps aux is commonly used. 

Q25) How can you send signals to processes?  

Ans: The kill command sends signals to processes, typically to terminate. For example, kill -9 PID sends the SIGKILL signal to terminate the process with the specified PID forcefully. 

Q26) Explain 'foreground' and 'background' processes.  

A: 'Foreground' processes run interactively, occupying the terminal until they are complete. Conversely, 'background' processes run behind the scenes, allowing terminal usage. Using & after a command starts it in the background. 

Q27) What is the 'nice' value in process management?  

Ans: The 'nice' value determines a process's priority. A process with a high nice value is 'nicer', getting less CPU time. Conversely, a lower nice value gets more CPU time. The nice command adjusts this value. 

Q28) How can you change the priority of a running process in UNIX?  

Ans: In UNIX, the renice command allows users to change the priority of a running process. Adjusting the 'nice' value influences the process's scheduling priority. For example, renice +5 PID would decrease the process's priority with the given PID, while renice -5 PID would increase its priority. Having the appropriate permissions is essential when trying to change the priority of processes not owned by the user. 

Unlock the power of Linux: Dive into our Linux Shell Programming Course today!  

UNIX Interview Questions on UNIX shell scripting   

This section of the blog will expand on some commonly asked UNIX Interview Questions and answers on shell scripting. 

Q29) What is a shell script in UNIX?  

Ans: A shell script is a sequence of commands that are stored in a file that the UNIX shell can execute. It automates repetitive tasks, enhances the command's capabilities, and can combine multiple utilities for complex operations. 

Q30) How do you make a shell script executable?  

Ans: To make a shell script executable, use the chmod command followed by +x. For instance, chmod +x scriptname.sh will grant execute permissions to the script. 

Q31) What's the significance of the '#!' (shebang) at the beginning of a script?  

Ans: The #! (shebang) at a script's start specifies the interpreter's path for executing the script. For example, #!/bin/bash instructs the system to use the Bash shell. 

Q32) How would you pass arguments to a shell script?  

Ans: Arguments can be passed directly after the script's name, like scriptname.sh arg1 arg2. Inside the script, $1, $2, etc., represent these arguments. 

Q33) What's the difference between '$#' and '$*' in shell scripting?  

Ans: In shell scripting, $# returns the number of arguments passed to a script, while $* displays all arguments as a single string. 

Q34) How can you check if a particular file exists in a shell script?  

Ans: To check if a file exists, use the -f test operator, as in [ -f filename ]. If true, it confirms the file's presence. 

UNIX Interview Questions on advanced UNIX concepts  

This section of the blog will expand on some commonly asked interview questions and answers on advanced UNIX concepts.  

Q35) What is the purpose of the 'cron' utility in UNIX?  

Ans: The cron utility in UNIX is a time-based job scheduler. It allows users and administrators to run scripts, commands, or jobs at predetermined intervals or specific times. Jobs can be scheduled to run by the minute, hour, month, week, or any combination thereof. Scheduled tasks are typically defined in a crontab file. The utility is indispensable for automating repetitive tasks, like taking regular backups, clearing temp directories, or fetching updates. 

Q36) Explain 'inodes' and their significance in UNIX.   

Ans: An inode (index node) in UNIX is a data structure that stores metadata about a file or directory except for its name or actual data. This metadata includes attributes like permissions, ownership, timestamps, and the location of data blocks. Every file or directory has a unique inode number within a filesystem. Inodes are significant because they underpin the UNIX filesystem's structure, allowing the system to manage and retrieve files efficiently. Operations that seem name-based, like renaming, often manipulate inodes behind the scenes. 

Q37) What is a 'daemon' in UNIX?   

Ans: A daemon is a background process or service that runs continuously, typically without any direct user interaction. Daemons perform tasks or provide services essential for the system's smooth running. Examples include sshd (secure shell daemon) for remote connections or crond for scheduling tasks. The naming convention for daemons usually ends in 'd'. They are crucial for server environments where services must run persistently, awaiting requests or performing regular duties. 

Q38) Describe 'pipes' and their usefulness in UNIX.   

Ans: 'Pipes', denoted by the | symbol, are a fundamental concept in UNIX that enables the output of one command to be fed as the input to another. This allows users to chain multiple commands together in sequence, effectively creating on-the-fly data processing streams. For instance, cat file.txt | grep "search_term" would display lines from file.txt containing "search_term". Pipes exemplify the UNIX philosophy of small, modular utilities that can be combined to produce complex results, promoting efficiency and reusability. 

Q39) How does UNIX handle process management and what is a 'zombie' process?   

Ans: UNIX employs a parent-child relationship for processes. When a process (parent) spawns another process (child), it's the parent's responsibility to retrieve the child's exit status. If the parent fails, the child remains in the process table, turning into a 'zombie' process. These zombies consume system resources without performing useful work. They can be identified using the ps command with statuses marked 'Z'. While individual zombies aren't harmful, they can clutter the process table in large numbers or if persistently generated, warranting intervention. 

Q40) What is 'IPC' in UNIX and why is it important?  

Ans: 'IPC' stands for Inter-Process Communication. It refers to the various mechanisms UNIX provides to allow processes to communicate with each other, either within the same system or across different systems. IPC mechanisms include pipes (both named and unnamed), message queues, semaphores, shared memory, and sockets. These tools are paramount because many applications and systems must coordinate tasks among multiple processes.   

UNIX Fundamental

Conclusion  

UNIX is a versatile Operating System with a rich history. By understanding the foundational concepts and commands, you are better equipped to tackle advanced tasks and troubleshooting in UNIX environments. We hope the aforementioned UNIX Interview Questions will be instrumental in your preparation for UNIX-related interviews or roles. 

Unlock your potential in the world of Linux with our wide range of Linux Training Courses . Explore our offerings and sign up today!  

Frequently Asked Questions

Upcoming it infrastructure & networking resources batches & dates.

Thu 25th Apr 2024

Thu 22nd Aug 2024

Thu 28th Nov 2024

Get A Quote

WHO WILL BE FUNDING THE COURSE?

My employer

By submitting your details you agree to be contacted in order to respond to your enquiry

  • Business Analysis
  • Lean Six Sigma Certification

Share this course

Our biggest spring sale.

red-star

We cannot process your enquiry without contacting you, please tick to confirm your consent to us for contacting you about your enquiry.

By submitting your details you agree to be contacted in order to respond to your enquiry.

We may not have the course you’re looking for. If you enquire or give us a call on 01344203999 and speak to our training experts, we may still be able to help with your training requirements.

Or select from our popular topics

  • ITIL® Certification
  • Scrum Certification
  • Change Management Certification
  • Business Analysis Courses
  • Microsoft Azure Certification
  • Microsoft Excel & Certification Course
  • Microsoft Project
  • Explore more courses

Press esc to close

Fill out your  contact details  below and our training experts will be in touch.

Fill out your   contact details   below

Thank you for your enquiry!

One of our training experts will be in touch shortly to go over your training requirements.

Back to Course Information

Fill out your contact details below so we can get in touch with you regarding your training requirements.

* WHO WILL BE FUNDING THE COURSE?

Preferred Contact Method

No preference

Back to course information

Fill out your  training details  below

Fill out your training details below so we have a better idea of what your training requirements are.

HOW MANY DELEGATES NEED TRAINING?

HOW DO YOU WANT THE COURSE DELIVERED?

Online Instructor-led

Online Self-paced

WHEN WOULD YOU LIKE TO TAKE THIS COURSE?

Next 2 - 4 months

WHAT IS YOUR REASON FOR ENQUIRING?

Looking for some information

Looking for a discount

I want to book but have questions

One of our training experts will be in touch shortly to go overy your training requirements.

Your privacy & cookies!

Like many websites we use cookies. We care about your data and experience, so to give you the best possible experience using our site, we store a very limited amount of your data. Continuing to use this site or clicking “Accept & close” means that you agree to our use of cookies. Learn more about our privacy policy and cookie policy cookie policy .

We use cookies that are essential for our site to work. Please visit our cookie policy for more information. To accept all cookies click 'Accept & close'.

  • Trending Now
  • Foundational Courses
  • Data Science
  • Practice Problem
  • Machine Learning
  • System Design
  • DevOps Tutorial
  • Learn Data Structures and Algorithms | DSA Tutorial
  • How To Deploy GraphQL API Using AWS Lambda And AWS API Gateway ?
  • How To Setup AWS Xray Tracing Setup Or Django Application ?
  • AWS Lambda Functions With AWS CLI
  • Beyonce and Jay-Z Kids (Names & Ages of All 3 Children)
  • Route 53 Realities: AWS CLI For Domain Name System
  • Sorting Algorithms
  • JavaScript Tutorial
  • SQL Tutorial
  • List of Generation Names Year Wise: Gen Z, Millennials, Baby Boomers, Alpha Generation
  • Binary Search Tree
  • Dynamic Programming
  • 10 Most Beautiful Women in the World 2024
  • HTML Tutorial
  • Stack Data Structure
  • Graph Data Structure And Algorithms
  • EMI Calculator Card using Tailwind CSS and JavaScript
  • Build a Ticket Booking Application in JavaScript and Tailwind
  • Design a Survey Form in Tailwind CSS
  • Sort a Tuple of Custom Objects by Properties in Python
  • How to create Delete Modal Card using JavaScript and Tailwind ?
  • Difference Between Matlab and C Language
  • Heap Data Structure
  • Difference Between Rales And Rhonchi

Consider the following statements : 

(a) UNIX provides three types of permissions  * Read  * Write  * Execute 

(b) UNIX provides three sets of permissions  * permission for owner  * permission for group  * permission for others 

Which of the above statement/s is/are true?

UNIX provides Read, Write and Execute permission on files UNIX provides three sets of permissions

  • permission for owner
  • permission for group
  • permission for others

For more information on UNIX OS Refer: Operating System | Unix File System Both (a) and (b) are correct.

So, option (C) is correct.

4

  • In UNIX Wait() is used to WaitForSingleObject() .
  • In UNIX Fork() is used for create-process().
  • In UNIX Create() is used for CreateFile().
  • In UNIX Close() is used for CloseHandle()
  • process id (PID) = 1
  • It is generally the parent of the login shell.
  • \"init\" forks and execs a ‘getty’ process at every port connected to a terminal.
  • But it is not the first process in the system

75

  • x vi command in unix saves the file and quits editing mode
  • q vi command in unix quits editing mode and no changes are saved to the file
  • sh vi command in unix escapes unix shell

Please Login to comment...

  • 10 Best Tools to Convert DOC to DOCX
  • How To Summarize PDF Documents Using Google Bard for Free
  • Best free Android apps for Meditation and Mindfulness
  • TikTok Is Paying Creators To Up Its Search Game
  • 30 OOPs Interview Questions and Answers (2024)

Improve your Coding Skills with Practice

 alt=

UNIX Tutorial

  • Unix / Linux for Beginners
  • Unix / Linux - Home
  • Unix / Linux - Getting Started
  • Unix / Linux - File Management
  • Unix / Linux - Directories
  • Unix / Linux - File Permission
  • Unix / Linux - Environment
  • Unix / Linux - Basic Utilities
  • Unix / Linux - Pipes & Filters
  • Unix / Linux - Processes
  • Unix / Linux - Communication
  • Unix / Linux - The vi Editor
  • Unix / Linux Shell Programming
  • Unix / Linux - Shell Scripting
  • Unix / Linux - What is Shell?
  • Unix / Linux - Using Variables
  • Unix / Linux - Special Variables
  • Unix / Linux - Using Arrays
  • Unix / Linux - Basic Operators
  • Unix / Linux - Decision Making
  • Unix / Linux - Shell Loops
  • Unix / Linux - Loop Control
  • Unix / Linux - Shell Substitutions
  • Unix / Linux - Quoting Mechanisms
  • Unix / Linux - IO Redirections
  • Unix / Linux - Shell Functions
  • Unix / Linux - Manpage Help
  • Advanced Unix / Linux
  • Unix / Linux - Regular Expressions
  • Unix / Linux - File System Basics
  • Unix / Linux - User Administration
  • Unix / Linux - System Performance
  • Unix / Linux - System Logging
  • Unix / Linux - Signals and Traps
  • Unix / Linux Useful Resources
  • Unix / Linux - Questions & Answers
  • Unix / Linux - Useful Commands
  • Unix / Linux - Quick Guide
  • Unix / Linux - Builtin Functions
  • Unix / Linux - System Calls
  • Unix / Linux - Commands List
  • Unix / Linux - Useful Resources
  • Unix / Linux - Discussion
  • Selected Reading
  • UPSC IAS Exams Notes
  • Developer's Best Practices
  • Questions and Answers
  • Effective Resume Writing
  • HR Interview Questions
  • Computer Glossary

Unix / Linux Questions and Answers

Unix Questions and Answers has been designed with a special intention of helping students and professionals preparing for various Certification Exams and Job Interviews . This section provides a useful collection of sample Interview Questions and Multiple Choice Questions (MCQs) and their answers with appropriate explanations.

Questions and Answers

{{ activeMenu.name }}

  • Python Courses
  • JavaScript Courses
  • Artificial Intelligence Courses
  • Data Science Courses
  • React Courses
  • Ethical Hacking Courses
  • View All Courses

Fresh Articles

Want To Learn PHP Web Development? Check Out These PHP Courses

  • Python Projects
  • JavaScript Projects
  • Java Projects
  • HTML Projects
  • C++ Projects
  • PHP Projects
  • View All Projects

How To Create A Python Hangman Game With GUI for Beginners

  • Python Certifications
  • JavaScript Certifications
  • Linux Certifications
  • Data Science Certifications
  • Data Analytics Certifications
  • Cybersecurity Certifications
  • View All Certifications

The 15 Best Project Management Certifications in 2024

  • IDEs & Editors
  • Web Development
  • Frameworks & Libraries
  • View All Programming
  • View All Development
  • App Development
  • Game Development
  • Courses, Books, & Certifications
  • Data Science
  • Data Analytics
  • Artificial Intelligence (AI)
  • Machine Learning (ML)
  • View All Data, Analysis, & AI

Google Career Certificates to Help You Land a Job in 2024

  • Networking & Security
  • Cloud, DevOps, & Systems
  • Recommendations
  • Crypto, Web3, & Blockchain
  • User-Submitted Tutorials
  • View All Blog Content
  • JavaScript Online Compiler
  • HTML & CSS Online Compiler
  • Certifications
  • Programming
  • Development
  • Data, Analysis, & AI
  • Online JavaScript Compiler
  • Online HTML Compiler

Don't have an account? Sign up

Forgot your password?

Already have an account? Login

Have you read our submission guidelines?

Go back to Sign In

  • Career Development

unix assignment questions with answers

Top Unix Interview Questions and Answers in 2024

Most interviewers look for candidates who have strong fundamental knowledge. If you are clear with the concepts, you can get through any trick questions or programming-related questions. Most of the time, the next questions are based on the previous answers, and that’s how interviewers build a conversation. Since Unix is a shell-based scripting language, you should know about bsh, csh, ksh, and bash. Interviewers also ask a lot about the Kernel and its purposes. Besides these two important concepts, Unix is all about commands and how to use the commands correctly.

  • Features of Unix

Before we get onto Unix interview questions, let us introduce Unix. It is useful if the interviewer asks you, ‘What is Unix?’. You can brief them on Unix and also give some features to impress them.

Unix is the most sought-after operating system because of its high reliability, scalability, and powerful features. Apple uses Unix, HP, AT&T, and many more big companies and backbone various data centers. The parent company of Unix is AT&T. Unix is free and easily accessible. Some features of Unix are:

  • Multiple users can get access by connecting to terminals.
  • High-level language, hence portable, and works across architectures.
  • Multitasking; many users can run various programs and processes parallely.
  • Users communicate with the system using Unix Shell translated to Kernel.
  • It follows a hierarchical file structure starting with a root directory represented by a slash (/).
  • Top Unix Interview Questions and Answers

We have answered the most commonly asked Unix interview questions below to help you get a fair idea of your interview. Not all questions will be asked in a single interview, but being prepared will help you better answer the questions. Some commonly asked Unix interview questions are:

1. What is the full form of UNIX?

Answer: Uniplexed Information & Computing System.

2. What are the common shells of Unix? Name their corresponding indicators.

Answer: 

3. What is a Unix shell?

Answer: Shell is a program or interface between system and user. In other words, it is the layer that understands both human and system language and executes commands entered by a user. It is also called a command interpreter.

4. What is the typical syntax of a UNIX command?

Answer: In general, the syntax of a UNIX command is:

Unix For Beginners

5. What does the symbol ‘*’ indicate to directories and files?

Answer: We use star character(*) for wildcards. Giving star after a command means including all the directories, folders, and files. For example, if you have to select all the files in a particular directory, you can give the command as:

6. Can you tell what a directory is? Command to create a Unix directory.

Answer: The directory is a structure that has a list of all the files inside it. The first directory is called the root directory. We represent the root using the slash (/) symbol. A directory can be created using the mkdir command by specifying the directory name:

7. What is the use of ls -l command?

Answer: ls -l is the long listing format to list all the information about the files in a directory. It displays all the information like the access, owner, timestamp, etc. Example:

dr-xr-xr-x 4 root root 4023 Mar 12 16:23 home

8. How to remove a directory in UNIX?

Answer: To remove a directory, use rmdir followed by the directory name. Example:

9. Name a few commands and their use?

Answer: Some common commands are:

10. What is the purpose of the kernel?

Answer: A kernel is the heart of Unix. It manages the hardware and software of the computer. The kernel manages the RAM to ensure all the programs run smoothly. It also manages access and use of different peripherals connected to the computers and manages processor time, task scheduling, and system files.

11. What does the command rm -r* do?

Answer: rm is to remove files

-r includes all the sub-directories of the current directory

* indicates all the files inside all the directories within

So, rm -r * removes all the files within the directory, including those in the sub-directories.

12. What is a Bourne shell? Explain with an example.

Answer: Bourne shell is a shell CLI for OS. It is represented by /bin/sh. Bourne shell executes each line of code till the end of the line (EOL) is found. Bourne shell doesn’t support arithmetic functions. Example:

echo “Hello, how are you?”

read response

13. What is the ‘cmp’ command? How is it different from ‘diff’?

Answer: cmp is used to compare files and gives out the exact line number & column number where the files differ.

diff is used to compare directories and list the different files and sub-directories in the directories being compared.

14. What is a shell script? Can you write a small program to print a message, “Good morning”?

Answer: A shell script is a program run by the Unix command line (CLI). The program to print ‘Good Morning’ is:

mymsg = Good morning

echo $mymsg

15. What does the setenv command do?

Answer: setenv defines the value of environment variables. It is a built-in function of csh (C shell). We can specify the argument (VAR), so it sets the particular environment variable. If no arguments are specified, setenv displays all the environment variables with their respective values.

16. How do you end a switch case statement in Unix?

Answer: It is done by reversing the letters of the word case, i.e., esac.

17. Give an example of a file system (hierarchy) in Unix.

Answer: Unix follows many standards for its file system. The first directory is ‘root’, represented with a forward slash (/). All the binaries that need to be available in single-user mode are contained in the /bin folder. Boot loaders like kernel, initrd are stored in /boot directory. Refer to the file hierarchy Wikipedia page for more.

18. What are the uses of head and tail commands?

Answer: The head command is used for printing the first n lines of a file onto the terminal:

head 7 test.txt

By default (i.e., when you don’t specify a number), ten lines are printed.

The tail command prints the last n lines of a file. By default, n is ten unless specified. We can specify more than one file, in which case the output is displayed along with the file name.

tail 15 test.txt

19. What will the following command do: $ grep “[^aeiou]” myfile

Answer: The command will match all lines that do not contain a vowel from the file ‘myfile’.

20. Explain the following piping command:

Answer: cat myfile | grep -i hi | sort – r

The command displays (cat) all the matches of ‘hi’ irrespective of the case (-i) and sorts the occurrences in the reverse order (-r).

21. What is the chmod command? What does ‘ch’ represent?

Answer: ch represents ‘change.’ chmod changes the access permissions for a file. We can represent permissions in octal digits 0-7 or letters. Example:

chmod 777 test.txt will give read, write, and execute permission for the file test.

chmod rwx test.txt does the same using letters.

22. What are the network commands you have used in Unix?

Answer: Some popular network commands are:

23. Differentiate between the absolute and relative path.

Answer: The absolute path is the complete path of a file or directory starting from its root directory. For example, /users/local/system

A relative path is the path from the current user directory and is not the complete path. It is the present working directory (PWD).

24. Explain pid with an example.

Answer: PID denotes process id. It is a unique id (number) that identifies all the processes running on the Unix system, whether foreground or background.

25. Describe inode.

Answer: The inode contains all the information about a file. It is a data structure that includes the file location on the disk, mode information, file size, device id, group id, access privileges, timestamps for file creation and modification, file protection flags.

26. If you have to change a Unix Directory, which command will you use?

Answer: The command chdir is used to change the Unix directory.

27. What are the uses of ‘mv’ and ‘cp’ commands?

Answer: cp copies files to a new directory location. The simple syntax is:

cp <source> <destination>. After executing the command, both the locations will have the same file.

mv is used to move/rename a file to another location (directory). The syntax is the same as cp:

mv <source> <destination>

The file will not be available in the source unless you specify backup options.

28. What are symbolic links?

Answer: A symbolic link has references to another directory or file. References are either relative (reference) or absolute (complete). The OS interprets symbolic links. The other file/directory is known as ‘target’. The symbolic link is created as:

ln –s <target> <link_name>

29. What are the permissions that can be given for a file? How can we change the permissions?

Answer: Unix files have three permission levels: write, execute and read. These are arranged in the order as <user permission>-<group permission>-<other permission>.

See Q21 use the chmod command.

30. Write the command to find the process that’s taking a lot of memory and kill that process.

Answer: The top command displays the pid, CPU usage, and other process details taking the maximum memory.

You can kill such a process using the kill command by passing the pid: kill <pid>

31. Do you know how to make changes to a large file without opening it?

Answer: For this, the sed command is used. For example, we want to replace the word ‘John’ with ‘Sam’. We can give the command as:

sed ‘s/John/Sam’ myfile.txt

32. What are the privileges of a superuser?

Answer: Superusers can access all the files and commands on the system without restriction. You can think of it as an admin account, which is above all the other accounts.

33. Can you list out a few shell responsibilities?

Answer: A shell is responsible for the following:

  • Environment control
  • I/O redirection
  • Program execution
  • Pipeline hookup
  • File name/variable substitution

34. How do you view information about a process in Unix?

Answer: You can just type ‘ps’ command.

35. Do you know about parsing? What is it?

Answer: The breaking of a command line into words by using spaces and delimiters is called parsing.

36. I want to search for the word ‘Morning’ in a file ignoring the case (example, considering both ‘m’ and ‘M’). For example, ‘morning’, ‘mORning’, ‘Morning’ etc. How can I do that?

Answer: Yes, by using the following command.

grep -vi morning myfile.txt

37. Explain what this command will do: sort file.txt | uniq > file2.txt

Answer: The command will sort the contents of the file and put the unique content into file2. Duplicate entries will not be copied to file2.

38. How do you get user inputs in Unix? Give an example.

Answer: Suppose we want to get a user’s name:

echo Hi, What is your name\?

echo Welcome, $name

39. How do you get the current date? Can you customize how the date is printed?

Answer: We can get the current date by typing the ‘date’ command. Suppose we want the format as: day, month, date, year, time; we will specify the sequence as:

echo $5 $3 $1 $2 $6 $4

40. What is a zombie process?

Answer: These are processes that do not take up any physical memory. Zombie processes have one or more of their listings still in the process table even after completion of execution.

41. What is swapping? Explain how a swapper works.

Answer: Swapping is a process where a complete process to be executed is moved to the main memory. The main memory capacity has to be more than the process size.

The swapper works based on a high scheduling priority base. It checks for sleeping processes. If there are not any, then ready-to-run processes are taken for swapping. To be swapped, the process should reside in the swapper for at least 2 seconds. If there are no available processes, the swapper goes into a wait state and waits until called by the Kernel (every second).

42. Explain what the ‘more’ command does.

Answer: It displays the contents of a file page by page instead of scrolling at once.

43. How can you check the disk capacity using the Unix command?

Answer: The disk capacity is checked using the ‘du’ command.

44. What is the fork() system call? How is it different from vfork() ?

Answer: The fork() call creates a child process from an existing (parent) process. In the process, the kernel places a copy of the parent process’s address space into the child process. vfork() call is faster as it does not do the above.

45. Can you explain the page fault and kinds of page faults?.

Answer: It is a situation when a process tries to refer to a page. But the page is not there in the main memory. The two types are validity fault (whether the page is valid or not) and protection fault (whether it can be accessed).

46. Can you write a command to instruct the Unix system to restart after 30 minutes?

Answer: /sbin/shutdown -r+30. Here 30 indicates the minutes.

47. How does Unix represent hidden files?

Answer: Hidden files are represented using ‘.’ or dot before the file name. For example, .cshrc, .profile etc.

48. What is meant by the command: cd ../..

Answer: It means to change the directory to two directories back. For example, if you are on /usr/bin/sh, you will move to /usr.

49. Write the various commands to create new files in Unix?

Answer: We can do so using the command, $touch filename

We can also use the vi filename command.

50. Is there any difference between shell and environment variables? If yes, please tell me what it is.

Answer: Environment variables are global variables available to a program and its children. Shell variables are available only in the current shell. Once you exit the shell, the variables are lost.

One of the key points to clear an interview is to be confident and accept what you don’t know. Interviewers don’t want you to know everything or be perfect. Just don’t beat around the bush and explain what you know thoroughly. Learn more about Unix through our list of courses and tutorials . Happy preparing!

People are also reading:

  • Basic Linux Commands
  • Difference between Linux vs Windows
  • Top Linux Interview Questions
  • Linux Cheat Sheet
  • Top 10 Open Source Security Testing Tools
  • Top Docker Interview Questions
  • Top AWS Interview Questions
  • Top Jenkins Interview Questions
  • Download SQL Cheat Sheet
  • Java Cheat Sheet
  • Git Cheat Sheet

unix assignment questions with answers

A cheerful, full of life and vibrant person, I hold a lot of dreams that I want to fulfill on my own. My passion for writing started with small diary entries and travel blogs, after which I have moved on to writing well-researched technical content. I find it fascinating to blend thoughts and research and shape them into something beautiful through my writing.

Subscribe to our Newsletter for Articles, News, & Jobs.

Disclosure: Hackr.io is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.

In this article

  • Top 90 Shell Scripting Interview Questions and Answers in 2024 Career Development Interview Questions Operating Systems Linux Command Line (CLI)
  • Best Linux Distro for Programming: Top 6 Ranked [2024] Operating Systems Linux
  • Unix vs Linux: What is the Difference? Operating Systems Linux Unix

Please login to leave comments

Always be in the loop.

Get news once a week, and don't worry — no spam.

  • Help center
  • We ❤️ Feedback
  • Advertise / Partner
  • Write for us
  • Privacy Policy
  • Cookie Policy
  • Change Privacy Settings
  • Disclosure Policy
  • Terms and Conditions
  • Refund Policy

Disclosure: This page may contain affliate links, meaning when you click the links and make a purchase, we receive a commission.

Unix Commands Interview Questions

Are you searching for Unix Commands Interview Questions and Answers? You can stop your search. MindMajix provides you with the top 50 Unix commands interview questions with proper answers in this blog. MindMajix's subject expert team has prepared the questions and answers from various topics, including Unix commands, pipes, link types, shells, file systems, permissions and grants, and much more. By going through all these well-versed Unix command interview questions, you will succeed in your interview, Undoubtedly.

  • Unix Shell Scripting Interview Questions
  • Unix Interview Questions
  • Explore real-time issues getting addressed by experts
  • Test and Explore your knowledge
  • Beginners Level
  • Intermediate Level
  • Advanced Level

Know that computer scientists in Bell laboratories invented the Unix operating system in 1969. Unix is a family of computer operating systems. Unix is popular for its flexibility, portability, adaptability, interoperability, and many more. Not only limited to this, but you can also perform multiple operations since the Unix operating system is a multitasking and multiuser operating system.

multiuser operating system

When it comes to Unix commands, you can perform various functions using them. For example, you can create, move, and remove files and folders using Unix commands. In this blog, the MindMajix subject expert team has devised Unix commands interview questions and answers with great care. If you go through all these top 50 Unix commands interview questions, it will be beneficial to face your interviews with courage and confidence. 

Importantly, the MindMajix subject expert team has prepared these interview questions and answers considering all levels of learners. So, you can find the Unix commands questions and answers from this blog according to your expertise. The team has divided the blog into different sections as follows

Top 10 Unix Commands Frequently Asked Questions

  • What are the Different File Types of Unix?
  • What do you mean by Kernel in Unix?
  • What is the Use of Unix Wildcard?
  • What is the use of the Grep Command?
  • What do you mean by the File System in Unix?
  • List out the Network Commands in Unix.
  • How would you remove a File in Unix?
  • What are the Various IDs used in Unix Processes?
  • What do you Understand by Permissions in Unix?
  • What Commands would you use to get User Information?

Unix Commands Interview Questions For Beginners

1. what is unix.

Unix is also referred to as Unics. UNIX stands for UNiplexed Information Computing System. It is one of the most famous operating systems. It is a multiuser as well as a multitasking operating system that provides flexibility and adaptability. Kernel, file system, Shell, and programs are the core components of UNIX.

define unix

2. What do you understand by filters in Unix?

A filter in Unix is a program that receives a standard input, processes the input, and delivers a standard output. You can also use the program between two programs in a pipeline.

3. What are the Different File Types of Unix?

The following are the different file types of Unix.

  • Ordinary files
  • Directories
  • Special files
  • Symbolic links

4. What is the Process in Unix?

The process is nothing but an instance of a program that runs on a computer. A process starts when a program is initiated. A process or parent process can trigger a subprocess known as the child process. If you terminate a parent process, the child process also gets completed.

5. What do you mean by Kernel in Unix?

The kernel is the hub of the Unix operating system. The function of the kernel is to allocate time and memory to programs. Mainly, it manages file storage. Also, it initiates communication when receiving system calls.

6. Can you describe the general format of Unix command syntax?

The Unix command syntax consists of three parts: the command, a list of options, and arguments.

  • The first part, the command, describes the type of operation
  • The next part, the list of options, changes the way the command operates
  • The last part, the list of arguments, is the additional information required to execute the command.

7. What is the Use of Unix Wildcard?

The wildcard is the symbol used to replace unknown characters. Asterisk (*) and question mark (?) are Unix's two commonly used wildcards. You can use an Asterisk wildcard to replace unknown characters, whereas a question mark wildcard can replace only one unknown character. More to the point, you can use an asterisk to replace an empty string.

MindMajix Youtube Channel

8. What do you mean by pipes and links in Unix?

A pipe is used to redirect the output of a command to another. Similarly, you can use pipes to redirect the output of a process or program. In other words, you can combine two or more commands using pipes. It is essential to note that pipes are unidirectional.

pipes and links in Unix

Links act as the pointer to a file or directory. There are two types of links such as soft links and hard links. Soft links are also known as symbolic links.

9. What do you understand by the Zombie Process in Unix?

The Zombie Process is also referred to as the defunct process. Generally, the zombie process occurs in parent-child functions. Once the child function completes the execution, it sends an exit message to the parent function. Only when the parent function acknowledges the exit message the child function can exit. In the meantime, the child function is in a zombie state.

10. What is the use of the chmod Command?

Chmod refers to change mode. This command is used to change access permissions of files and directories based on the specified mode in the command. Note that mode is usually identified with octal numbers or letters.

11. What is Command Substitution?

In this process, any command's output is substituted as another command's argument. Command substitution is usually expressed in double-quotes.

12. What do you Understand by a Superuser?

Superuser is the privileged account that can access any file or command. The super status is required to perform many administrative tasks and execute associated commands. The root is the user name of this account. If you want to become a super user, you can achieve this in two ways. One way is logging into the root directory. Another way is executing the su command.

13. What is Superblock?

It is a collection of metadata describing a file system's properties. It describes file systems along with inode and entry. The properties can be block size, filled blocks, block group size, magic number, pointers, and location of inode tables.

14. What is the use of the Grep Command?

Grep refers to the global search for regular expression and print. This command is used to search and match text files. This command searches files for a pattern of characters in text files. After the execution, it displays all the lines of the pattern. The pattern is usually expressed in a regular pattern.

15. What is the use of mount and unmount Commands?

Generally, files are structured in a tree format. And the files are distributed across many devices. The mount command is used to attach a file to the big tree. On the other hand, unmount command detaches a file from the big tree.

16. What is the difference between Absolute Path and Relative Path?

17. what is inode.

An inode is an entry that contains all the information about a file. It is created on a disk. An inode contains information such as where the file begins, file size when the file was changed along with time, all the associated read and write, execute permissions, the file owner, and many others.

18. What do you mean by the File System in Unix?

A file system is a logical method to store and manage information in the form of files, folders, as well as directories. Know that a file is the smallest unit to store data. Directories contain files and folders. In the Unix file system , all the Directories are organized in a tree structure. This entire system, including files, directories, and folders, is the file system in Unix.

file

19. Can you brief about the daemon?

Daemon is nothing but a background process that performs a task or set of functions. The background processes include memory management, printer jobs, file system management, network connections, etc.

20. What is the role of the fork ( ) system call?

This system call creates a new process from an already-existing process. The new process is known as the child process, and the primary process is known as the parent process. 

Intermediate Level Unix Commands Interview Questions

21. what is shell and shell variable.

  • Essentially, the shell is the command interpreter used to process Unix commands.
  • Shell variable is usually available to the current shell only. Shell variables are temporary and are deleted soon after the shell session.

22. How would you find a File in Unix?

We can use the ‘find' command to identify Unix files. The following is the syntax of the find command.

23. How would you copy a File from one host to another in Unix?

We can use the scp command to copy files from one host to another. Using this command, you don't need to start an FTP session or log into the remote systems. Note that this command uses SSH to transfer data. So, if you want to share files or directories in remote systems, you must apply a password or passphrase.

24. List out the Network Commands in Unix.

Following are the various network commands used in Unix.

25. What do you mean by kill ( ) system call and return value in Unix?

With the kill ( ) system call, you can send any signal to any process or process group. The syntax for this system call is given as follows:

If a signal is sent successfully, then zero will be returned. If not, the value -1 will be returned. Note that at least one signal must be sent successfully to return a zero.

26. Can you differentiate the  ‘cmp’ and ‘diff’ commands in Unix?

27. how would you remove a file in unix.

We can use the rm command to remove files from Unix. If you want to delete a file, you need to get write permission on the parent directory as well as execute permission.

For example, if you want to remove a text file, you can use write the command as follows

28. What is the difference between the cat command and the more command?

Both cat and more commands display file contents. However, they differ in displaying the contents. The Cat command's output is the entire file content on a single page, whereas more command outputs file contents page by page.

29. How would you find out whether a system is 32-bit or 64-bit?

We can find this in two ways. One way is using the “uname – a" command, and another way is using the “arch” command.

30. Can you name some File Manipulation Commands?

31. what do you mean by networking stack and protocol.

Know that TCP/IP is the networking stack protocol for the Unix kernel. TCP refers to the transmission control protocol. It manages a virtual circuit layer that ensures bidirectional data transmission. IP stands for internet protocol that manages packet transmission between user processes and the networking layer. TCP/IP has four layers as shown below.

networking

32. Why do we use the tee Command?

We use the tee command for two purposes. One purpose is that the tee command receives data from a standard input and sends the data to a standard output. Another purpose is that it redirects the input into a specified file.

33. What do you understand by Wildcard's Interpretation?

When a command line consists the wildcard characters such as * and ?, they will be replaced with the shell.

34. How does the Unix system identify that one command ends and another start?

Semicolons and ampersand characters denote the end of a command. Similarly, the newline character generated by the enter and return key helps to show a command that ends and another start.

35. What do you mean by Aliasing Mechanism?

It is the short form of long commands. By using aliasing, you can reduce the time to type long commands again and again. Below is an example of an alias.

Advanced Level Unix Commands Interview Questions

36. how would you find a hostname if you have an ip address in your network.

We can find the hostname using the nslookup command.

37. Can you write a Unix Command to shut down in 15 minutes and reboot?

We can use /sbin/shutdown –r +15 to shut down a Unix system and then reboot the system.

38. Write a Unix Command to identify the files that must not have the word ‘wonderful’.

We can use grep –vi wonderful *.txt command to find the files that don’t have the word wonderful.

39. How would you display files in the current directory in color and long format?

We can use the command ls-l-color to display files in the current directory in color and long format.

40. How would you Change any user type to a super user type?

We can use the su command for the same. At the same time, you must enter the password to access the privileges granted to you.

41. What are the Various IDs used in Unix Processes?

PID, PGID, and PPID are the three IDs used in Unix Processes.

  • PID – It is known as process ID
  • PGID – It is known as process group ID
  • PPID – it is known as parent process ID           

42. How does system boot-up occur in Unix?

It occurs in the following five phases.

  • Hardware: First, BIOS starts and makes checks for hardware connections
  • OS Loader: It is loaded in MBR, a 512-byte block of the boot device.
  • Kernel: It initializes the computer's operating system, drivers, and other components.
  • Root user-space process: It establishes an accessible environment for usage
  • Boot scripts: The startup scripts are located in directories for every managed service.

43. How would you check disk space using the Unix command?

We can use the %quota –v command to check the space left in disk space. So, it will know the space left in the disks and clean them regularly.

44. How would you check the size of files using a Unix Command?

We can use the %du  - s * - command to know the size of various files in the file system of directories and sub-directories. So you can remove unwanted files and empty spaces.

45. Which Unix Command would you use to compress and decompress files?

We can compress files using gzip command. The syntax is given as follows

Similarly, you can decompress files using gunzip command. The syntax is given as follows

46. What do you Understand by Permissions in Unix?

Generally, users are segregated into three groups in Unix: users, groups, and others. The user is the person who created the file. The group is the users with the privileges to access the file as the owner does. Others are the people who have offered access to the file.

Users can read, write and execute when it comes to access rights. Read permission represents that users can only read the contents of the file. Write permission indicates that users can change the contents of the file. Execute permission means that users can only execute the file.

47. How would you Change the Permissions of a File in Unix?

We can use the chmod Command to change the permissions of a file. The syntax for the command is given as follows

This command allows groups, Users, and others to read and write as well as execute.

48. What Commands would you use to get User Information?

  • Id: you can get the active user id along with login and group detail by executing this command.
  • Last: you can find the last login details of a user by running this command.
  • Groupadd admin: you can add group admin using this command.
  • Usermod –a : This command can add an existing user to a group.

49. What is the Crucial Function of a Pipe?

You can use the pipe function if you like to run two or more commands simultaneously. While executing pipe functions, the output of one program goes as the input to another program.

You can execute grep and sort commands using pipe functions.

50. How would you differentiate swapping from paging?

Most common unix commands faqs, 1. what is a file system in unix.

Essentially, a file is the collection of data. Unix has different types of files, such as special files, ordinary files, and directories. Directories are the file types in which ordinary and special files and folders are stored.

2. How to identify the users who are currently logged in using the Unix command?

We can use the who command to identify the users currently logged in now.

3. Which Unix command would you use to view the names of users logged in?

We can use the user command to view the names of users currently logged in users.

4. Is Unix a Programming Language?

No. Unix is an operating system.

5. What language is used to write the Unix Operating System?

C language is used to write the Unix operating system.

Tips for Unix Commands Interview preparation

  • Solid subject knowledge: It is the first and foremost thing to crack any interview. You must have substantial knowledge of Unix commands and operations. You must research how to use Unix commands for various functions.
  • Clear and concise Communication: You must clearly communicate what you are trying to convey to the interviewers. For this, you must have enough courage and confidence in your knowledge. Then, it will be easy to express what answer you are trying to deliver. At the same time, you should answer only the question precisely. You shouldn’t pour what all you know about Unix commands.
  • Discuss real-time examples: Before attending a Unix interview, you can get hands-on experience. Work on small projects or complete certification on the Unix operating system. It will help to strengthen your knowledge as well as ease your interview.
  • Know the company: You must know the details of the company where you are going to attend interviews. You can go through their websites, whitepapers, case studies, etc. They will give you what they are doing in the market precisely.
  • Continuous learning: Show the interviewers that you are a continuous learner. Communicate to them the skills you recently acquired relevant to the job you are attending the interview.

We hope that the Unix commands interview questions and answers provided in this blog post sharpened your knowledge in a better way. We advise you to learn the concepts deeply to ace your Unix command interview soon. This way, MindMajix offers a Unix Training Course and certification with which you can enrich your knowledge and add a feather to your skillset. Apart from this, you can find all other courses on the MindMajix training page. We are sure that you will be one step ahead among your competitors after taking a MindMajix course.

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Remy Sharp

Madhuri is a Senior Content Creator at MindMajix. She has written about a range of different topics on various technologies, which include, Splunk, Tensorflow, Selenium, and CEH. She spends most of her time researching on technology, and startups. Connect with her via LinkedIn and Twitter .

scrollimage

Copyright © 2013 - 2024 MindMajix Technologies

Sample Test Cases

Unix Interview Questions

In this article, we’ll explore a comprehensive set of unix interview questions along with detailed answers to help you excel in your interview preparations. Unix, a powerful and versatile operating system, has been a cornerstone of computing for decades. Proficiency in Unix is a valuable skill, especially for roles involving system administration, software development, and DevOps.

Unix Interview Questions and Answers For Freshers and Experienced

1.What is Unix, and how does it differ from Linux?

Answer: Unix is a multi-user, multitasking operating system developed in the late 1960s. Linux, on the other hand, is a Unix-like operating system based on the Unix design principles.

2.What is a shell in Unix?

Answer: A shell is a command-line interpreter that acts as an interface between the user and the Unix operating system, allowing users to execute commands and manage files and processes.

3.Explain the difference between a Unix shell and a Unix terminal.

Answer: A Unix shell is a program that interprets and executes commands, while a Unix terminal is a text-based interface that provides a way to interact with the shell.

4.What is a Unix file system, and how is it organized?

Answer: A Unix file system is a hierarchical structure use to organize and store files and directories. It starts with the root directory (“/”) and branches out into subdirectories.

5.What is a Unix process?

Answer: A Unix process is an instance of a running program. Each process has its process ID (PID) and can run independently of other processes.

6.How do you list files and directories in Unix?

Answer: You can use the ‘ls’ command to list files and directories in a Unix terminal.

7.What is the purpose of the ‘pwd’ command in Unix?

Answer: The ‘pwd’ (print working directory) command displays the current directory’s absolute path.

8.Explain the difference between the ‘cp’ and ‘mv’ commands in Unix.

Answer: The ‘cp’ command is used to copy files and directories, while the ‘mv’ command is used to move or rename files and directories.

9.How do you create a new directory in Unix?

Answer: You can create a new directory using the ‘mkdir’ command, followed by the directory name.

10.What is the purpose of the ‘touch’ command in Unix?

Answer: The ‘touch’ command is used to create empty files or update the access and modification times of existing files.

11.How do you remove files and directories in Unix?

Answer: You can use the ‘rm’ command to remove files and the ‘rmdir’ or ‘rm -r’ command to remove directories.

12.What is the ‘ chmod ' command used for in Unix?

Answer: The ‘chmod’ command is used to change the permissions of files and directories in Unix.

13.Explain the purpose of the ‘grep’ command in Unix.

Answer: The ‘grep’ command is used to search for text patterns within files. It is a powerful tool for text processing and pattern matching.

14.What is the ‘ ps ' command used for in Unix?

Answer: The ‘ps’ command is used to display information about the currently running processes.

15.How can you find and replace text in files using Unix commands?

Answer: You can use the ‘sed’ (stream editor) command to find and replace text in files.

16.Explain the three sets of file permissions in Unix (owner, group, and others).

Answer: Unix file permissions consist of read (r), write (w), and execute (x) permissions for the owner, group, and others.

17.How can you change file permissions in Unix using the ‘ chmod ‘command?

Answer: You can change file permissions using symbolic notation (e.g., ‘chmod u+x file’ ) or octal notation (e.g., ‘chmod 755 file’ ).

18.What is the purpose of the ‘chown’ command in Unix?

Answer: The ‘chown’ command is used to change the ownership of files and directories in Unix.

19.Explain the significance of the ‘umask’ command in Unix.

Answer: The ‘umask’ command sets the default file permissions for newly created files and directories.

20.How do you display the contents of a file in Unix?

Answer: You can use the ‘cat’, ‘less’ , or ‘more’ command to display the contents of a file in a Unix terminal.

21.What is the purpose of the ‘head’ and ‘tail’ commands in Unix?

Answer: The ‘head’ command displays the beginning lines of a file, while the ‘tail’ command displays the ending lines of a file.

22.How can you create a copy of a file in Unix?

Answer: You can use the ‘cp’ command to create a copy of a file.

23.What is the ‘find’ command used for in Unix?

Answer: The ‘find’ command is used to search for files and directories based on various criteria, such as name, type, and size.

24.How do you create a symbolic link (symlink) in Unix?

Answer: You can create a symbolic link using the ‘ln -s’ command, followed by the target file and the name of the link.

25.How can you view a list of currently running processes in Unix?

Answer: You can use the ‘ps’ command to view a list of currently running processes.

26.What is a process ID (PID) in Unix?

Answer: A process ID (PID) is a unique identifier assigne to each running process in Unix.

27.Explain the purpose of the ‘kill’ command in Unix.

Answer: The ‘kill’ command is used to send signals to processes, allowing you to terminate or control their behavior.

28.What is a background process in Unix, and how can you run a command in the background?

Answer: A background process is a process that runs independently of the terminal. You can run a command in the background by appending an ampersand (‘&’) to the command.

29.How do you pause and resume processes in Unix using signals?

Answer: You can pause a process using the ‘Ctrl+Z’ key combination and resume it in the background using the ‘bg’ command or in the foreground using the ‘fg’ command.

30.Explain the purpose of file redirection in Unix.

Answer: File redirection allows you to change the input source or output destination of a command. Common redirection operators include > , < , and >> .

31.How can you redirect the output of a command to a file in Unix?

Answer: You can use the > operator to redirect the output of a command to a file (e.g., ‘command > file.txt’ ).

32.What is a pipe (‘|’) in Unix, and how does it work?

Answer: A pipe (‘ | ‘) is used to combine the output of one command with the input of another command, allowing you to create powerful command pipelines.

33.How do you display information about the Unix system, including the kernel version and hardware?

Answer: You can use the ‘uname -a’ command to display system information.

34.What is the purpose of the ‘df’ command in Unix?

Answer: The ‘df’ command is used to display information about disk space usage on file systems.

35.How can you check the available memory and swap space in Unix?

Answer: You can use the ‘free’ command to check available memory and swap space.

36.How do you create a new user account in Unix using the ‘useradd’ command?

Answer: You can create a new user account using the ‘useradd’ command followed by the username.

37.What is the purpose of the ‘passwd’ command in Unix?

Answer: The ‘passwd’ command is used to change the password of a user account.

38.How can you add a user to a group in Unix using the ‘usermod’ command?

Answer: You can add a user to a group using the ‘usermod -aG’ command, followed by the group name and username.

39.How do you compress files and directories in Unix using the ‘tar’ command?

Answer: You can use the ‘tar’ command to create compressed archives of files and directories.

40.What is the purpose of the ‘gzip’ and ‘gunzip’ commands in Unix?

Answer: The ‘gzip’ command is used to compress files, while the ‘gunzip’ command is used to decompress gzip-compressed files.

41.How can you check network connectivity in Unix using the ‘ping’ command?

Answer: You can use the ‘ping’ command followed by a host or IP address to check network connectivity.

42.What is the purpose of the ‘ifconfig’ command in Unix?

Answer: The ‘ifconfig’ command is used to configure and display network interface information.

43.How do you establish an SSH (Secure Shell) connection to a remote Unix server?

Answer: You can use the ‘ssh’ command followed by the remote host and username to establish an SSH connection.

44.Explain the purpose of the ‘awk’ command in Unix.

Answer: The ‘awk’ command is used for text processing and data manipulation. It allows you to define patterns and actions to perform on text input.

45.How do you ‘sort’ lines of text in a file in Unix using the sort command?

Answer: You can use the ‘sort’ command to sort lines of text in ascending or descending order.

46.What is the purpose of the ‘cut’ command in Unix?

Answer: The ‘cut’ command is used to extract specific columns or fields from lines of text.

47.How can you count the number of words, lines, and characters in a file using Unix commands?

Answer: You can use the ‘wc’ (word count) command with options to count words, lines, and characters in a file.

48.How do you schedule recurring tasks or jobs in Unix using the ‘cron’ utility?

Answer: You can use the ‘crontab’ command to create and manage scheduled tasks, known as cron jobs.

49.What is the purpose of the ‘top’ command in Unix?

Answer: The ‘top’ command is used to display real-time system resource usage, including CPU, memory, and processes.

50.How can you search for files and directories on the Unix file system using the ‘locate’ and ‘find’ commands?

Answer: The ‘locate’ command uses a prebuilt index to quickly search for files, while the ‘find’ command performs a more comprehensive search based on criteria you specify.

Preparing for unix interview questions and answers a requires a solid understanding of the operating system’s core concepts and practical applications. By mastering Unix basics, file operations, process management, and other advanced topics, you’ll be well-equipped to tackle interview questions confidently and demonstrate your expertise in Unix system administration and shell scripting.

SQL Query Interview Questions

Basic DBMS Interview Questions For Freshers

DBMS Interview Questions

SQL Interview Questions

Scrum Master Interview Questions

SQL Interview Questions for Data Analysts

M.I.T. DEPARTMENT OF EECS

Hands-on 2: the unix time-sharing system.

Complete the following hands-on assignment. Do the activities described, and submit your solutions using the online submission site by 11:59p. This assignment is longer than the DNS one. Before attempting this hands-on, you should read The Unix Time-Sharing System , which is also assigned for this recitation. You might also find Section 2.5 of the book useful for questions 8-19.

no-knife:~>

Use the add command to gain access to the 6.033 utilities you will use in this assignment.

no-knife:~> add 6.033

Some of the directions in this hands-on assume your UNIX shell is tcsh . Run the following command to ensure you're running the appropriate shell. After you run "tcsh -f" your prompt will change to a single " > ".

no-knife:~> tcsh -f

We'll start off with an extremely simple example that most of you are probably familiar with already:

athena% cd /bin athena% ls -1 | more
athena% man command

where command is the command you are interested in. If you are unfamiliar with manual pages, you may want to try running

athena% man man

Now, try this:

athena% cd /bin athena% ls -1 | grep p | more

The point here is to observe that you can chain together multiple commands using the pipe character ( | ), and the output from each command will be passed to the input of the next, in left-to-right order. This allows you to treat any command that uses standard input and output as a primitive from which you can build more complex and useful commands.

II. Building Blocks

Now, we'd like you to figure out on your own how to solve some problems by chaining different commands together.

If you aren't already familiar with these commands, you may want to briefly skim through their man pages to familiarize yourself with what they do. You will probably need to use some of the options for the different commands in order to solve these problems.

Here are the commands you may find useful:

(*) On some Athena machines, the yes command isn't available. However, if you are doing this assignment on Athena you can use the command gyes , which is functionally equivalent. gyes is located in the "gnu" locker, so before you can use it you need to add the locker. You can do so with the following command:

athena% add gnu

(If you are curious about Athena's locker system, you can run man lockers for more information. The command whichlocker can be used to determine which locker contains a given command. The whichlocker command itself resides in the "outland" locker. For more info on other lockers, look at this SIPB article )

Once you have added the gnu locker, you can use gyes instead of yes . Some Athena machines seem to lack the manual pages for both yes and gyes (hereafter referred to just as yes ). In case the man pages are missing on the machine you are using, here is a brief description of what yes does. yes is very simple; it just outputs a string repeatedly until killed. It takes either one or zero arguments; if you give it a string as an argument it will output that string until it is killed (you can kill a process by pressing control-c). If you give it no arguments, it will output the string "y" until it is killed, which explains why it is named yes .

Pipe questions

For each of the outputs listed below, find one sequence of commands connected by pipes that produces the output. For each problem, turn in the command sequence that you used to generate the requested output. (Do NOT turn in the output itself.)

Now we'd like to explore something slightly different, having to do with file redirection as discussed in section 6.2-6.4 of the paper. The authors explain that the following two commands are functionally equivalent (except that you have to remove the temp file afterwards in the second case):

athena% ls | head -1 athena% ls > temp; head -1 < temp

The UNIX paper authors explain in section 6.3 that a user can type two commands together in parenthesis separated by a semicolon, and redirect the output to a file. The file will then contain the concatenation of the two commands. The example from the paper is roughly:

athena% (date ; ls) > temp1 &

Note that this example uses the & operator to run the process asynchronously. That is, the shell will accept and run another command without waiting for the first to finish. The authors also mention that one can use the & operator multiple times on one line. For example, we can do almost the same thing:

athena% (date & ls) > temp2 &

See if you can figure out for yourself what exactly the difference is between using ";" and "&" in the examples above.

Let's explore this for ourselves. First, we will write a very simple variation on the "yes" program that you encountered earlier on in this assignment. To do so, we will use the "command file" functionality described in section 6.4 of the paper. Most people call these command files "shell scripts", since they are essentially simple scripts that are executed by the shell.

First, start up a copy of emacs editing a new file called "myyes".

athena% emacs myyes

Now, enter the following lines into your file:

#!/bin/sh echo y sleep 1 echo n

Save the file and exit emacs. If you don't already know what the echo and sleep commands do, look them up in the man pages. Lastly, make the file executable by running the following command:

athena% chmod a+rx myyes

Now let's try running the following two commands:

athena% (./myyes ; ./myyes) > temp3 athena% (./myyes & ./myyes) > temp4

Note: Some fast multicore machines may occasionally give unexpected answers, where some output is lost - originally unexpected even to the 6.033 staff. If this occurs for you on your home machine, you may want to think briefly about why this occurs.

Looking Around

When you log in, the system sets your current working directory to your home directory , your personal name space where you can create your own files, directories and links. You can view the contents of your current working directory with the ls command (see above). Use the pwd command to learn the absolute path of your current working directory. This will tell you where you are in the directory name space even if you move around in the directories.

The stat program reports detailed information about a file including its inode number, link count, file type and other metadata. To use it, type stat followed by a file name at the command prompt. Run stat on your home directory:

III. Creating Directories and Files

> mkdir 6.033-handson2

Use ls to verify that the new directory exists. Now change your current working directory to your new 6.033-handson2 directory using the cd command and verify that your working directory has changed using pwd .

> cd 6.033-handson2 > pwd
Question 8: Change to the '.' entry in your new directory. What happens to your working directory? Next, change to the '..' entry. What happens to your working directory? Question 9: Describe a scenario where you might need to use the '.' directory.

Change your current directory back to your new 6.033-handson2 directory and stat the current directory; note the link count. Now create a couple files in your new directory using the touch command and stat the directory again.

> stat . > touch foo bar > ls > stat .
Question 10: What has changed in the stat output and why has it changed?

Now create a subdirectory baz in 6.033-handson2 and stat the directory once more.

> mkdir baz > stat .
Question 11: What has changed in the stat output this time and why has it changed? Why does the link count only change when you create a new directory?

IV. Creating Links

First stat your file foo and read the output information. Then create a hard-link named foo-lnk and stat both foo and foo-lnk .

> stat foo > ln foo foo-lnk > stat foo > stat foo-lnk

Note that everything about foo and foo-lnk is identical except for their names. If you modify foo you will see the modifications in foo-lnk .

> echo Hello >> foo > cat foo-lnk

Now create a symbolic link to foo and note that the symbolic link differs from the original file in several ways. Creating the symbolic link does not increase the link count of foo and the symbolic link does not share an inode with foo .

> stat foo > ln -s foo foo-slnk > stat foo > stat foo-slnk
Question 12: One reason for supporting symbolic links is to allow linking from one disk to another disk, but you can also create a symbolic link to a file on the same disk. Name one advantage and one disadvantage of using symbolic links on the same disk.
> cd /mit/6.033
> cd ../YOUR_USERNAME
Question 13: What happened? Why?
> ls -l /mit
Question 14: You can reach the 6.033 locker with the path /afs/athena.mit.edu/course/6/6.033 . Why does Athena also provide the /mit/6.033 symbolic link? Question 15: How would you change the file system to make this command ( cd /mit/6.033; cd ../YOUR_USERNAME ) actually change to your home directory?

V. The Search Path

> echo $PATH
> setenv OLDPATH $PATH > setenv PATH .:$PATH
> cd /mit/6.033 > demo
Question 16: What happened to ls ? Why isn't it listing files like it did before? (Hint: set your path back to its original state: setenv PATH $OLDPATH )

V. System calls

> strace ls
Question 17: What does 1 represent in the first argument of write ?
Question 18: How long did this assignment take you to complete up to this point?

VI. For Fun (not required)

Question 19: Chapter 2.5 describes how (in UNIX) a file's inode maps to the file's data blocks using direct pointers and indirect blocks. An alternative strategy, as used in FAT, stores a file's data as a linked list of FAT entries, each corresponding to a block ( cluster ). Name one advantage and one disadvantage of the linked list strategy.
Question 20: Some shells like bash try to make '..' always work properly, namely, cd /mit/6.033; cd ../$USER will place you in your home directory. Does bash always get this behavior correct?

Download the Unstop app now!

Check out the latest opportunities just for you!

100 Of The Most Asked UNIX Interview Questions And Answers

Srishti Magan

Table of content: 

Basic unix interview questions and answers, intermediate unix interview questions and answers, advanced unix interview questions and answers.

UNIX is a computer operating system that was initially developed in 1969 and has been continuously updated since then. It's a multi-user, multi-tasking system that's suitable for servers, desktops, and laptops. UNIX systems include a graphical user interface (GUI) comparable to Microsoft Windows that makes it simple to use.

However, knowledge of UNIX is essential for activities that are not covered by graphical software or when a Windows interface is not accessible, such as in a telnet session. On the market, there are several Unix variations. A few examples are Solaris Unix, AIX, HP Unix, and BSD. Linux is a free version of Unix.

If you are planning to sit for a UNIX interview, you must have a thorough knowledge of the entire concept as your interviewer will test your technical expertise. We have created a list of handpicked UNIX interview questions and answers that will increase your chances of getting hired by your dream company.

Output Devices Of Computer | Types, Functions & Applications

1. What do you mean by UNIX?

It's a lightweight operating system that's optimized for multitasking and multi-user functionality. Because of its mobility, it can operate on a variety of hardware systems. It was created in C and allows users to manipulate and process data from within a shell.

2. Explain kernel. 

The kernel is the main software that manages the computer's resources. This component is in charge of allocating resources to various users and tasks. When a user logs in to the system, the kernel does not interface directly with the user; instead, it launches a separate interactive program termed shell for each user.

3. What is the definition of a single-user system?

Single-user systems have an operating system that can only serve one user at a time. A single-user system is a computer with an operating system that can only be used by one person at a time. Because of the low cost of hardware and the availability of a large selection of software to accomplish various functions, single user systems are becoming increasingly popular.

4. What do you mean by shell?

A shell is software that allows you to access the Unix operating system. It gathers information from you and executes programs based on that information. Once a program has completed its execution, the output is shown. Shell is a command-line interface that lets us run commands, programs, and shell scripts from the command line. Shells are available in a range of flavors, similar to how operating systems are available in a variety of flavors. Common shells have a collection of well-known commands and features.

5. What are a shell’s responsibilities?

A shell's responsibilities are as follows:

  • Execution of the Program
  • Redirection of input and output
  • Variable substitution and filename
  • Connection to a pipeline
  • Controlling the environment
  • Integrated programming language

6. When sending commands in the shell, what is the common syntax used?

The following is a typical command syntax in the UNIX shell:

Command [-argument] [-argument] [–argument] [file]

7. Describe a UNIX link.

The term " link " is used to refer to a file that has more than one name. It's similar to a file pointer, except that one file might have several pointers. There are two sorts of links: internal and external.

Hard link - These hard-linked files have the same node value as the original and hence relate to the same physical file location. The link will also function if the file is relocated to a different directory.

ln [name of the original file] [name of the link]

Soft link - A soft link is similar to a file shortcut, except it has a different node than the original. If the original file is relocated, the link may not operate, but it can still refer to other files.

ln -s [original filename] [link name]

8. What does the term directory mean in UNIX?

A directory is a particular type of file that keeps track of all the files it contains. A directory is allotted to each file. Both ordinary and special files and folders are stored in this file type. 

9. What are the shell types in UNIX?

Shells are divided into two categories in Unix:

  • Bourne Shell - The $ character is the default prompt if you're using a Bourne shell.
  • C-Shell - If you're using a C-shell, the % character serves as the default prompt.

10. Describe the Bourne Shell and C-Shell categories.

The Bourne Shell and C Shell (csh) are two of the most well-known Unix shells, each with its own set of categories for Unix commands and utilities. These categories aid in the organization and classification of the numerous commands and programs accessible in the Unix ecosystem.

The different subcategories are:

  • Bourne shell (sh)
  • Korn shell (ksh)
  • Bourne Again shell (bash)
  • POSIX shell (sh)
  • C shell (csh)
  • TENEX/TOPS C shell (tcsh)

11. Explain the fork() system call.

The command fork used to generate a new process from an existing one is called fork(). The parent process is the primary process, while the child process is the new process id. The child process id is given to the parent process, while the child is given 0. The values returned are used to verify the process and the code that was performed.

The fork() system call takes no arguments and returns an integer. 0 signifies that the child process is created successfully, and it refers to the child process within the parent process.–1 means that the system failed to create another process.

12. What is command substitution and how does it work?

Every time instructions are handled by the shell, one of the steps is command substitution. Only instructions placed in backquotes are executed by the shell. This will then take the place of the command's usual output and be shown on the command line.

13. What do the commands chmod, chown, and chgrp do?

These are commands for managing files. These are utilized for the following purposes:

chmod - This command modifies a file's permissions.

$ chmod g+w textfile

chown - This command changes the file's ownership.

$ chown scoy3421 textfile

It makes scoy3421 the owner of textfile.

chgrp - The group of the file is changed using this command.

$ chgrp moderators textfile

It elevates a set of text files to the status of moderators.

14. What precisely is a daemon?

A daemon is a job or process that runs in the background and is responsible for a certain task or group of activities. This is a key idea in the Unix operating system. Memory management, file system administration, printer jobs, network connections, and a variety of other services are all handled by the Unix kernel's system daemons.

15. What is the Unix process model?

A priority-based preemptive round-robin scheduling technique is used to schedule processes. There will be no CPU starvation or saturation as a result of this. Processes can be preempted from the run queue and shifted to the sleep queue based on the completion of the time slice or wait by any I/O. Because we may encounter stalemate on any resource when scheduling, user applications must offer deadlock detection to guarantee that user processes do not become stuck.

16. What is the procedure for modifying file access permissions?

When adding or updating file access permissions, there are three sections to consider:

  • File owner’s user ID
  • File owner’s group ID
  • File access mode to define

The following is how these three pieces are organized:

(User permission) – (Group permission) – (other permission)

There are three forms of authorization:

  • r - denotes permission to read.
  • w - denotes permission to write.
  • x - denotes permission to execute.

17. How much do you know about shell variables?

The shell features a few preset internal variables, as well as the ability to create new ones. Some of them are variables that affect the environment, while others affect the local environment. These can be accessed through a variety of methods. A variable's name can only contain letters (A-z), digits (0-9), or the underscore character (_).

NAME="Sachin Tendulkar" $ echo $NAME $ unset NAME

18. Compile a list of regularly used network commands in UNIX.

The following are some of the most widely used networking commands in Unix:

  • telnet: This is used to log in from a remote location and communicate with another hostname.
  • ping : This command is used to test the network connectivity.
  • hostname : This contains the IP address as well as the domain name.
  • nslookup : Performs a DNS lookup.
  • xtraceroute : This is used to figure out how many hops and how long it takes to go to the network host.
  • netstat : This command displays information about the system and ports, as well as routing tables and interface statistics.
  • tcpdump : This command displays information on both incoming and outgoing network traffic.

19. What is an inode?

An inode is a file system entry that is generated on a part of the disc dedicated to the file system. The inode stores almost all of a file's information. It contains information such as the file's initial position on the disc, its size, when it was last used, when it was last altered, the file's read, write, and execute rights, who owns the file, and other details.

20. Explain the many types of pathnames and how to create them in UNIX.

A path is the unique location of a file or directory, as well as a mechanism to access it inside a directory hierarchy. In Unix, pathnames are divided into two categories:

  • Absolute Pathname: The whole path from the beginning of the file system to the location of a file or directory (root directory). /usr/local/Cellar/mysql/bin is an example.
  • Relative Pathname: This is the path from the user's current working directory, i.e. the current working directory (pwd). The relative path for the bin is ./mysql/bin if the current directory is /usr/local/Cellar .

21. Describe the functionality of the 'find' command in UNIX.

The 'find' command is used to search for files and directories within a specified directory hierarchy. It is often used with various options to locate and perform actions on files that match specific criteria.

22. How do you determine the process ID (PID) of a running process in UNIX?

You can use the 'ps' command to list running processes and their PIDs. For example: ps aux | grep processname .

23. What does the UNIX architecture look like?

The Unix architecture consists of the following main components:

Hardware Layer: The physical computer components.

Kernel: The core of the operating system, managing processes, memory, and devices.

Shell: The user interface for interacting with Unix, often through a command-line interface.

These components work together to enable the Unix operating system to function.

24. Explain the role of the 'history' command in UNIX.

The 'history' command displays a list of previously executed commands, allowing users to recall and re-run commands from their command history.

25. In which year was UNIX founded?

UNIX was founded in the year 1969 by Ken Thompson and Dennis Ritchie.

Generations Of Computer | 1st, 2nd, 3rd, 4th & 5th Generations

26. In UNIX, explain Superblock.

A SuperBlock is software that stores information on a certain file system, such as the block size, the number of vacant and full blocks, the size of block groups, the disc block map, the size and placement of inode tables, and use statistics.

Superblocks are divided into two categories:

  • Default Superblock: The default superblock is a predetermined offset from the system's disc partition's start.
  • Redundant Superblock: Multiple copies of a default superblock exist and are accessed when the default superblock is impacted by a system crash or problems.

27. Enlist some of the certain UNIX file manipulation commands.

Here are a few commands for manipulating files:

  • cat filename - This shows the contents of the specified file.
  • cp source destination - This command copies the source file to the destination folder.
  • mv old_name new_name - Rename/move files.
  • rm filename - Deletes/removes a file.
  • touch filename - time of creation/modification.
  • In [-s] old_name new_name - Generating a soft link on an old name.
  • Is –F - Shows details about the file type.
  • ls -ltr - This displays the list in long format, arranged by modification time from oldest to newest.

28. In terms of Unix commands, what are system calls and library functions?

  • System calls : System calls are an interface to the kernel that allows user applications to ask the operating system to do activities on their behalf. The application software switches from user space to kernel space whenever a system call is made within the operating system. These aren't easily transportable.
  • Library functions: Library functions are non-kernel functions that are utilized by various application programs. It takes less time to execute than a system call, is portable, and can only conduct specified activities in “ kernel mode” .

29. What is meant by virtual memory?

Virtual Memory is a method or system for accessing more memory than is physically available. The model is made up of a series of memory pages, each of which is typically 4 KB in size. Between virtual memory addresses and physical memory addresses, there is a translation layer. This translation layer is part of the kernel, and it's commonly written in machine language (Assembly) to get the best results when translating and mapping addresses. The kernel employs the address translation layer to transform the virtual memory address into a physical memory address whenever a user process accesses memory. Virtual Addressing allows you to address more memory than is physically available.

30. Distinguish between a relative and an absolute path.

The path relative to the present path is referred to as a relative path. On the other hand, an absolute path refers to the exact path as referenced from the root directory (the first directory is called the root directory).

31. What's the difference between a UNIX command, a library function, and a system call?

A system call is an element of the kernel's programming. A library function is a program that isn't part of the kernel but is accessible to system users. UNIX commands , on the other hand, are standalone programs that can include both system calls and library functions.

32. What does the kill() system call do and what do the return values mean?

The kill() system function delivers signals to any running process, which then takes appropriate action in response to the signal. It accepts two arguments: the first is the PID of the device to which you want to send a signal, and the second is the signal you wish to send.

The following values are returned by this method:

  • 0 - indicates that the process with the supplied PID exists and that the system enables signals to be sent to it.
  • -1 and errno==ESRCH - indicates that the process/process group given by the PID does not exist.
  • 1 and errno==EPERM - The sender does not have the authorization to transmit a signal to the destination process.
  • EINVAL - indicates that an invalid signal has been supplied.

33. What exactly is UNIX's Zombie process? How is the Zombie procedure found by you?

Child processes that finish before the parent process is known as zombie processes. So, once the process is over, the process structure and address space are withdrawn from the system and freed up, but the process table entry remains. In the process table, one can easily locate the process ID of the same despite it remaining non-functional. The parent must call and wait, in order to obtain the status of the child's procedure (). The kid is considered to be a 'zombie' during the time between the child's termination and the parent's call to wait().

34. Explain how to boot a UNIX system.

There are five phases to it:

  • Hardware - BIOS starts up and scans for a hardware connection.
  • Operating System loader - The OS loader is found in the MBR, which is the first 512-byte block of the boot device.
  • Kernel - It initializes different components of the computer, operating system, and each section of software responsible for a job, which is commonly considered a driver root user.
  • root user-space process (init and inittab) - This specifies what should be done when the /sbin/init program is told to enter a certain run-level, making it simple for the administrator to set up a specific environment.
  • Boot scripts - There is a single startup script for each managed service (mail, nfs server, cron, and so on) located in a specific directory.

35. Distinguish between the cmp and diff commands.

The cmp command is primarily used to compare two files byte by byte, with the first mismatch shown. The diff command, on the other hand, is used to identify the changes that need to be done to make the two files identical.

36. State the differences between Linux and Unix.

Differences between Linux and Unix are:

37. What are the I/O calls in the Unix System?

A system call is a method for applications to communicate with the operating system. For file management, process control, device administration, information management, and communication, Unix System calls are utilized.

The following are some of the most regularly used I/O System calls:

  • open(pathname, flag, mode) - a command that opens a file.
  • close(filedes) - closes a file that is currently open.
  • create(pathname, mode) is a command that creates a file.
  • write(filedes,buffer,bytes) - writes data to a currently open file.
  • read(filedes, buffer, bytes) - read data from a file that is currently open.
  • lseek(filedes, offset, from) - position an open file using.
  • dup(filedes) - duplicates a file descriptor that already exists.
  • dup2(oldfd, newfd) - replace the old file descriptor with the appropriate file descriptor.
  • ioctl(filedes, request, arg) - Change the behavior of an open file.
  • fcntl(filedes,cmd,arg) - Change the attributes of an open file.

38. In Unix, what exactly is a process?

A process is a set of instructions or a specific instance of a program that is running. Any application that is run generates a process. Processes can be manipulated in the same way that files may. Various qualities are connected with a process:

  • PID stands for Process-ID.
  • PPID stands for Parent Process ID.
  • TTY (Teletypewriter) is the terminal with which the process is attached.
  • UID refers to User Identification.

39. What method do you use to obtain the current date? Is it possible to change the way the date is printed?

The current date may be obtained by entering the 'date' command. If we want the format to be the day, month, date, year, and time, we'll use the following sequence:

set ‘date’ echo $4 $2 $5 $2 $6 $4

40. For Demand paging, what data structures are used?

In operating systems, demand paging is a memory management strategy used to optimize memory utilization and system performance. It enables programs to load data into memory only when needed rather than putting the complete program into memory all at once. This reduces memory waste and boosts overall system responsiveness.

Several data structures are used in demand paging to control the movement of pages between main memory (RAM) and secondary storage (often a hard disc). These data structures are:

  • Page Table: Maps virtual memory addresses to physical memory locations.
  • Page Table Entry (PTE): Contains information about each page, including its state and location.
  • Page Frame Data Table: Tracks the state of page frames in physical memory.
  • Backing Store or Swap Space: Secondary storage where pages are stored when not in memory.
  • Swap Use Table: Monitors the usage of swap space to manage allocation and deallocation.

41. State the difference between shell & environment variables.

Environment variables are accessible to all processes in the current session and are often used for system-wide configuration. Shell variables are specific to the current shell session. The variables are lost when you quit the shell.

They are different in terms of scope and accessibility. Here are other differences between the two: 

42. What exactly is swapping? Describe how a swapper operates.

Swapping is the process of moving a full process to the main memory to be performed. The capacity of the main memory must be more than the process size.

The swapper operates on a high-priority scheduling system. It looks for processes that are sleeping. If none are available, ready-to-run processes are used instead. To be swapped, the process must spend at least 2 seconds in the swapper. If no processes are available, the swapper enters a wait state and waits for the Kernel to call it (every second).

43. In UNIX, what are hidden files?

In UNIX, hidden files are those with a. (dot) before the file name. The standard file manager does not recognize these files.

The following are some instances of hidden files:

44. How to log out of UNIX?

To log out of UNIX type the logout command in the command prompt. Here's the command:

45. How would you reverse a string in UNIX?

To reverse a string in Unix we use the rev command.

$> echo "String" | rev gnirtS

46. How do you define an array in UNIX Shell?

Following is the way to create an array in Shell:

NAME1="Vuitton" NAME2="Chanel" NAME3="Gucci" NAME4="Prada" NAME5="AlexanderMcQueen"

Declaring an array variable in Unix is as follows:

array_name[index]=value

The name of the array is array_name , the index of the item in the array that you want to set is the index , and the value is the value you want to set for that item is value.

47. How do you set up an environment in UNIX?

The shell goes through an initialization process when you log in to the system to set up the environment. This is normally a two-step procedure that begins with the shell reading the files listed below:

  • /etc/profile

The steps are as follows:

The shell checks for the existence of the file /etc/profile.

The shell reads it if it exists. If not, this file will be skipped. There is no error message displayed.

The shell looks in your home directory to determine if the file .profile exists. Your home directory is the first directory you see when you log in.

The shell reads it if it exists; else, it skips it. There is no error message displayed.

When both of these files have been read, the shell shows a prompt: $

When this command shows, you can enter commands.

48. How can you send an email using UNIX?

An email can be sent using the following commands using the UNIX shell.

$mail [-s subject] [-c cc-addr] [-b bcc-addr] to-addr

49. Define piping in Unix.

You can chain two instructions together such that one program's output becomes the input for the next. A pipe is formed when two or more instructions are joined in this manner. To build a pipe, place a vertical bar (|) between two instructions on the command line.

50. What precisely are foreground and background processes in Unix?

Foreground Process:

Every one of the processes you launch by default runs in the forefront. It takes input from the keyboard and displays the results on the screen.

With the ls command, you can observe what's going on. You may use the following command to get a list of all the files in your current directory:

$ls ch*.doc

You can also use ls-lrta command to display hidden files in the current directory.

The process runs in the foreground, the output is sent to my screen, and the ls command waits for input from the keyboard if it needs it (which it doesn't).

Because the prompt will not be available until the program finishes processing and exits, no other commands can be performed (no other processes can be started) while it is running in the foreground.

Background Process:

Without being linked to your keyboard, a background process operates. It waits for any keyboard input if the background operation demands it.

You may run additional commands while a process is running in the background; you don't have to wait for it to finish before starting another!

Adding an ampersand (&) to the end of a command is the easiest method to start a background process.

$ls ch*.doc &

51. What is the definition of a shebang line?

In Unix-like operating systems, a shebang line, sometimes known as a "hashbang" or "pound-bang" line, is a specific comment at the beginning of a script or executable file. It is composed of the characters #! followed by the path to the interpreter to be used to execute the script or program.

For example, in a Python script, the shebang line might look like this:

#!/usr/bin/python3

52. What is the function of the telnet command?

The telnet command is used to establish a connection with a distant Unix/Linux computer.

53. What is the function of the book block?

It includes software called MBR (Master boot record) that loads the kernel on system booting.

54. Explain the significance of the '/etc/passwd' file in UNIX.

The '/etc/passwd' file stores user account information, including usernames, user IDs, group IDs, home directories, and shell information. It is essential for user authentication and system administration.

55. How do you change the ownership of a file in UNIX using the 'chown' command?

You can change the ownership of a file with the 'chown' command by specifying the new owner and, optionally, the new group.

For example: chown newuser:newgroup filename.

56. What is the 'ulimit' command in UNIX used for?

The 'ulimit' command is used to set or display user-level resource limits in UNIX. It allows controlling resource consumption, such as maximum file size, CPU time, and open file descriptors.

57. What is the 'umask' command in UNIX, and how is it used to set file permissions?

'umask' sets the default file permissions for newly created files. It subtracts the specified permission bits from the maximum permission value (usually 666 for files and 777 for directories) to determine the default permissions.

58. Explain the purpose of the 'script' command in UNIX.

The 'script' command is used to record the input and output of a terminal session into a file. It is often used for creating session logs and documenting terminal interactions.

59. Show how to create functions on Unix with an example.

Simply use the following syntax to declare a function:

func_name () { list of commands }

Your function's name is func_name, and you'll refer to it by that name throughout your scripts. After the function name, there must be a parenthesis, then a list of commands contained in braces.

For example:

#!/bin/sh # Define your function here Hello () { echo "Hello World from my Unix" } # Invoke your function

You will get the following output after running the command:

$ksh main.ksh Hello World from my Unix

60. What is the use of the tee command?

The tee command helps in two things. Firstly, it is used to get data from the standard input and send it to the standard output. Secondly, it redirects a copy of that input data into a file that was specified.

61. What is the 'nohup'?

"nohup" is a special command to run a process in the background even when a user logs off from the system.

62. What is the 'gzip' command used for?

The gzip command in Unix is used to compress files, reducing their size.

The basic usage is: gzip file

63. What are Symbolic links?

They are files that only contain the name of another file. The operations on the symbolic link get directed to the file pointed by it. The limitations of connections are eliminated in symbolic links.

64. How many types of job classes are provided by UNIX? Explain them all.

Unix-like operating systems do not have predefined "job classes." Instead, they offer mechanisms like foreground and background jobs, process states, job control, process priorities, and shell scripting, allowing users to manage and categorize tasks and processes based on their specific requirements and characteristics. Users have the flexibility to use these mechanisms to organize and control their jobs and processes effectively.

65. How do you delete a file?

To delete a file, you can use an 'rm command'. The syntax for the rm command is:

$ rm <filename>

You can also use -r with the rm command to delete all the sub-directories recursively.

66. What is a wild-card interpretation?

When a command line contains a wild-card character(s) such as ‘*’ or ‘?’, they are replaced by the shell with a sorted list of files whose patterns match the input command. Wild-card characters are used to set up a list of files for processing, instead of having it specified one at a time.

67. Describe the main features of UNIX.

The main features of UNIX are listed below:

Portability: UNIX applications and scripts can be easily transferred between UNIX systems, ensuring seamless integration.

  • Machine Independence: UNIX is adaptable to different hardware types, ensuring flexibility and cross-platform compatibility.

Multi-User Support: UNIX facilitates concurrent use by multiple users, each with personalized settings and files.

Command Shells: UNIX provides a variety of command-line interfaces (shells) with scripting capabilities for user interactions.

Hierarchical File System: UNIX uses a tree-like structure for organizing files and directories, simplifying file management.

Pipes and Filters: UNIX allows the creation of efficient data processing pipelines through command chaining.

Background Processing: UNIX enables tasks to run in the background independently, freeing up the terminal for other activities.

Utilities: UNIX offers an extensive set of built-in tools and commands for tasks ranging from file management to system administration.

Development Tools: UNIX provides a comprehensive suite of development tools, including compilers, debuggers, and scripting languages, making it a preferred platform for software development.

68. What does Relative pathname signify?

Relative pathname signifies the current directory and parent directory. It also refers to files that are either inconvenient or impossible to access.

69. What's the purpose of the 'gunzip' command?

The gunzip command in Unix is used to decompress gzip-compressed files. It takes a compressed file (with a .gz extension) and restores it to its original, uncompressed state.

The basic usage is: gunzip file.gz

70. Which command is used to find the maximum memory-taking process on the server?

The top command is used to find the maximum memory-taking process on the server. It displays the CPU usage, process ID, and a few other details. The syntax for the command is sh-4.3$ top .

71. Why is it not advisable to use root as the default login?

One needs to keep in mind the concept of Privilege escalation. If any security vulnerability is exploited (for instance, your web browser), not running your programs as root will limit the damage. If your web browser is running as root, any security failures will have access to your entire system.

72. Explain the difference between a process and a thread in Unix.

In a nutshell:

  • Process : Independent program with its own memory and resources.
  • Thread : Lightweight unit within a process that shares the same memory and resources with other threads in that process.

73. What is the difference between swapping and paging?

74. what is fifo.

In Unix, FIFO stands for "First-In, First-Out." It's a named pipe that allows processes to communicate by reading and writing to a shared file-like resource in the sequence in which they were received. It is a unique file format that allows data to be shared between processes in the order it was written. If there is no data to read or the FIFO is full, the process will be blocked. Though it's a special file, it has the same permissions and ownership as ordinary files and is widely used for process communication.

75. What is the purpose of the 'cron' utility in UNIX?

The 'cron' utility is used for job scheduling and automation in UNIX. It allows users to schedule tasks and scripts to run at specified times or intervals.

76. Explain the concept of a Super User.

In Unix, the Super User, also known as "root," is the user with the most privileges who is in charge of important system administrative responsibilities. The root user has the ability to perform any operation on the system, but this power comes with the requirement to exercise prudence in order to avoid security concerns and system instability. To safeguard the root account and the broader system, security techniques such as restricted access and "sudo" are in place.

77. How can you create a symbolic link (symlink) in UNIX?

To create a symbolic link, you can use the 'ln' command with the '-s' option.

For example: ln -s sourcefile linkname.

This creates a symlink named 'linkname' that points to 'sourcefile.'

78. What is the purpose of the 'chroot' command in UNIX?

The 'chroot' command is used to change the root directory for a process, limiting the access of that process to a specific directory and its subdirectories. It is often used for security and isolation purposes.

79. Describe the role of the 'at' and 'batch' commands in UNIX.

The 'at' and 'batch' commands are used to schedule one-time tasks in UNIX. 'at' allows you to schedule a command to run at a specific time, while 'batch' schedules a task to run when the system load is low.

80. What are hard links and how do they differ from symbolic links?

Hard links are multiple directory entries (filenames) that point to the same inode, representing the same file on disk. They essentially create multiple directory entries for a single file. In contrast, symbolic links (symlinks) are separate files that point to another file or directory by its path. Hard links can only point to files on the same filesystem, while symlinks can point to files on different filesystems.

81. How do you change the permissions of a file in UNIX?

You can change file permissions with the 'chmod' command by specifying the desired permissions using symbolic or octal notation. For example, to give read and write permissions to the owner of a file: chmod u+rw filename . Octal notation can be used as well, like: chmod 644 filename for the same permissions.

82. What is the purpose of the 'grep' command in UNIX?

The 'grep' command is used for searching and matching patterns within text files. It is particularly useful for extracting lines or data that match specific criteria using regular expressions.

83. What's the default network stacking protocol for UNIX?

The Internet Protocol (IP) is often the default network stacking protocol in Unix-like operating systems. IP is a basic protocol that allows data to be sent over networks such as the Internet. It implements the addressing and routing mechanisms required for data packets to reach their destinations. Unix systems, such as Linux, rely significantly on IP for network communication. While IP is the most often used network protocol, Unix systems also offer a variety of other network protocols and services to meet a variety of networking requirements.

84. How do you archive and compress files in UNIX using the 'tar' and 'gzip' commands?

To archive files using 'tar': tar -cvf archive.tar files . To compress the archive using 'gzip': gzip archive.tar . To extract: tar -xvf archive.tar.gz .

85. What is the purpose of the 'awk' command in UNIX?

 'awk' is a versatile text processing tool used for data manipulation, reporting, and extraction. It allows users to define patterns and actions to process structured data.

86. How do you set environment variables in UNIX, and what is their significance?

Environment variables are set using the 'export' command.

For example: export MY_VARIABLE=myvalue. 

Environment variables store configuration information and are accessible to all processes in the current session.

87. How do you send signals to processes in UNIX using the 'kill' command?

The 'kill' command is used to send signals to processes. For example, to terminate a process, you can use kill <PID> or kill -9 <PID> to forcefully terminate it.

88. What is the purpose of the 'ifconfig' command in UNIX?

'ifconfig' is used to configure and display network interfaces, including assigning IP addresses, enabling or disabling network interfaces, and obtaining network-related information.

89. What is the alias mechanism? 

The alias mechanism in Unix allows users to create custom shortcuts for frequently used or lengthy commands. The alias command is used to define these shortcuts. For example, you can create an alias like ll for ls -l , making it easier to run commonly used commands.

90. Explain the purpose of the 'ssh' command in UNIX.

The 'ssh' command is used to securely connect to remote systems over a network. It provides encrypted communication and authentication for secure access to remote servers.

91. How do you archive and compress files in UNIX using the 'zip' command?

To create a zip archive: zip archive.zip files .

To extract: unzip archive.zip .

92. What is the purpose of the 'tee' command in UNIX?

The 'tee' command is used to read from standard input and write to standard output and files simultaneously. It is often used to capture and view output while saving it to a file.

93. How can you check available disk space in UNIX using the 'df' command?

The 'df' command is used to display information about available disk space on filesystems. Running 'df' without options will list space usage on all mounted filesystems.

94. How can you view and manipulate the process table in UNIX using the 'ps' command?

The 'ps' command is used to list and manage running processes. You can display a list of processes using various options like 'ps aux,' and use options like 'kill' or 'nice' to manage processes.

95. What is the purpose of the 'lsof' command in UNIX?

The 'lsof' (list open files) command is used to display information about files and network connections opened by processes. It is useful for troubleshooting and identifying which processes have specific files or sockets open.

96. Explain the concept of 'stdin,' 'stdout,' and 'stderr' in UNIX.

'stdin' (standard input), 'stdout' (standard output), and 'stderr' (standard error) are the default data streams for processes. 'stdin' is where a process reads input, 'stdout' is where it writes normal output, and 'stderr' is where it writes error messages.

97. What is the 'chmod' command?

The chmod command in Unix is used to change file and directory permissions. It can be used to grant or restrict read, write, and execute permissions to users, groups, and others.

Basic usage: chmod [options] mode file

98. What is the CAT command?

The cat command in Unix is used to display the file contents. It's short for "concatenate" and is often used to view the contents of a single file. 

For example: cat filename

99. What is the tar command?

The tar command in Unix is used to archive and compress files and directories into a single file. It stands for "tape archive" and is often used for creating backups or bundling multiple files together.

Basic usage:

tar [options] archive_file files/directories

100. What's the role of mount and unmount commands?

The "mount" command attaches file systems to the operating system, making them accessible, while the "umount" (or "unmount") command detaches or unmounts them, ensuring data integrity and safe removal.

Summing up...

Unix specialists are in high demand in the software technology area. Unix allows you to advance in your career by allowing you to pick from a range of job titles such as Unix Engineer, Administrator, Systems Engineer, and Analyst Engineer.

Make sure you practice these interview questions and answers so you're able to showcase your knowledge.

You might also be interested in reading:

  • Difference Between Retesting And Regression Testing Explained (With Examples)
  • Difference Between Scripting And Programming Language | Why Scripting Language Is Considered A Programming Language But Not Vice-Versa?
  • Top 50+ Java Collections Interview Questions
  • What Is Scalability Testing? How Do You Test Application Scalability?

Srishti Magan

I’m a reader first and a writer second, constantly diving into the world of content. If I’m not writing or reading, I like watching movies and dreaming of a life by the beach.

Unstop Talent Park

to our newsletter

Blogs you need to hog!

Best Data Visualization Tools In 2024: A Complete Guide To The Top 10 Tools

Best Data Visualization Tools In 2024: A Complete Guide To The Top 10 Tools

unix assignment questions with answers

Characteristics Of IoT: Definition, Uses & Key Features Explained

Classification Of Embedded Systems In 5 Ways (With Applications)

Classification Of Embedded Systems In 5 Ways (With Applications)

unix assignment questions with answers

Find In Strings C++ | Examples To Find Substrings, Character & More!

unix assignment questions with answers

  • Top Courses
  • Online Degrees
  • Find your New Career
  • Join for Free

15 Linux Interview Questions (With Sample Answers)

Prepare for your interview with these Linux questions and answers as your guide.

[Featured image] A systems administrator in a white sweater reviews Linux interview questions on his laptop in a co-working space.

Interviews can be stressful. One way to alleviate some of that stress is to practice with potential interview questions so you can feel confident and prepared. Depending on the role and company you’re interviewing for, you’ll be asked a series of technical and behavioral questions. 

Engineers, developers, and systems administrators are most likely to be asked questions about Linux operating systems. If during an interview you do not know the answer, explain how you would go about finding the answer and your thought process for moving forward. 

In this article, we’ll guide you through some common questions and answers that you might encounter in an interview.

15 Linux interview questions and answers

Linux is an open-source operating system that is considered faster and more efficient than other operating systems like Windows. Here, we give a range of technical and behavioral questions about Linux—so you can prepare for the interview all in one place.

Technical questions

Linux is just one of several operating systems including Apple’s macOS and Microsoft’s Windows, that developers and programmers use. To land a job in this field, you’ll most likely encounter technical questions and be asked to complete a coding problem or a take-home project.

1. What is Linux?

With this question, the interviewer is examining what you know about Linux. As a developer or programmer , you’re expected to be able to explain the systems and processes you work with clearly and accurately. Linux is a Unix-like, open-source operating system developed by Linus Torvolds in 1991. You can also mention its features, such as security based on authentication and access control, application support, and customizable keywords.

2. What are the basic components of Linux?

Linux’s architecture consists of the following components:

Kernel: The kernel is the core part of Linux OS that is responsible for operations and communicating between hardware and software.

Shell: The shell is an environment in which the Linux operator runs commands, programs, and shell scripts. It is the interface between the user and kernel and is used to execute commands.

System utility: These are software functions that allow the user to manage the computer.

Applications: These are software programs designed to accomplish specific tasks.

What are the real basic components?

Keep in mind that different sources might cite varying core components of Linux. Whether you choose to list three or five components, to include “hardware” or not, the more important thing is to explain why these are the basic components.

3. What is LILO?

LILO stands for Linux Loader, which is a boot loader used for the Linux operating system. Most Linux OS use LILO as a master or secondary program to boot the operating system into main memory to perform functions.

4. What is BASH?

BASH stands for Bourne Again Shell, which is a command language interpreter that is similar to and interchangeable with Bourne Shell. BASH has some extra features and is the default user shell on many Linux installations. It can also read commands from shell scripts.

5. What is swap space?

A swap space is space on a hard disk used when RAM is full. It is considered an extension of RAM when the original RAM doesn’t have enough space to run all the programs or as a substitute for physical memory.

6. What is the difference between Unix and Linux? 

Unix is a proprietary OS with commercial versions, while Linux is free, open-source, and non-proprietary. In other words, Linux is “for the people.”

7. What are shells used in Linux?

Shells that are commonly used in Linux include the following:

bash (Bourne Again Shell): This is the default shell of most Linux systems.

zsh (Z Shell): Default shell for Kali Linux and macOS 

ksh (Korn Shell): High-level programming language shell

Csh (C Shell): Borrows from C programming language

tcsh (Tenex Shell): This is a command-line shell based on the C Shell.

8. What are process states in Linux?

Process states in Linux include the following:

New/Ready: This is when a process is ready to run.

Running: This is when a process is being executed.

Blocked/Waiting: The process needs input or a system resource.

Terminated/Completed: The process has been completed or terminated by the OS.

Zombie: When a process has been paused, but information is still available.

9. What are the advantages and disadvantages of open source?

The advantages of open source is that it is completely free and available to the public, so users can download the file and change the code as desired. As long as they use the same license, they can even sell copies of the modified code. The disadvantages of open source is that it can make the software less compatible with other hardware and systems, and make it more difficult to use. There is also no user support because it is created by potentially thousands of contributors and belongs to the public.

Fun fact: The world’s largest open-source software project

Linux is the world’s largest open-source software project. Anyone can run, analyze, and redistribute the source code. Programmers and developers from different industries are constantly adding features, fixing bugs and security flaws, and sharing new code ideas. Open source is an excellent way for developers to give back to the community.

10. What are the different types of file permissions in Linux?

There are three different types of file permissions in Linux, which can be used by the three types of owners (user, group, others):

Read: Users can open and view the file, but may not modify or run it.

Write: Users can open and modify the file but they cannot execute it.

Execute: Users can execute the file.

Behavioral and situational questions

Across industries, hiring managers ask behavioral questions to assess how a candidate will perform in the workplace. Because these are entirely subjective, we’ll guide you through what the hiring manager wants to know and coach you through how to answer some key behavioral questions. 

11. How do you approach solving a problem?

This question wants to know your process for problem-solving. Explain how you might approach a problem when it arises or is assigned to you, starting with brainstorming, doing research, or testing several potential solutions. You could elevate your response by providing an example of how you approached a relevant problem in the past using the STAR method .

12. Describe your development process, from gathering requirements to deployment.

As a developer or programmer, you’re expected to have your own process for developing and know how to explain it clearly to both developers and non-developers. There isn’t a correct way to answer this question—again, you’re being assessed on how well you can describe the process, which usually means you have your own process and know it well.

13. Can you describe a time you fixed an especially difficult bug? How did you resolve it?

With this question, hiring managers are assessing your technical skills as well as your process for resolving issues. Did you have to tinker with it for a while? How did you go about finding potential fixes? They are interested in how you explain your thinking.

14. Can you describe a time when you had to make a decision between technical feasibility and business impact? What was the outcome?

This question is about understanding how you made the decision. It doesn’t matter what the trade-off was—why did you make the choice you did? Here, they want to know your principles and how you make a decision when there are larger stakeholders involved.

15. Tell me about a situation where you dealt with failure. 

While it may be tempting to twist this failure into a success in your answer, try to answer this question honestly. In most jobs, people will deal with some type of failure. This question helps assess your ability to explain what happened, how you dealt with it, what the outcome was, and most importantly, what you learned from it. They want to know that you possess the soft skills to come out on the other side of failure stronger and better.

Tips to prepare for your interview

Here are some tips and resources to help you bring your best to your Linux interview.

Do your research. Chances are, you already know a little bit about the company you’re interviewing for. However, it’s always a good idea to be thorough. Take a look at the organization’s website and recent news, as well as looking up potential managers or colleagues on LinkedIn to get a better understanding of who is interviewing you. Be prepared to know the lingo for whatever job role you’re pursuing.

Prepare some sample answers. Many people feel nervous just before an interview and this can lead to answering questions less confidently than they hoped. Taking the time to prepare your answers to common interview questions, both technical and behavioral , can help you feel more at ease during the interview. As a bonus, if you stumble upon something you don’t know, you can review it beforehand.

Ask questions. Your time with the hiring manager is precious. You’ll want to take advantage of being able to ask questions to assess the fit—is this the right job for you? Asking questions at the end of the interview about the company’s vision, culture, and flexibility can give you deep insights into whether you want to work there.

Read more: 15 Insightful Questions to Ask a Hiring Manager During Your Next Interview

Build your Linux skills with Google

Learn how to use systems such as Linux, command-line Interface, and binary code. In about six months, you can learn IT Support from Google anytime, anywhere.

Keep reading

Coursera staff.

Editorial Team

Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.

Javatpoint Logo

All Interview

Company interview, technical interview, web interview, php interview, .net interview, java interview, database interview, 22) how to check the date in unix.

To display the date in UNIX use the date command in command prompt.

Unix Interview Questions

23) How to log out in UNIX?

To log out of UNIX type the logout command in the command prompt.

24) How to perform a system shutdown in UNIX?

To perform system shutdown in UNIX, you can use the following commands:

25) How many types of files are there in UNIX?

There are three kinds of files in UNIX:

  • Ordinary files: An ordinary file is the one which contains data, text or program instructions.
  • Directories: These include both ordinary files and special files.
  • Special Files: These are the files which provide unique access to hardware such as hard drives, CD-Rom Drives e.t.c.

26) What are hidden files in UNIX?

Hidden files in UNIX are the files which have a .(dot) before the file name. These files do not show up in the traditional file manager.

Common examples of hidden files are:

27) What is the difference between a single dot and double dot in UNIX?

.(Single dot) -represents the current directory

..(Double dot) -represents the parent directory.

28) How to create files in UNIX?

Creating files in UNIX is simple. The User needs to use the vi editor to create new files.

Type vi filename in command prompt to create new files. We can also use the touch command to create a zero byte file.

29) How to display the contents of a file?

The user can use the cat command followed by the filename to display the command of a file. This command should be entered in the command prompt. The syntax of the command is shown below.

$ cat filename

Where the cat is the command to view contents of the file specified by the filename. Also if you want the line number to be displayed along with the content, you can use cat command with option -b.

30) How to calculate the number of words in a file?

To count the number of words in a file, Use the following command.

$ wc filename

Where wc is the command to count the number of words in the file specified by filename .

31) How to create a blank file in UNIX?

Blank files can be created by using the touch command, the syntax for the touch command is as follows:

$ touch filename

Unix Interview Questions

32) How to know the present working directory in UNIX?

To know the present working directory, Run the following command on the terminal.

Unix Interview Questions

33) How to know the information about a file?

To fetch the information about a file, use the following command.

$ file filename

Unix Interview Questions

34) How to change the directory in UNIX?

To change the directory, you can use the cd command in the terminal window. It changes the current directory to the specified directory.

$ cd directory-name

Unix Interview Questions

35) How to move files from one directory to other in UNIX?

In UNIX, mv command is used to move the file from one directory to some other directory.

$ mv <file-name> <destination path>

Unix Interview Questions

36) How to copy files from one directory to other in UNIX?

In UNIX, cp command is used to copy a file from one directory to some other directory. The syntax of the cp command is given below.

$ cp -r source filename destination file name.

The -r is used to copy all the content of a directory including sub-directories recursively.

Unix Interview Questions

37) How to remove files in UNIX?

To remove files, you can use the rm command. The syntax of the rm command is given below.

$ rm <filename>

we can use -r with the rm command to delete all the sub-directories recursively.

Unix Interview Questions

38) How to make a new directory in UNIX?

To make a new directory, you can use the mkdir command.

$ mkdir <directory-name>

Unix Interview Questions

39) How to remove the directory in UNIX?

To remove the directory, you can use the rmdir command. To use this command, use the following syntax.

$ rmdir filename.

Unix Interview Questions

You may also like:

  • Java Interview Questions
  • SQL Interview Questions
  • Python Interview Questions
  • JavaScript Interview Questions
  • Angular Interview Questions
  • Selenium Interview Questions
  • Spring Boot Interview Questions
  • HR Interview Questions
  • C Programming Interview Questions
  • C++ Interview Questions
  • Data Structure Interview Questions
  • DBMS Interview Questions
  • HTML Interview Questions
  • IAS Interview Questions
  • Manual Testing Interview Questions
  • OOPs Interview Questions
  • .Net Interview Questions
  • C# Interview Questions
  • ReactJS Interview Questions
  • Networking Interview Questions
  • PHP Interview Questions
  • CSS Interview Questions
  • Node.js Interview Questions
  • Spring Interview Questions
  • Hibernate Interview Questions
  • AWS Interview Questions
  • Accounting Interview Questions

Learn Latest Tutorials

Splunk tutorial

Transact-SQL

Tumblr tutorial

Reinforcement Learning

R Programming tutorial

R Programming

RxJS tutorial

React Native

Python Design Patterns

Python Design Patterns

Python Pillow tutorial

Python Pillow

Python Turtle tutorial

Python Turtle

Keras tutorial

Preparation

Aptitude

Verbal Ability

Interview Questions

Interview Questions

Company Interview Questions

Company Questions

Trending Technologies

Artificial Intelligence Tutorial

Artificial Intelligence

AWS Tutorial

Cloud Computing

Hadoop tutorial

Data Science

Angular 7 Tutorial

Machine Learning

DevOps Tutorial

B.Tech / MCA

DBMS tutorial

Data Structures

DAA tutorial

Operating System

Computer Network tutorial

Computer Network

Compiler Design tutorial

Compiler Design

Computer Organization and Architecture

Computer Organization

Discrete Mathematics Tutorial

Discrete Mathematics

Ethical Hacking Tutorial

Ethical Hacking

Computer Graphics Tutorial

Computer Graphics

Software Engineering Tutorial

Software Engineering

html tutorial

Web Technology

Cyber Security tutorial

Cyber Security

Automata Tutorial

C Programming

C++ tutorial

Control System

Data Mining Tutorial

Data Mining

Data Warehouse Tutorial

Data Warehouse

RSS Feed

Top 75+ Unix Interview Questions and Answers you need to know in 2024

Unix has started to expand its market rapidly since the past few years and is one of the Top 10 occurring IT job-requirements. So, we thought of making your job easier by making an ensemble of the most commonly asked Unix Interview Questions which will get you ready for any job interview that you wish to appear. 

The following are the UNIX Interview Questions listed out for you;

Q1. Enlist common shells with their indicators. Q2. Define a single-user system. Q3. List a few significant features of UNIX? Q4. What is Shell? Q5. What are the basic responsibilities of a shell? Q6. What is the general format of UNIX command syntax? Q7. Describe the usage and functionality of the command rm –r *  in UNIX? Q8. Describe the term directory? Q9. Differentiate between absolute and related path? Q10. Which UNIX command lists files/folders in alphabetical order?

So, let’s begin.

Q1. Enlist common shells with their indicators.

The following table enlists the most common shells along with their indicators;

                                                Shell table – UNIX Interview Questions – Edureka

Q2. Define a single-user system. 

A personal computer which possesses an operating system designed to operate by only one user at a given time is known as a single-user system. Single user system becomes more popular since low-cost hardware and availability of a wide range of software to perform different tasks.

Q3. List a few significant features of UNIX?

The following are a few features of UNIX;

Machine independent

Portability

Multi-user operations

Unix Shells

Hierarchical file system

Pipes and filters

Background processors

Development tools

Q4.  What is Shell?

The program which serves as an interface between the user and the system called a shell. It  is the layer of programming that understands and executes the commands a user enters. In some systems, it’s also  called a command interpreter.

Q5. What are the basic responsibilities of a shell?

Following are the responsibilities of a shell;

Program Execution

Input/ output redirection

Filename and variable substitution  

Pipeline hookup

Environment control

Integrated programming language

Q6. What is the general format of UNIX command syntax?

Generally,   UNIX shell commands follow the following pattern

Command (-argument) (-argument) (-argument) (filename)

Q7. Describe the usage and functionality of the command rm –r *  in UNIX?

The command rm –r * erases all files in a directory with its subdirectories.

rm is for deleting files

-r is to delete directories and subdirectories with files within

* is indicate all entries

Q8. Describe the term directory? 

A directory in UNIX is a specialised form of a file that maintains a list of all the files which are included in it.

Q9. Differentiate between absolute and related path?

Absolute path refers to the exact path as defined from the root directory whereas, related path refers to the path related to the current locations.

Q10. Which UNIX command lists files/folders in alphabetical order?

The ls –l command is used to list down files and folders in alphabetical order, sorted with modified time.

Q11. Describe a link in UNIX.

Another name for a file is a link . It is used to assign more than just one name for a file and is not valid to assign more than one name to a directory or to link filenames on different computers.

General command ‘– ln filename1 filename2′

A symbolic link is a file that is used to contain only the name of other files included in it. Directed to the files pointed by it is the operation of the symbolic link.

General command ‘– ln -s filename1 filename2′

Q12. What is FIFO?

FIFO or First In First Out is also known as named pipes and it is a special file for date transient. This data is read-only in the written order and is used to inter-process communications. Here data writes at one end and reads from another end of the pipe.

Q13. What is the fork() system call?

The command used to create a new process from an existing process is called fork(). The main process is called the parent process and new process is called child process. The parent gets the child process is returned and the child gets 0. The returned values are used to check which process which code executed.

The returned values are used to check which process is executed.

Q14. Explain the following statement, “It is not advisable to use root as the default login.”

The given statement means the following;

The root account is very critical and can leads to system damage easily with abusive usage. The securities that normally apply to user accounts are not applicable to the root account. Hence, one should refrain from using root as the default login.

Q15. What is meant by the term Super User?

The Super User is a user with access to all files and commands within the system. In general, this superuser login is to root and the login is secured with the root password.

Q16. Define a process group.

A collection of one or more processes is called a process group. There is a unique process id for each process group. The function getpgrp returns the process group ID for the calling process.

Q17. Name the different file types available with UNIX.

Following the different file types in UNIX;

Regular files

Directory files

Character special files

Block special files

Symbolic links

Q18. What is the behavioural difference between cmp and diff  commands?

Despite the fact that both of these commands are meant for file comparison, there still remains a fundamental difference between the two.

Cmp compares the two given files, byte by byte and displays the first mismatch.

Diff displays the changes that need to be made in order to make both the files identical.

Q19. What do chmod, chown, chgrp commands do?

Following are the purposes of the given UNIX commands;

  • chmod changes the permission set of the file.
  • chown changes the ownership of the file.
  • chgrp changes the group of the file.

Q20. Give the command for finding the current date.

The command “date” is used to retrieve the current date.

Q21. What does this command do, "$more README.txt “?

The command displays the first part of the file names README.txt which just fit as much as on one screen.

Q22. Describe the zip/unzip command using gzip.

The gzip command creates a zip file using given the filename in the same directory.

gunzip command unzip the file.

Q23. Can you explain the method of changing file access permission?

There are three parts to consider when creating/changing file access permission.

File owner’s user ID

File owner’s group ID

File access mode to define

These three parts arrange as follows.

(User permission) – (Group permission) – (Other permission)

Three types of permission can define.

r –   Reading permission

w –   Writing permission

x –   Execution permission

Q24. How would you display the last line of a file?

The last line of a file is displayed using either “tail” or “sed” commands.

                                                   question 24 – UNIX Interview Questions – Edureka

In the example code above, the last line of the README.txt is displayed.

Q25. What are the various IDs in UNIX processes?

A process ID is a unique integer that UNIX uses to identify a certain process.

The process executes to initiate other processes is called parent process and its ID is defined as PPID (Parent Process ID).

  • getppid() retrieves the Parent Process ID

Every process is associated with a specific user and is called the owner of the process. The owner has all the privileges over the process. The owner is also the user who executes the process.

Identification for a user is User ID. The process also associated with Effective User ID which determines the access privileges to accessing resources like files.

getpid()   retrieves the Process ID

getuid() retrieves the User ID

geteuid() retrieves the Effective User ID

Q26. How can you kill a process in UNIX?

The Kill command accepts process ID (PID) as an in a parameter. This is applicable only for the processes owned by the command executor.

Syntax –   kill PID

Q27. What are the pros of executing processes in the background?

The main advantage is to execute processes in the background is to get the possibility to execute some other process without waiting for the previous process to get completed. The symbol “&” at the end of the process tells to the shell to execute given a command in the background.

Q28. What is the command to find maximum memory taking process on the server?

The top command displays the CPU usage, process id, and other details.

Output 

                                                   question 28 – UNIX Interview Questions – Edureka

Q29. What is the command to find hidden files in the current directory?

You use ls –lrta is to display hidden files in the current directory.

                                                   question 29 – UNIX Interview Questions – Edureka

Q30.  Which command can you use to find the currently running process in Unix Server?

ps –ef is a command used to find the current running process. Also, using grep with a pipe can find specific processes.

                                                   question 30 – UNIX Interview Questions – Edureka

Q31. Which command should you use to find the remaining disk space in UNIX server?

The command df -kl is used to get a detailed description of disk space usage.

                                                   question 31 – UNIX Interview Questions – Edureka

Q32. Which UNIX command to make a new directory?

The command mkdir directory_name is used to create a new directory.

Q33. What is the UNIX command to confirm a remote host is alive or not?

You can use either ping or telnet to confirm a remote host is alive or not.

Q34. How can you see the command line history?

The history command displays all the commands used previously in the current session.

                                                   question 34 – UNIX Interview Questions – Edureka

Q35. Differentiate between swapping and paging?

Swapping: In this, the complete process is moved to the main memory for execution. To provide the memory requirement, process size must be less than the available main memory capacity. The implementation is easy but is an overhead to the system. Memory handling is not more flexible with swapping systems.

Paging: In this, only the required memory pages are moved to the main memory for execution. The size of the process does not a matter of execution and it no needs to be less than available memory size. Allow a number of processes to load to main memory simultaneously.

Q36. Which command is used to find whether the system is 32 bit or 64 bit?

arch or uname -a can be used for the required process.

Q37. What is the ‘nohup’ in UNIX?

To run a process in the background,  nohup is a special command. The process started with this command does not terminate even if the user logs off from the system.

Q38. Name the UNIX command to find how many days the server has been up.

The uptime command returns the number of days that the server has been up.

                                                   question 38 – UNIX Interview Questions – Edureka

Q39. Which mode executes the fault handler?

The Kernel mode.

Q40. What does the “echo” command do?

The echo command outputs the strings it is being passed as arguments.

Q41. What is the explanation for protection fault?

When the process accesses a page which does not have access permission, it is referred to as protection fault. Also when a process attempts to write on a page whose copy on write bit was set during the fork() system call, it is incurred for protection fault.

Q42. How can you edit a large file without opening it in UNIX?

The  sed command can be used for this process. In the following example, the code replaces the a ‘s from the README.txt file to  aaa ‘s.

Example 

                                                   question 42 (I)- UNIX Interview Questions – Edureka

                                                   question 42 (II)- UNIX Interview Questions – Edureka

Q43. Describe the concept of “Region”.

A region is a continuous area of processes address space (text, data, and stack). Regions are shareable amongst the processes.

Q44. What is meant by u-area?

The area contains information specific to the process and is only manipulated by the kernel. It contains the private data unique to the process allocated to u-area.

Q45. Explain piping.

Piping(|) is used to combine two or more commands together where the output of the first command serves as the input of the second command, and so on.

Q46. How can you count the number of characters and lines in a file?

The wc – c filename command can retrieve the number of characters in a file and wc –l filename command can retrieve the number of lines in a file.

Q47. What do you understand by UNIX shell?

The UNIX shell serves as an environment to run commands, programs, and shell scripts. In addition to that, it also acts as an interface between the user and the Unix OS. Shell issues $  as the command prompt, which reads input and determines the command to execute.

For example: $date

The command above will display the current date and time.

Q48. Explain the term filter.

A Filter   is described as a program, which takes input from the standard input, and displays results to the standard output by performing some actions on it.

Standard Input could be typed on the keyboard, input from other file or output of other file serving as input. Standard output is default the display screen.

The most popular example of Unix filter id grep command. This program looks for a given pattern in a file or list of files and only those lines are displayed on the output screen which contains the given pattern.

Syntax:   $grep pattern file(s)

Q49. Can you write a command to erase all files in the current directory including all its sub-directories?

rm –r* is the command used to erase all files in the current directory including all its sub-directories.

rm: this command is used for deleting files.

-r : this option will erase all files in directories and sub-directories.

*: this represents all entries.

Q50. Can you explain what does the Kernel do?

The Kernel   is the heart of the operating system. It does not deal directly with the user but rather act as a separate interactive program for users logged in.

It is responsible for the following functions:

Interaction with the hardware

Memory management

File management

Task scheduling.

Computer resources

Allotment of resources to different tasks and users.

Q51. Name the key features of the Bourne shell.

The key features of the Bourne shell include but aren’t limited to the following:

Input/ Output redirection.

Use of Meta-characters for file name abbreviations.

Using shell variables for the customising environment.

Creation of programs using built-in the command set.

Q52. Name the key features of the Korn Shell.

The key features of the Korn shell include but aren’t limited to the following:

Perform command line editing.

Maintains command history so that the user can check the last command executed if required.

Additional flow control structures.

Debugging primitives who help programmers debug their code.

Support for arrays and arithmetic expressions.

Ability to use aliases which are defined as the shorthand names for command.

Q53. What can you tell about shell variables?

A variable is like a name. It is defined as a character string to which a value is assigned, where values could be the number, text, filename, etc. The shell maintains the set of internal variables as well as enables deletion, assignment, and the creation of variables.

Thus, a shell variable is a special variable that is set by the shell and is required by the shell in order to function correctly. Some of these variables are environment variables whereas others are local variables.

So, the shell variables are a combination of identifiers and assigned values that exist within the shell. These variables are local to the shell in which they are defined as well as they work in a particular way. They may have default value or values can be assigned manually by using appropriate assignment command.

To define a shell variable, the set command is used.

To delete a shell variable, the unset  command is used.

Q54. Describe the responsibilities of Shell in brief.

Although most commonly known for analysing the input line as well as initiating the execution of the program entered by the user, the Shell has various other responsibilities. A brief description of this is given to you below;

The shell is responsible for the execution of all the programs by analysing the line and determining the steps to be performed and then initiate the execution of the selected program.

The shell allows you to assign values to the variables when specified on the command line. It also performs Filename substitution.

The shell takes care of input and output redirection.

The shell performs pipeline hook-up by connecting the standard output from the command preceding the ‘|’ to the standard input of the one following ‘|’.

The shell provides certain commands to customise and control environment.

The shell has its own built-in integrated programming language which is typically easier to debug and modify.

Q55. Explain file system in UNIX.

All data in Unix is organised into files. A file system in Unix is referred to as a functional unit or a logical collection of files, where the disk is set aside to store files and inode entries. These directories are organized into a tree-like structure called the file system. Files in Unix System are organized into multi-level hierarchy structure known as a directory tree. At the very top of the filesystem is a directory called “root” usually represented by a / .

Summarising what has been said prior to this, the file system is a collection of files and directories and has a few significant  features mentioned below;

The very top of the file system is defined as the single directory called ‘root’ that contains other files and directories and is represented by an obelic sign (/).

These filesystems are self-independent and have no dependencies on other file systems.

Every file and directory is uniquely identified by the following;

The directory in which it resides

A unique identifier

All files are organised into a multi-level, hierarchical directory known as ‘Directory tree’.

Q56. Define inode.

When a file is created inside a directory, it accesses the two attributes, namely, file name and inode number. The file name is first mapped with Inode number and stored in the table and then this Inode number serves as a medium to access Inode. Thus, an inode can be defined as an entry created and set aside on a section of the disk for a file system. It serves as a data structure and nearly stores each information that is required to be known about a file.

This information usually includes the following details;

The File location on the disk

The Size of the file

The Device Id and Group Id

The File mode information

The File protection flags

The Access privileges for owner, group.

The Timestamps for file creation, modifications

Q57. Differentiate Swapping and Paging.

The difference between Swapping and Paging can be seen in the table below;

                                                table 2 – UNIX Interview Questions – Edureka

Q58. How would you explain a Kernel to a non-technical person?

The  kernel  is the heart of the operating system. It is the lowest level of the operating system and is responsible for translating the command into something that can be understood by the computer.  The resources allocation to different users and tasks handled by this section. The kernel doesn’t have any direct communication with the user and so, it starts a separate interactive program called the shell to each user when login to the system.

Q59. Can you enlist some commonly used network commands?

Some commonly used networking commands in Unix are enlisted below:

telnet: This command is used for remote login as well as for communication with another hostname.

ping: This command is defined as an echo request for checking network connectivity.

su: This command is derived as a user switching command.

hostname: This command determines the Ip address and domain name.

nslookup: This command performs a DNS query.

xtraceroute: This command is used to determine the number of hoops and response time required to reach the network host.

netstat: This command provides a lot of information like ongoing network connection on the local system and ports, routing tables, interfaces statistics, etc.

Q60. What is the significance of the superuser?

There are essentially three types of accounts in the Unix operating system;

The Root account

The System accounts

The User accounts

Amongst the aforementioned, the Root account is commonly referred to as the Superuser. This user has a completely open access on all files and commands on the system. This superuser account can also be assumed as a system administrator and hence, has the ability to run any command without any restriction. It is protected by the root password.

Q61. What does a pipe(|) do?

When two or more commands are required to be used at the same time as well as run consecutively, you use an operator known as the pipe(|) . What it does is it connects two commands in such a fashion that, the output of one program serves as the input for another program.

Enlisted below are a few commands where the pipe operator is used;

grep command: searches files for certain matching pattern.

sort command: arranges lines of text alphabetically or numerically.

Q62. Explain a path in UNIX.

In a file system for any operating system, there exists the hierarchy of directories, there ‘Path’ is defined as the unique location to a file/ directory to access it.

Q63. Explain the different types of pathnames that are used in UNIX.

There are basically two types of pathnames that are used in Unix. These can be defined as follows:

  • Absolute Pathname:   It defines a complete path specifying the location of a file/ directory from the very start of the actual file system i.e. from the root directory (/). Absolute pathname addresses system configuration files that do not change location. It defines a complete path specifying the location of a file/ directory from the very start of the actual file system i.e. from the root directory (/). Absolute pathname addresses system configuration files that do not change location.
  • Relative Pathname: It defines the path from the current working directory where the user is i.e. the present working directory (pwd). Relative pathname signifies current directory, parent directory as well as also refers to file that are either impossible or inconvenient to access. It defines the path from the current working directory where the user is i.e. the present working directory (pwd). Relative pathname signifies current directory, parent directory as well as also refers to file that are either impossible or inconvenient to access.

Q64. Explain Superblock in UNIX.

A SuperBlock is essentially a program that contains a record of specific file systems.

Characteristics such as the block size, the empty and the filled blocks and their respective counts, the size and location of the inode tables, the disk block map, and usage information, and the size of the block groups are available in a superblock.

There are basically two types of superblocks which are the following;

Default superblock: It has its existence always as a fix offset from the beginning of the system’s disk partition.

Redundant superblock: It is referenced when the default superblock is affected by a system crash or some errors.

Q65. Enlist some filename manipulation commands in UNIX.

Here are some filename manipulation commands along with their description, enlisted in the table below;

                                                table 3 – UNIX Interview Questions – Edureka

Q66. Explain links and symbolic links.

Links are called as a second name which is used to assign more than one name to a file. Although links are referred to as a pointer to another file it cannot be used to link filenames on different computers.

A   Symbolic link   is also known as the soft link is defined as a special type of file that contains links or references to another file or directory in the form of an absolute or a relative path. It does not contain the data actually in the target file but the pointer to another entry in the file system. Symbolic links can be used to create a file system, too.

The following command is used to create a symbolic link;

Ln –s target link_name

Here, path is ‘target’

Name of the link is represented by link_name.

Q67. What is alias mechanism? Explain.

To avoid typing long commands or to improve efficiency, the alias command is used to assign another name to a command. Basically, it acts as a shortcut to the larger commands which can be typed and run instead.

For creating an alias in Unix, following command format is used:

alias name=’command you want to run’

Here, replace the ‘name’ with your shortcut command and replace ‘command you want to run’ with the larger command of which you want to create an alias of.

For example:

alias dir ‘Is –sFC’

here, in the example above, dir  is another name for the command Is-sFC . Thus, the user now simply is required to remember and use the specified alias name and the command will perform the same task as to be performed by the long command.

Q68. Can you tell me something about wildcard interpretation?

Wildcard characters are some special kind of characters that represent one or more other characters.   Wildcard interpretation   comes into the picture when a command-line contains these characters. In this case, when the pattern matches the input command, these characters are replaced by a sorted list of files.

The Asterisk (*) and   Question mark (?) are usually used as wildcard characters to set up a list of files while processing.

Q69. Explain the terms ‘system calls’ and ‘library functions’ with respect to UNIX commands?

System calls: As the name implies, system calls are defined as an interface which basically is used in the kernel itself. Although, they may not be fully portable but these calls request the operating system to perform tasks on behalf of user programs.

The system calls appear as a normal C function. Whenever a system call is invoked within the operating system, the application program performs context switch from user space to kernel space.

Library functions:  The set of common functions that are not part of the kernel but is used by the application programs are known as ‘Library functions’. As compared to system calls, library functions are portable and can perform certain tasks only in ‘kernel mode’. Also, it takes lesser time for execution as compared to the execution of system calls.

Q70. Explain   PID.

A   PID   is used to denote a unique process id. It basically identifies all the processes that run on the Unix system. It does not matter whether the processes are running in the foreground or in the background.

Q71. What are the possible return values of kill() system call?

Kill() system   call is used to send signals to any processes.

This method returns the following return values;

Returns 0: It implies that the process exists with the given PID and the system allows sending signals to it.

Return -1 and errno==ESRCH: It implies that there is no existence of the process with specified PID. There may also exist some security reasons which is denying the existence of the PID.

Return -1 and errno==EPERM: It implies that there is no permit available for the process to be killed. The error also detects whether the process is present or not.

EINVAl : it implies an invalid signal.

Q72. Name the various commands that are used for the user information in UNIX.

The various commands that are used for displaying the user information in Unix are enlisted as follows;

id: This command displays the active user id with login and group.

last: This command displays the last login of the user in the system.

who: This command determines who is logged onto the system.

groupadd admin: This command is used to add group ‘admin’.

usermod –a: This command is used to add an existing user to the group.

Q73. What do know about tee command and its usage?

‘tee’ command   is basically used in connection with pipes and filters.

This command basically performs two tasks:

a) Get data from standard input and send it to the standard output.

b) Redirects a copy of the input data to the specified file.

Q74. Explain mount and unmount command.

Mount command:    As the name suggests, the mount command mounts a storage device or file system onto an existing directory and thus making it accessible to users.

Unmount command:   This command unmounts the mounted file system by safely detaching it. It also the task of this command to inform the system to complete any pending read and write operations.

Q75. What is “chmod” command?

Chmod command   is used to change file or directory access permission and is the most frequently used command in Unix. According to mode, chmod command changes the permission of each given file.

The syntax of chmod command is:

Chmod [options] mode filename .

Here in the above format, options could be:

-R: recursively change the permission of file or directory.

-v: verbose, i.e. output a diagnostic for every file processed.

-c: report only when the change is made.

Q76. Can you explain a little bit about command substitution?

Command substitution   is a method which is performed every time the commands that are enclosed in back-quotes are processed by the shell.  This procedure replaces the standard output and displays on the command line.

Command substitution can perform the following tasks;

Invoke sub-shells

Result in word splitting

Remove trailing new lines

Allow setting a variable to the content of the file by using ‘redirection’ and ‘cat’ command

Allow setting a variable to the output of the loop

These were all the UNIX interview questions we could think of. These UNIX interview questions would cover you for any interview you’d appear for, in the shortest possible time frame. If you have any interesting questions that have been asked to you in an interview you’ve appeared before, feel free to drop them at the comments bar and we shall answer them for you. You could also refer to this video which explains the solutions to these problems in depth.

Recommended videos for you

Linux administration : past, present & is the future, recommended blogs for you, how to install java/jdk on ubuntu 18.04, your complete solution to shell scripting interviews in 2024, 20 linux commands you’ll actually use in your life, why do you need the different linux shells, 10 steps to create multiple virtual machines using vagrant, duties of a linux administrator, how to dual boot ubuntu and windows 10 in 5 simple steps, top reasons to master unix shell scripting in 2016, linux tutorial: everything you need to know to get started with linux, top 50 linux interview questions for beginners in 2024, linux – making the right career choice, how to install ubuntu: the complete guide, unix vs linux: difference and comparison, linux vs windows: which one is the best choice for you, what is linux mint and how is it better than ubuntu, join the discussion cancel reply, trending courses in operating systems, linux administration certification training c ....

  • 14k Enrolled Learners

Linux Fundamentals Certification Training

  • 11k Enrolled Learners

Unix Shell Scripting Certification Training

  • 5k Enrolled Learners
  • Weekend/Weekday

Browse Categories

Subscribe to our newsletter, and get personalized recommendations..

Already have an account? Sign in .

20,00,000 learners love us! Get personalised resources in your inbox.

At least 1 upper-case and 1 lower-case letter

Minimum 8 characters and Maximum 50 characters

We have recieved your contact details.

You will recieve an email from us shortly.

Due: Mon Apr 8 11:59 pm No late submissions accepted.

No late submissions are accepted on this assignment (except for OAE accommodations or granted extensions). The deadline is firm without exception.

Assignment by Michael Chang, Julie Zelenski, and Chris Gregg, with modifications by Nick Troccoli

We'll discuss the terminal and text editors even more during lecture 2, so that lecture material is needed to get the starter project, edit files, and complete the intruder detection portion of the assignment. However, prior to then, you can get your computer set up to log into the myth machines by installing a terminal program, review the course syllabus, and complete the honor code survey linked below.

Learning Goals

The goals for this assignment are for you to get familiar with working in the Unix environment, and editing/building/running C programs.

Unix and C Resources

The pages in the Handouts dropdown above have information, including videos, for various Unix commands, tools, and more that we'll be using this quarter. We highly recommend reading through the getting started guide and unix guide and trying out various commands and tools yourself, to get practice. In particular, some of the activities in this assignment will rely on information you will need to read up on there. Note that you don't need to memorize all the information, but you may start to memorize lots of commands just by repetition.

Before starting the assignment, double-check that you are comfortable with these Unix fundamentals - discussed in the getting started guide.

View Getting Started Guide

  • Log in to myth
  • Did you create a CS107 directory to hold and organize your work?
  • Can you find the code we're showing off in lecture?
  • You should be able to create a new file, edit its contents, save, and exit.
  • For emacs , you should be able to interact via the mouse (e.g. selecting text, scrolling, etc.)
  • If you encounter a command that is new to you, how can you get more information about it?
  • Have you tried using tab-completion to avoid manually typing long commands/paths?

Additionally, take a look at the guide in the assignments dropdown about working on assignments. It outlines everything you need to know about working through a CS107 assignment, from getting the starter code to testing to submitting. We will refer to this document many, many times throughout this assignment, so keep it handy as you work through this page.

View Assignments Guide

Cloning The Assignment

To get started on the assignment, you must "clone" the starter code to get a copy you can work on. Check out the assignments guide for how to do this.

If you attempt to clone and receive an error that the repository does not exist :

  • double-check for typos in the path. The path needs to be typed exactly as specified. This includes the odd-looking $USER at end, which is a environment variable that expands into your username automatically.
  • be sure you are logged into myth

If you confirm you are on a myth system and your correctly-typed path is not available, this indicates that you were not on the Axess enrollment list at the time we created the student starter code projects. Please send an email to the course staff and tell us your username so we can manually set up the starter code for you. Please make sure to enroll in Axess as soon as possible so that the starter code is automatically generated for you in the future.

Provided Files

The starter project contains the following:

  • readme.txt : a text file where you will answer questions for the assignment
  • triangle.c , Makefile and custom_tests : used to build and test the triangle program
  • SANITY.ini : the configuration for Sanity Check. You can ignore this file.
  • server_files : a folder that pertains to the first part of the assignment.
  • triangle_soln : an executable solution for the Triangle program. You can run this program to see how a completed solution program should behave. This program is also used to check correctness in sanity check.
  • tools : contains symbolic links to the sanitycheck and submit programs for testing and submitting your work.

Symbolic links mean that the files actually live in the CS107 class directory, but appear just like normal files in your starter code folder. Note that the shared directories are not editable by you, so you will not be able to create, edit, or delete files within these directories, since they actually live in the CS107 class directory.

1. Enrollment Confirmation

In order to complete your enrollment in CS107, you must fill out the readme with some information about you, confirm your ability to attend the final exam and accept the course Honor Code policy.

Open the readme.txt file in your editor now and edit as appropriate.

As part of this, you must complete the Honor Code Form. When grading your assign0, we will check that you made a submission through this form, so please make sure to fill it out!

Access the Honor Code Form

Course TODOs:

Once you have done this, also complete the following setup tasks:

  • Join our course discussion forum by visiting the Getting Help page.
  • Remember to submit your lab preferences (not first-come-first-serve) between Tue Apr 2 12:00 pm PDT and Sat Apr 6 5:00 pm PDT .

2. Intruder Detection

For this activity, you will investigate a simulated break-in and answer the questions below. Type your answers into the readme.txt file. For each, briefly describe (in 1-2 sentences) how you arrived at that answer and what Unix commands you used (text editor keyboard shortcuts (e.g. emacs commands) do not classify as Unix commands).

Activity Learning Goals: In class we have taught you the basics of Unix: how to login to myth, how to make directories, and how to list files. In this activity, you will further develop your Unix skills by understanding how to use common Unix commands beyond what we know so far. The how-to's of many of the commands you will learn are available on our CS107 Unix guide, under "Handouts". We recommend you browse this guide as you complete this activity:

View Unix Guide

Situation: An intruder had broken into your dorm's unix-based server and deleted most of the files! Fortunately, there is a backup of the server contents, but before restoring the files, you'd like to know who the intruder was and what they did. With your newly-developed Unix skills, you are just the expert to help investigate.

The key files are available in the directory samples/server_files , which you can access within your assign0 directory.

The first thing you want to determine is the username of the intruder. The server is used by many different users. Each user has a home directory under home/ . For example, the home directory for the user bob would be the path home/bob . The file users.list contains a list of all the authorized users. In an uncompromised system, each home directory would correspond to a user on the authorized list and vice versa. The intruder is not an authorized user and they gained illicit access by inserting their own home directory onto the system. This means there is one home directory that doesn't belong, and your job is to find it.

Manually cross-comparing the users.list to the directory contents would be time-consuming. Instead, what Unix commands can you use to help? Check out the Unix guide for some ideas.

Hint: the samples/ folder and everything inside it is a shared, read-only folder for all students for this assignment. For this reason, you can't create any new files within samples , and you can't create new files outside of samples from within the samples folder. If you need to create a temporary file, try creating it directly inside your assign0 directory instead.

  • What is the username of the intruder? Include the details on how you figured out the answer, and what Unix command(s) you used. You should use Unix commands as much as possible, even if other by-hand alternatives exist (as a clarification, commands within a text editor - e.g. emacs - are not Unix commands).

Now that you know the intruder's username, you can examine the files in intruder's home directory to learn what they were up to. Though the intruder tried to delete all the home directory files as part of covering their tracks, you can see that this supposedly empty directory is still taking up space. Perhaps something interesting was overlooked?

Take a closer look to find out what files have been left behind. Open each of the files in the intruder's home directory to see their contents.

  • There is one file in the intruder's home directory that provides critical information about their activities. What file is that and what does it contain? Include the details on how you figured out the answer, and what Unix command(s) you used. You should use Unix commands as much as possible, even if other by-hand alternatives exist (as a clarification, commands within a text editor - e.g. emacs - are not Unix commands).

You believe that the intruder used sudo to execute some commands as a privileged user. You want to identify those commands, but the file is rather long to comb through by hand. What Unix command can you use to extract the information you seek?

  • Which commands did the intruder execute using sudo ? Include the details on how you figured out the answer, and what Unix command(s) you used. You should use Unix commands as much as possible, even if other by-hand alternatives exist (as a clarification, commands within a text editor - e.g. emacs - are not Unix commands).

3. C Introduction

The final task of the assignment gives you practice using the Unix development tools to edit, build, run, and test a short C program.

In your assign0 folder, type make . This will build the program named triangle . Run the program to see what it does:

You should be rewarded with an ascii representation of Sierpinski's triangle - cool! Try to run make again:

This isn't an error; it simply means that nothing has changed in the program's source, so there isn't anything to re-compile.

Open triangle.c in a text editor and change the value of the #define d value, DEFAULT_LEVELS above main from 3 to 5. After you have saved the file, you must then use make to re-build the program , and then you can run the newly built program to see the bigger triangle. If you forget to re-run make , you will run the original version of the program that has not been updated!

The starter code uses a fixed constant for the number of levels to print. Your task is to extend the program to take an optional command-line argument that allows the user to dictate the number of levels. With no arguments, ./triangle should default to a level 3 triangle, but the user should also be able to provide a numeric argument, e.g. ./triangle 4 or ./triangle 2 , to control the number of levels. If given an unworkable number of levels (anything larger than 8 gets unwieldy and negative would be nonsensical), your program should reject it with a helpful and explanatory message that informs the user how to correct their error, and then terminate early with an exit status of 1 (this indicates something went wrong with the program execution). The best function to do this is the error function; check out the manual pages ( man 3 error ) for more information about this function (Fun fact: man pages have information for both Unix commands and built-in C functions!) One note is that you should specify an errnum of 0 , since we don't need to print out an error message corresponding to a specific error code. Try to figure out the values for the remaining parameters. You must exactly match the error message of the sample solution . Note : You may assume that the user will enter an integer value, and do not have to worry about handling arguments that are not valid integers. If the user specifies multiple command-line arguments, you should use just the first one .

When applicable, you should define constants in your program rather than using "magic numbers", which are numbers hardcoded into your program. See the starter code for an example of how to do this in C.

In order to complete this task, the program will need to convert the user's argument (supplied in string form) into an integer. The C library function atoi can be used to do this. Review the man page ( man atoi ) or look in your C reference to get acquainted with this function.

Now let's test the program implementation. The Sanity Check tool is included in the assignment starter project, and acts as a testing aid. Read the guide to working on assignments for more information about how to use it.

The default sanitycheck for assign0 has one test that validates the output of the triangle program when given no argument. The unmodified starter program code should pass this test. After you have extended the triangle program to accept an argument, the program should continue to pass the default sanitycheck, but you will need new tests to validate the argument-handling.

You extend sanitycheck to test additional cases by using a custom tests file. The starter project includes a custom_tests file. Open this file in your editor to see the format. Now consider what additional test cases are needed to fully vet the output of your new, improved triangle program. You will need at least two additional tests. Add those tests to this custom_tests file and use these with sanitycheck to validate that your triangle program passes all tests. For more information about how to run your custom tests, check out the guide to working on assignments. For tips on thorough testing, check out our testing guide, linked to from the assignments dropdown.

Once you are finished working and have saved all your changes, check out the guide to working on assignments for how to submit your work. We recommend you do a trial submit in advance of the deadline to familiarize yourself with the process and allow time to work through any snags. You may submit as many times as you would like; we will grade the latest submission.

You should only need to modify the following files for this assignment: readme.txt , triangle.c , custom_tests .

We would also appreciate if you filled out this homework survey to tell us what you think once you submit. We appreciate your feedback!

The assignment is graded out of about 26 functionality points, plus a bucket grade for style. Full credit will be awarded for reasonable answers to the questions in the readme.txt file and a correct modification of triangle.c and custom_tests . This assignment is worth far fewer points than all of our other assignments. But, hey, we expect each and every one of you to earn all of the points on this one!

Post-Assignment Check-in

How did the assignment go for you? We encourage you to take a moment to reflect on how far you've come and what new knowledge and skills you have to take forward. Once you finish this assignment, you should have your environment configured and should be starting to feel comfortable with the command-line interface, navigating the filesystem, using a Unix text editor, and getting around Unix. You're off to a great start!

To help you gauge your progress, for each assignment/lab, we identify some of its takeaways and offer a few thought questions you can use as a self-check on your post-task understanding. If you find the responses don't come easily, it may be a sign a little extra review is warranted. These questions are not to be handed in or graded. You're encouraged to freely discuss these with your peers and course staff to solidify any gaps in your understanding before moving on from a task. They could also be useful as review for our exams.

  • Identify a few different techniques to avoid painstakingly re-typing a long Unix command to execute.
  • How do you copy and paste in your text editor?
  • Explain the purpose and use of the CS107 tools sanitycheck and submit . How do you customize the tests used by sanity check?

Frequently Asked Questions

When i try to run the triangle program in my directory, it responds "command not found". what's wrong.

Unix wants you to instead refer to the program by its full name ./triangle . See our Unix guide for more information.

How do I use the sample executable? How does it relate to sanity check?

Our provided sample executable can be used a reference implementation during testing. Run the solution and your program on the same input and verify the output is the same:

If your program produces the same result as the sample, all is good. You can manually "eyeball" the two results, or run sanitycheck with the provided tests, or your own tests. You can find more information about sanity check in our guide to working on assignments.

InterviewPrep

30 UNIX Administrator Interview Questions and Answers

Common UNIX Administrator interview questions, how to answer them, and example answers from a certified career coach.

unix assignment questions with answers

In the world of operating systems, UNIX has maintained its status as a highly reliable and secure choice for many organizations. As a UNIX Administrator, you are tasked with managing, maintaining, and troubleshooting these critical systems to ensure smooth operations. Before you can prove your expertise in this area, however, you must first navigate the interview process.

To help you make a strong impression on potential employers and showcase your extensive knowledge of the UNIX environment, we’ve assembled a list of common UNIX Administrator interview questions along with tips and guidance on how to answer them effectively.

1. What is the difference between UNIX and Linux?

Technical knowledge is essential for a UNIX Administrator, and this question tests your understanding of the two closely related yet distinct operating systems. As a candidate, you’re expected to demonstrate your expertise in UNIX and Linux, as well as your ability to differentiate between the two. This question also helps the interviewer gauge your awareness of the history and development of these platforms, which is important for a UNIX Administrator role.

Example: “The primary difference between UNIX and Linux lies in their origin, licensing model, and the organizations that maintain them. UNIX is a proprietary operating system originally developed by AT&T Bell Labs in the late 1960s. It has since evolved into various commercial versions maintained by different companies such as IBM’s AIX, HP’s HP-UX, and Sun Microsystems’ Solaris.

On the other hand, Linux is an open-source operating system created by Linus Torvalds in the early 1990s, inspired by UNIX principles. The development of Linux is community-driven, with numerous distributions available like Ubuntu, Fedora, and CentOS. These distributions are free to use, modify, and distribute, making Linux more accessible and adaptable compared to its UNIX counterparts.

While both UNIX and Linux share many similarities in terms of functionality, commands, and architecture, their differences in licensing and maintenance models have led to distinct user bases and applications within the industry.”

2. Can you explain the role of the inode in a UNIX file system?

Diving into the technical details of a UNIX system is essential for any administrator. The inode plays a critical role in managing files, and understanding its function demonstrates your knowledge of the underlying structure of a UNIX file system. This question helps interviewers assess your technical expertise and your ability to explain complex concepts in a clear and concise manner.

Example: “Certainly, the inode is a fundamental component of the UNIX file system. It serves as a data structure that stores essential information about a file or directory, excluding its name and actual content. Each file or directory has a unique inode assigned to it, which contains metadata such as file size, ownership, permissions, timestamps, and pointers to the disk blocks where the file’s data is stored.

When a user accesses a file, the file system utilizes the inode number to locate the corresponding metadata and retrieve the necessary information for processing the request. This efficient approach allows the UNIX file system to manage files effectively while minimizing performance overheads. In summary, inodes play a critical role in organizing and managing files within the UNIX file system by storing vital metadata and enabling quick access to file contents.”

3. Describe the process for creating a new user account on a UNIX system.

As a UNIX administrator, one of your key responsibilities is managing user accounts and access to the system. Interviewers ask this question to gauge your knowledge and experience with creating and maintaining user accounts on a UNIX system. They want to ensure that you are familiar with the necessary commands, user management tools, and best practices when it comes to user account creation and security.

Example: “To create a new user account on a UNIX system, I would first log in as the root user or use sudo privileges to ensure that I have the necessary permissions. Then, I would use the ‘useradd’ command followed by the desired username for the new account. For example: useradd newuser . This command creates a new user with default settings such as home directory and shell.

After creating the new user, it’s essential to set a secure password using the ‘passwd’ command followed by the username: passwd newuser . The system will prompt me to enter and confirm the new password. Once the password is set, the new user account is ready for use. If needed, additional configurations like assigning the user to specific groups or modifying their home directory can be done using commands like ‘usermod’ and ‘gpasswd’.”

4. How do you monitor system performance in UNIX? Which tools do you use?

Employers want to ensure you have a comprehensive understanding of UNIX system administration, including the ability to monitor and optimize performance. By asking about the tools and techniques you use, they’re seeking insight into your technical expertise, your ability to adapt to new technologies, and your problem-solving skills in maintaining a stable and efficient UNIX environment.

Example: “Monitoring system performance in UNIX is essential to ensure optimal functioning and identify potential issues before they escalate. I primarily use a combination of built-in command-line tools and third-party monitoring solutions for comprehensive analysis.

Some of the command-line tools I frequently utilize include top, vmstat, iostat, and sar. Top provides real-time information on processes and resource usage, while vmstat offers insights into memory, CPU, and disk utilization. Iostat helps me monitor input/output statistics for devices and partitions, and sar collects and reports system activity data over time.

For more advanced monitoring, I rely on third-party solutions like Nagios or Zabbix. These tools offer customizable dashboards, alerting systems, and detailed reporting features that help me proactively manage system performance and address any bottlenecks or anomalies efficiently. This combination of native and external tools allows me to maintain a high level of performance and stability within the UNIX environment.”

5. Explain the purpose of the /etc/passwd and /etc/shadow files.

As a UNIX administrator, you’ll need to have a solid understanding of the system’s core components and the files that play a vital role in its operation. The /etc/passwd and /etc/shadow files are integral to user management in a UNIX system. By asking this question, interviewers aim to gauge your proficiency in managing user accounts, as well as your comprehension of system security and the importance of safeguarding sensitive information.

Example: “The /etc/passwd file is a fundamental configuration file in UNIX-based systems that stores user account information. It contains details such as the username, user ID (UID), group ID (GID), home directory, and default shell for each user on the system. This file is readable by all users to allow various applications and utilities to access necessary user information.

On the other hand, the /etc/shadow file serves as a security measure to store encrypted password hashes for user accounts. Unlike the /etc/passwd file, the /etc/shadow file has restricted access, typically only readable by the root user or privileged processes. This separation of sensitive data from general user information helps protect against unauthorized access and potential attacks targeting user passwords.”

6. What are some common UNIX commands for managing processes?

UNIX administrators play a critical role in managing and maintaining a system’s efficiency and stability. By asking about common commands for managing processes, interviewers gauge your understanding of the UNIX environment and your ability to navigate and troubleshoot issues effectively. Knowledge of these commands demonstrates your competence in handling the day-to-day tasks and challenges that come with being a UNIX administrator.

Example: “As a UNIX Administrator, managing processes is an essential part of the job. Some common UNIX commands for process management include:

1. ‘ps’: This command displays information about active processes and their corresponding process IDs (PIDs). It can be used with various options to customize the output, such as ‘ps -ef’ to display extended information about all running processes.

2. ‘top’: This interactive command provides a real-time view of system performance, displaying information on CPU usage, memory consumption, and other vital statistics. It also lists currently running processes sorted by resource utilization, making it easy to identify resource-intensive tasks.

3. ‘kill’: This command allows you to terminate a specific process by providing its PID. For example, ‘kill 12345’ would terminate the process with the PID 12345. You can also use different signals with the kill command, like ‘kill -9’ for a forceful termination.

4. ‘nice’ and ‘renice’: These commands are used to adjust the priority of a process. The ‘nice’ command launches a new process with a specified priority level, while ‘renice’ modifies the priority of an existing process. Lower numeric values indicate higher priority levels.

These commands, among others, help UNIX Administrators effectively manage processes, ensuring optimal system performance and stability.”

7. Describe the steps to configure a network interface in UNIX.

Demonstrating your ability to configure network interfaces in UNIX is essential as it showcases your expertise with the system and its administration. This question aims to assess your knowledge of UNIX networking and your ability to perform related tasks effectively. It also helps the interviewer gauge your familiarity with network configuration commands and configuration files, which are critical to maintaining a well-functioning UNIX environment.

Example: “To configure a network interface in UNIX, the first step is to identify the name of the interface you want to configure. You can use the “ifconfig -a” command to list all available interfaces and their current configurations.

Once you have identified the interface, you can proceed with configuring its IP address, netmask, and other settings using the “ifconfig” command followed by the interface name. For example, to set an IP address and netmask for the “eth0” interface, you would enter:

ifconfig eth0 <IP_address> netmask <netmask>

After setting the IP address and netmask, you need to configure the default gateway for the system. This can be done using the “route” command as follows:

route add default gw <gateway_IP> <interface_name>

To make these changes persistent across reboots, you should update the appropriate configuration files. On most UNIX systems, this involves editing the “/etc/network/interfaces” file or similar, depending on your specific distribution. Add the necessary lines to define the interface, IP address, netmask, and gateway, then save the file.

Finally, restart the networking service to apply the new configuration using the following command:

/etc/init.d/networking restart

This process ensures that the network interface is properly configured and will maintain its settings even after a system reboot.”

8. What is the significance of the root user in UNIX systems?

Understanding the role of the root user is critical to managing UNIX systems effectively and securely. As the most powerful user on a UNIX system, the root user has unrestricted access to all files, commands, and resources. This question helps interviewers gauge your knowledge of system administration, your understanding of the potential risks associated with root access, and your ability to manage those risks responsibly.

Example: “The root user, also known as the superuser or administrator, holds a significant role in UNIX systems due to its unrestricted access and control over all aspects of the system. As the root user, one has the ability to read, write, and execute files across the entire file system, manage users and groups, install and remove software, and modify system configurations.

This level of authority is essential for performing critical administrative tasks such as system maintenance, security updates, and troubleshooting. However, it also comes with inherent risks, as any mistakes made while operating as the root user can lead to severe consequences, including data loss or system instability. Therefore, it’s important for administrators to exercise caution when using the root account and follow best practices like employing the principle of least privilege and utilizing sudo for executing specific commands with elevated privileges.”

9. Explain the concept of hard links and soft links in UNIX.

Probing you on the concepts of hard links and soft links in UNIX allows the interviewer to assess your understanding of fundamental file system structures. This is important because knowing the difference between the two types of links and their implications is essential for managing files effectively and ensuring smooth system operations as a UNIX Administrator.

Example: “Hard links and soft links are two types of file system links in UNIX that serve different purposes.

A hard link is a direct reference to the inode of a file, which means it points directly to the data blocks on disk where the file’s content is stored. Creating a hard link essentially creates another entry for the same file in the filesystem, allowing multiple filenames to refer to the same data. Hard links share the same inode number as the original file, and any changes made to one will be reflected in all linked files. However, hard links cannot span across different filesystems or link to directories.

On the other hand, a soft link (also known as a symbolic link) is an indirect reference to a file or directory. It contains a path pointing to the target file rather than referencing its inode. Soft links can span across different filesystems and link to both files and directories. Unlike hard links, if the target file is deleted or moved, the soft link becomes invalid, resulting in a “broken” link.

Understanding the differences between hard links and soft links is essential for efficient file management and organization in UNIX systems.”

10. What are the different types of file permissions in UNIX, and how can they be modified?

Understanding file permissions is a key aspect of being a UNIX Administrator, as permissions play a critical role in ensuring the security and proper functioning of a system. By asking this question, interviewers want to assess your knowledge of UNIX file permissions, their various types, and how to modify them, ensuring that you can effectively manage and maintain a secure environment for the organization’s data and applications.

Example: “There are three types of file permissions in UNIX: read (r), write (w), and execute (x). These permissions can be assigned to three different categories of users: the owner, the group, and others. The owner is the user who created the file or directory, the group consists of a set of users who share access rights, and others refer to all other users on the system.

To modify these permissions, we use the ‘chmod’ command followed by a combination of letters and symbols representing the desired permission changes. For example, ‘chmod u+x filename’ would grant execute permission to the owner of the file, while ‘chmod g-w filename’ would remove write permission from the group. Alternatively, you can use numeric codes (octal representation) to change permissions, where 4 represents read, 2 represents write, and 1 represents execute. To assign multiple permissions, simply add their respective values together. For instance, ‘chmod 755 filename’ would give the owner full permissions (7 = 4+2+1), read and execute permissions for the group (5 = 4+0+1), and the same for others.”

11. Describe the process of mounting and unmounting filesystems in UNIX.

Understanding the fundamentals of UNIX administration is vital for this role. The ability to mount and unmount filesystems is an essential skill, as it allows you to manage storage devices and access data. By asking this question, interviewers want to gauge your technical knowledge and experience with UNIX systems, ensuring you possess the expertise needed to effectively manage their organization’s infrastructure.

Example: “Mounting a filesystem in UNIX involves attaching it to the directory tree so that its contents become accessible. To do this, you first need to create an empty directory, which will serve as the mount point. Then, you can use the ‘mount’ command followed by the device identifier and the mount point. For example: mount /dev/sdb1 /mnt/myfilesystem . This command attaches the specified device (sdb1) to the mount point (/mnt/myfilesystem), making the files within the device available for access.

Unmounting a filesystem is the process of detaching it from the directory tree, ensuring no further access to its contents. To unmount a filesystem, you can use the ‘umount’ command followed by the mount point or the device identifier. For example: umount /mnt/myfilesystem or umount /dev/sdb1 . It’s important to ensure that no processes are accessing the filesystem before attempting to unmount it, as this may cause data corruption or prevent the unmount operation from completing successfully.”

12. What is the role of the cron daemon in UNIX systems?

The cron daemon is a critical component of UNIX systems, as it automates repetitive tasks and manages scheduled jobs. Interviewers want to ensure that you, as a UNIX Administrator, understand the importance of the cron daemon, its functionality, and how to properly configure and maintain it to improve system efficiency and productivity. This question demonstrates your knowledge and experience with UNIX system administration.

Example: “The cron daemon plays a vital role in UNIX systems by automating repetitive tasks and ensuring that specific processes run at predetermined intervals. It is responsible for executing scheduled jobs, known as “cron jobs,” without requiring manual intervention from the system administrator.

Cron jobs are defined within a configuration file called the “crontab” (short for “cron table”), which specifies the commands to be executed, along with their respective schedules. The cron daemon continuously monitors these crontab files and executes the specified tasks at the appropriate times. This automation helps maintain system health, perform routine maintenance tasks such as log rotation or backups, and can even be used to automate application-specific operations. In summary, the cron daemon streamlines the management of UNIX systems by enabling efficient scheduling and execution of automated tasks.”

13. Explain the differences between grep, sed, and awk commands.

As a UNIX administrator, you’ll be working with various command-line tools to manipulate text and automate tasks. The grep, sed, and awk commands are essential for text processing and data extraction. Interviewers ask this question to gauge your understanding of these commands and your ability to explain their differences, which demonstrates your technical knowledge and communication skills—both critical aspects of your role as a UNIX administrator.

Example: “As a UNIX administrator, it’s essential to be familiar with various text processing commands like grep, sed, and awk. Each command has its unique purpose and functionality.

Grep is primarily used for searching patterns within files. It stands for “Global Regular Expression Print” and allows you to search for specific strings or regular expressions in one or multiple files. Grep returns the lines containing the matching pattern, making it useful for filtering data based on certain criteria.

Sed, short for “Stream Editor,” is a powerful text editor that operates on a line-by-line basis. Its primary function is to perform find-and-replace operations on input streams or files. Sed can also delete, insert, or modify lines of text, making it suitable for more complex text transformations than grep.

Awk, on the other hand, is a versatile text-processing tool designed for working with structured data. It excels at tasks such as column-based manipulation, arithmetic calculations, and generating formatted reports. Awk processes input data by applying rules and actions to each record (usually a line) and printing the results.

While all three commands are valuable for text processing, they serve different purposes: grep focuses on pattern searching, sed specializes in editing and transforming text, and awk shines when dealing with structured data and performing calculations.”

14. What are some methods for securing a UNIX server?

Securing a UNIX server is a critical aspect of a UNIX administrator’s job. With cyber threats constantly on the rise, interviewers want to ensure that you’re knowledgeable about various security measures and best practices. By asking this question, they’re seeking to gauge your expertise in implementing strategies to protect the server, safeguard sensitive information, and maintain the overall system integrity. Additionally, they want to see that you can proactively identify and mitigate potential vulnerabilities in a UNIX environment.

Example: “Securing a UNIX server involves multiple layers of protection to ensure its integrity and safeguard against potential threats. One essential method is keeping the system up-to-date by regularly applying security patches and updates, which helps address known vulnerabilities.

Another critical aspect is implementing strict user access controls. This includes assigning minimal privileges based on the principle of least privilege, ensuring users have only the necessary permissions for their roles. Additionally, using strong passwords and two-factor authentication can further enhance security.

Monitoring and auditing are also vital in maintaining a secure UNIX environment. Regularly reviewing log files and setting up intrusion detection systems help identify any suspicious activities or unauthorized access attempts. Implementing these methods collectively contributes to a robust security posture for a UNIX server.”

15. Describe your experience with shell scripting. Which shells have you worked with?

Shell scripting is an essential skill for a UNIX Administrator, and familiarity with different shells is crucial for managing different UNIX environments. By asking this question, interviewers can gauge your level of expertise and your hands-on experience with creating and maintaining scripts to automate tasks, improve efficiency, and troubleshoot issues. It also provides insight into your adaptability and your ability to learn and work with various shells, which is important in a constantly evolving technology landscape.

Example: “Throughout my career as a UNIX Administrator, I have gained extensive experience with shell scripting, which has been an essential skill for automating tasks and streamlining processes. I have primarily worked with the Bourne-Again Shell (Bash) due to its widespread use and powerful features. Bash is highly versatile and allows me to create complex scripts that can handle various system administration tasks such as monitoring system performance, managing user accounts, and automating backups.

I have also had exposure to other shells like KornShell (ksh) and C Shell (csh), particularly when working on projects involving legacy systems or specific client requirements. This experience has given me a broader understanding of different shell environments and their unique capabilities, enabling me to adapt quickly and efficiently to any project’s needs.”

16. What is the purpose of the /proc directory in UNIX systems?

The /proc directory in UNIX systems is a unique and useful part of the file system that provides valuable insights into the inner workings of the system. By asking about the /proc directory, interviewers want to assess your knowledge of UNIX system administration and your ability to monitor and manage system processes, a fundamental skill for any UNIX administrator.

Example: “The /proc directory in UNIX systems serves as a virtual filesystem that provides an interface to access kernel and process information. It acts as a window into the kernel’s internal data structures, allowing users and administrators to obtain real-time system statistics and details about running processes.

For instance, within the /proc directory, each running process has its own subdirectory named after its process ID (PID). These subdirectories contain files with valuable information such as memory usage, file descriptors, and command-line arguments. Additionally, the /proc directory contains files that provide global system information like CPU utilization, memory allocation, and hardware configuration. This makes it an essential tool for monitoring system performance, diagnosing issues, and fine-tuning configurations.”

17. How do you troubleshoot network connectivity issues in UNIX?

Understanding your approach to troubleshooting network connectivity issues in UNIX is essential for hiring managers because it reveals your ability to diagnose and resolve complex problems. Network connectivity issues can disrupt business operations, and as a UNIX Administrator, you must be competent in identifying the root cause and implementing effective solutions to maintain a stable network environment.

Example: “When troubleshooting network connectivity issues in UNIX, I start by using the ‘ping’ command to check if the target host is reachable. If it’s not, I verify that the local network interface is up and running with the ‘ifconfig’ command. Next, I examine the routing table using the ‘netstat -rn’ command to ensure that the correct routes are configured for reaching the destination.

If the issue persists, I use tools like ‘traceroute’ or ‘mtr’ to identify any potential bottlenecks or failures along the path to the destination. Additionally, I inspect the system logs for any relevant error messages or warnings related to network services. This information can provide valuable insights into possible causes of the connectivity problem. Throughout this process, I maintain clear communication with other team members and stakeholders to keep them informed about my findings and progress in resolving the issue.”

18. What are the key components of the System V init process?

Asking about the key components of the System V init process allows interviewers to gauge your knowledge of UNIX system administration, particularly in managing the boot process. This question helps them understand your familiarity with the traditional UNIX boot sequence, your ability to troubleshoot boot issues, and your overall grasp of the UNIX environment. They want to ensure that you have the necessary expertise to maintain a stable and efficient UNIX system.

Example: “The System V init process is a traditional UNIX initialization system that manages the startup and shutdown of services. The key components of this process are:

1. Init: This is the first process that runs when the system boots up, with a process ID (PID) of 1. It reads the /etc/inittab configuration file to determine the default runlevel and initializes the system accordingly.

2. Runlevels: These are predefined states in which the system can operate, ranging from 0 to 6. Each runlevel represents a different level of system functionality, such as single-user mode, multi-user mode, or system shutdown.

3. rc scripts: These are shell scripts located in the /etc/rc.d directory, responsible for starting and stopping services during the transition between runlevels. They are organized into subdirectories corresponding to each runlevel (e.g., rc0.d, rc1.d, etc.).

4. Symlinks: Within each rc script subdirectory, there are symbolic links pointing to service-specific scripts stored in the /etc/init.d directory. These symlinks follow a specific naming convention, beginning with either ‘S’ (start) or ‘K’ (kill), followed by a two-digit number indicating the order of execution.

When transitioning between runlevels, the init process executes the appropriate rc scripts, which in turn start or stop services based on the symlink ordering. This structured approach ensures proper sequencing and dependency management during system initialization and shutdown.”

19. Explain the concept of pipes and redirection in UNIX.

Interviewers want to make sure you have a strong grasp of fundamental UNIX concepts, as they form the foundation for your daily work as a UNIX administrator. Pipes and redirection are essential tools in UNIX environments, allowing you to connect commands and manipulate data efficiently. Demonstrating your understanding of these concepts illustrates your ability to perform tasks effectively and troubleshoot issues within the system.

Example: “Pipes and redirection are powerful features in UNIX that allow users to manipulate data flow between commands and processes. Pipes, denoted by the “|” symbol, enable the output of one command to be used as input for another command. This allows users to chain multiple commands together, creating a more efficient workflow and reducing the need for intermediate files.

Redirection, on the other hand, involves changing the source or destination of data streams within a process. The “>” symbol is used to redirect standard output (stdout) to a file, overwriting its contents if it exists, while “>>” appends the output to the file. To redirect standard input (stdin), the “ ” or combined with stdout using “2>&1″. These techniques provide greater control over data handling and facilitate automation of tasks in UNIX environments.”

20. Describe the process for installing software packages in UNIX.

The interviewer wants to assess your familiarity with UNIX systems, specifically your understanding of how to install software packages, which is a fundamental task in UNIX administration. This question allows you to demonstrate your technical knowledge and experience in managing UNIX systems and ensures that you have the necessary skills to handle software installations in a UNIX environment.

Example: “When installing software packages in UNIX, I typically use the package management system provided by the specific UNIX distribution. For instance, if I’m working with a Debian-based system like Ubuntu, I would use the Advanced Package Tool (APT) to manage installations.

To install a new package, I first update the package repository using the command sudo apt-get update . This ensures that I have access to the latest versions of available packages. Next, I search for the desired package using apt-cache search <package-name> , which provides me with a list of matching packages. Once I’ve identified the correct package, I proceed with the installation using the command sudo apt-get install <package-name> .

Throughout this process, it’s essential to pay attention to any dependencies or conflicts that may arise during the installation. The package manager usually handles these automatically, but manual intervention might be necessary in some cases. After successful installation, I verify the package’s functionality and configure it as needed to ensure seamless integration into the existing system environment.”

21. What is the role of swap space in UNIX systems?

As an interviewer, it’s important to test your knowledge on specific technical aspects of the job. Swap space is an essential part of UNIX systems, acting as a temporary storage area for data when the physical memory (RAM) is full. By assessing your understanding of swap space, the interviewer can gauge your expertise in UNIX administration and how well you can manage and optimize system performance.

Example: “Swap space plays a critical role in UNIX systems by providing additional memory resources when the physical RAM is fully utilized. It acts as a temporary storage area on the hard disk, allowing the operating system to move inactive processes and data from the main memory to the swap space. This process, known as swapping or paging, frees up valuable RAM for active processes that require immediate attention.

The proper management of swap space is essential for maintaining optimal system performance. As a UNIX administrator, it’s important to monitor swap usage regularly and adjust its size if necessary, based on the system’s workload and requirements. While relying heavily on swap space can lead to slower performance due to increased disk I/O operations, having an adequate amount of swap space ensures that the system can continue functioning even during periods of high memory demand.”

22. How do you manage disk quotas in UNIX?

As a UNIX administrator, you’ll be responsible for managing disk space usage, ensuring there’s enough storage available for critical operations and preventing individual users from consuming excessive resources. By asking this question, interviewers want to assess your knowledge and experience in implementing and managing disk quotas, a vital system administration task that helps maintain the smooth operation of the UNIX environment.

Example: “Managing disk quotas in UNIX involves setting limits on the amount of disk space and number of files that users can consume. This is essential to prevent any single user from monopolizing system resources, ensuring fair distribution among all users.

To manage disk quotas, I first enable quota support on the file system by editing the /etc/fstab file and adding the ‘usrquota’ and/or ‘grpquota’ options as needed. After remounting the file system with the new options, I use the ‘quotacheck’ command to create or update the necessary quota files (aquota.user and aquota.group) for each partition where quotas are enabled.

Once the quota files are in place, I set individual user or group quotas using the ‘edquota’ command. This allows me to define soft and hard limits for both disk space usage (in blocks) and the number of files (inodes). Soft limits provide a grace period during which users can temporarily exceed their allocated disk space, while hard limits impose strict restrictions that cannot be exceeded.

To monitor and enforce these quotas, I periodically run the ‘repquota’ command, which generates reports on current disk usage and quota violations. If necessary, I communicate with users who have exceeded their quotas and work with them to resolve the issue, either by reallocating resources or assisting them in reducing their disk usage.”

23. What are some best practices for backing up data on a UNIX system?

Backup strategies are critical for any organization to ensure that valuable data is protected against loss, corruption, or accidental deletion. Interviewers ask this question to evaluate your knowledge of best practices for backing up data on a UNIX system, and to gauge your experience in implementing and maintaining effective backup strategies. This demonstrates your ability to safeguard the organization’s data, contribute to disaster recovery plans, and maintain business continuity.

Example: “As a UNIX Administrator, ensuring data integrity and availability is paramount. When it comes to backing up data on a UNIX system, I adhere to several best practices:

1. Develop a backup strategy: First, I assess the organization’s needs and requirements, such as recovery time objectives (RTO) and recovery point objectives (RPO). Based on this information, I create a comprehensive backup plan that outlines the frequency of backups, types of backups (full, incremental, or differential), and retention policies.

2. Automate backups: To ensure consistency and reduce human error, I use tools like cron jobs and scripts to automate the backup process. This allows me to schedule regular backups without manual intervention, making the process more efficient and reliable.

3. Verify backups: It’s essential to periodically test the integrity of backed-up data by performing restoration tests. This helps identify any issues with the backup process and ensures that the data can be successfully restored when needed.

4. Offsite storage: Storing backup copies in an offsite location provides additional protection against data loss due to natural disasters, hardware failures, or other unforeseen events. I typically utilize cloud-based storage solutions or remote physical locations for offsite backups.

5. Monitor and review: Regularly monitoring the backup process and reviewing logs helps identify potential issues before they escalate. This proactive approach enables me to address problems promptly and maintain the reliability of the backup system.”

24. Explain the difference between kill and killall commands.

Demonstrating your knowledge of UNIX commands is essential for a UNIX Administrator role, and understanding the difference between “kill” and “killall” commands showcases your ability to effectively manage system processes. The interviewer wants to ensure that you have the necessary technical expertise to terminate processes safely and efficiently, without causing any unintended consequences to the system.

Example: “The primary difference between the “kill” and “killall” commands lies in their target selection and usage. The “kill” command is used to terminate a specific process by sending a signal to it, identified by its Process ID (PID). For example, if you want to terminate a process with PID 12345, you would use the command “kill -9 12345”, where “-9” represents the SIGKILL signal.

On the other hand, the “killall” command targets multiple processes based on their names rather than PIDs. It sends a specified signal to all instances of a particular process name. For instance, if you want to terminate all instances of a process named “myprocess”, you would use the command “killall -9 myprocess”. This makes “killall” more convenient when dealing with multiple instances of the same process or when the exact PID is unknown.”

25. What is the purpose of the syslog service in UNIX?

Syslog service is an essential part of UNIX administration, and interviewers want to gauge your understanding of its function. The syslog service in UNIX is responsible for handling system messages and logging events. It helps administrators monitor system performance, troubleshoot issues, and maintain security by providing a centralized location for collecting and storing log data from various system processes, applications, and network devices. Demonstrating your knowledge of the syslog service showcases your familiarity with UNIX systems and your ability to perform the necessary tasks in maintaining them.

Example: “The syslog service in UNIX serves as a centralized logging system that collects and manages log messages from various applications, services, and devices on the system. Its primary purpose is to provide administrators with a consistent and organized way of monitoring and troubleshooting issues within the system.

Syslog categorizes log messages based on their severity levels and facility codes, which helps administrators prioritize and filter logs for easier analysis. Additionally, syslog can be configured to forward log messages to remote servers or store them locally, allowing for better log management and security. This functionality is essential for maintaining system stability, identifying potential problems, and ensuring compliance with organizational policies and industry regulations.”

26. Describe the process for recovering a forgotten root password.

When hiring a UNIX Administrator, it’s essential to know that the candidate possesses the technical knowledge to handle various system issues, including security and password management. Demonstrating the ability to recover a forgotten root password shows that you’re familiar with the intricacies of UNIX systems and can tackle such challenges effectively, ensuring the smooth operation of the system and minimizing downtime.

Example: “Recovering a forgotten root password involves booting the system into single-user mode and resetting the password. First, reboot the UNIX system and interrupt the normal boot process at the bootloader stage (e.g., GRUB or LILO). Then, modify the kernel parameters to include “single” or “init=/bin/sh,” depending on the specific UNIX distribution, which will instruct the system to enter single-user mode.

Once in single-user mode, you’ll have root access without needing a password. Next, remount the root filesystem as read-write using the command “mount -o remount,rw /”. Now, use the “passwd” command to reset the root password by entering the new password twice for confirmation. After successfully changing the password, remount the root filesystem as read-only with “mount -o remount,ro /”, then exit single-user mode and continue the normal boot process by issuing the “reboot” or “exit” command. The system should now restart with the updated root password in place.”

27. What are some common UNIX commands for managing users and groups?

Your interviewer wants to assess your knowledge of UNIX administration, specifically in the area of user and group management. They’re looking for evidence of your ability to handle user accounts, permissions, and group assignments. Demonstrating your familiarity with common UNIX commands will show that you’re well-equipped to manage these tasks and ensure the smooth operation of the UNIX environment.

Example: “Managing users and groups in UNIX involves a variety of commands that allow administrators to create, modify, and delete user accounts and group memberships. Some common UNIX commands for managing users include:

1. useradd : This command is used to create new user accounts with specified attributes such as home directory, shell, and password expiration settings. 2. usermod : With this command, you can modify existing user account properties like changing the login name, home directory, or default shell. 3. userdel : This command allows you to remove a user account along with its associated files and directories.

For managing groups, some essential UNIX commands are:

1. groupadd : This command creates a new group with a specified group ID (GID) and group name. 2. groupmod : You can use this command to modify an existing group’s GID or name. 3. groupdel : This command removes a group from the system.

These commands provide the foundation for effective user and group management in UNIX environments, ensuring proper access control and resource allocation.”

28. Explain the concept of file ownership and how it can be changed in UNIX.

Understanding file ownership is a critical aspect of managing a UNIX system, as it directly relates to security and user privileges. Interviewers want to gauge your knowledge of this concept, as well as your ability to change file ownership when necessary, to ensure you can effectively maintain the system and protect sensitive data from unauthorized access. Demonstrating your expertise in this area proves that you can handle common UNIX administration tasks and safeguard the system.

Example: “File ownership in UNIX is an essential aspect of the system’s security model, as it determines who has access to a file and what actions they can perform on it. Each file in UNIX has two types of owners: user owner and group owner. The user owner is typically the creator of the file, while the group owner refers to a collection of users that share certain permissions for that file.

To change the ownership of a file, you can use the ‘chown’ command followed by the new user owner and the target file. For example, “chown new_owner filename” would change the user owner of the specified file to ‘new_owner’. If you want to change both the user and group ownership simultaneously, you can use the syntax “chown new_user:new_group filename”. Additionally, if you only need to modify the group ownership, you can utilize the ‘chgrp’ command, like this: “chgrp new_group filename”. It’s important to note that changing file ownership usually requires administrative privileges or being the current owner of the file.”

29. What are the key differences between NFS and SMB/CIFS protocols?

Understanding the differences between these file sharing protocols is essential for a UNIX Administrator, as it demonstrates your technical knowledge and ability to make informed decisions when implementing and managing network file systems. Your response will show the interviewer that you’re well-versed in the nuances of each protocol and can adapt to the unique needs of the organization you’re working for.

Example: “NFS (Network File System) and SMB/CIFS (Server Message Block/Common Internet File System) are both network protocols used for sharing files across systems, but they have some key differences. NFS is a UNIX-based protocol that was developed by Sun Microsystems, while SMB/CIFS is primarily associated with Microsoft Windows environments.

One of the main differences between these two protocols lies in their authentication mechanisms. NFS uses a host-based authentication system, where access permissions are granted based on the client’s IP address or hostname. On the other hand, SMB/CIFS employs user-level authentication, which requires individual users to provide valid credentials before accessing shared resources.

Another notable difference is their performance characteristics. NFS generally offers better performance in UNIX/Linux environments due to its native integration and support for features like direct file I/O and asynchronous writes. In contrast, SMB/CIFS tends to perform better in Windows environments, as it has been optimized for use within the Windows operating system and supports various Windows-specific features such as opportunistic locking and distributed file system replication.”

30. Describe your experience with virtualization technologies on UNIX systems, such as KVM or Xen.

Hiring managers are keen on understanding your level of expertise with virtualization technologies because they play a significant role in optimizing resources and managing workloads on UNIX systems. Your experience with KVM, Xen, or other virtualization tools demonstrates your ability to handle complex tasks, improve system performance, and ensure seamless operation within the organization’s infrastructure.

Example: “Throughout my career as a UNIX Administrator, I have gained extensive experience with virtualization technologies, particularly KVM and Xen. In one of my previous roles, I was responsible for managing a large-scale infrastructure that utilized KVM to create and manage multiple virtual machines running on Linux-based systems. My responsibilities included configuring the hypervisor, allocating resources such as CPU, memory, and storage, and ensuring optimal performance and security.

I also had the opportunity to work with Xen in another project where we migrated from a traditional server setup to a more efficient virtualized environment. This involved setting up XenServer hosts, creating VMs, and implementing live migration features to minimize downtime during maintenance or upgrades. Working with both KVM and Xen has allowed me to develop a deep understanding of their capabilities and limitations, enabling me to make informed decisions when designing and maintaining virtualized environments on UNIX systems.”

30 Training Administrator Interview Questions and Answers

30 associate general counsel interview questions and answers, you may also be interested in..., 30 api product manager interview questions and answers, 30 supported employment specialist interview questions and answers, 20 agile product manager interview questions and answers, 20 community outreach worker interview questions and answers.

  • Find a Lawyer
  • Ask a Lawyer
  • Research the Law
  • Law Schools
  • Laws & Regs
  • Newsletters
  • Justia Connect
  • Pro Membership
  • Basic Membership
  • Justia Lawyer Directory
  • Platinum Placements
  • Gold Placements
  • Justia Elevate
  • Justia Amplify
  • PPC Management
  • Google Business Profile
  • Social Media
  • Justia Onward Blog

Q: Should I sign a combined declaration and assignment if I have not seen the patent application?

My employer has, on several occasions, had me sign paperwork to assign ownership of patents for products I have worked on to the company. Which is fine, I agreed to as much when I accepted the job. These documents include four declarations, the first three of which involve reviewing and confirming aspects of the application, and the fourth is acknowledgement that I am subject to fines or jail time for making any false statements. The company has declined to provide me with a copy of the application (I don't know if it's even been written . . .). I get that this form is basically superfluous, since they can sign on my behalf based on my employment contract. But I'm disinclined to sign something that is clearly not true even if it's just a technicality. OTOH I'm concerned bout not receiving credit for future work if I make this difficult. Should I just sign, or is there reason to be concerned about consequences -- or about abetting a bad filing if it's being shoddily handled like this?

James L. Arrasmith

  • Sacramento, CA
  • Licensed in California
  • (916) 704-3009
  • Email Lawyer
  • View Website

A: Based on the information you've provided, there are a few important considerations: 1. Legal implications: Signing a declaration without having seen the patent application could potentially expose you to legal risks, especially if the declaration includes statements confirming aspects of the application that you cannot verify. The fourth declaration you mentioned, acknowledging potential fines or jail time for false statements, underscores the seriousness of this issue. 2. Ethical concerns: If you are uncomfortable signing a document that you believe contains false statements, even if they seem like technicalities, it's reasonable to hesitate. Signing something you know to be untrue could be considered unethical. 3. Professional credit: Your concern about not receiving credit for future work if you don't sign is understandable. However, if your employment contract already assigns patent rights to your employer, refusing to sign this particular document may not necessarily jeopardize your professional credit. Recommendation: Before signing, it would be prudent to raise your concerns with your employer or the legal department handling the patent application. Explain that you are hesitant to sign declarations confirming aspects of an application you haven't seen. Request a copy of the application to review before signing, or ask if the language in the declarations can be modified to reflect that you are assigning rights but not making specific claims about the application's contents. If your employer is unwilling to provide the application or modify the declarations, you may want to consider seeking independent legal advice to better understand your rights and obligations in this situation. A lawyer specializing in intellectual property and employment law could help you assess the potential risks and advise on how to proceed. Ultimately, while not signing may create some friction with your employer, signing a document you know to contain false statements could expose you to more serious consequences. It's important to balance your professional obligations with your personal integrity and legal protection.

Sean Goodwin agrees with this answer

1 user found this answer helpful

Justia Ask a Lawyer is a forum for consumers to get answers to basic legal questions. Any information sent through Justia Ask a Lawyer is not secure and is done so on a non-confidential basis only.

The use of this website to ask questions or receive answers does not create an attorney–client relationship between you and Justia, or between you and any attorney who receives your information or responds to your questions, nor is it intended to create such a relationship. Additionally, no responses on this forum constitute legal advice, which must be tailored to the specific circumstances of each case. You should not act upon information provided in Justia Ask a Lawyer without seeking professional counsel from an attorney admitted or authorized to practice in your jurisdiction. Justia assumes no responsibility to any person who relies on information contained on or received through this site and disclaims all liability in respect to such information.

Justia cannot guarantee that the information on this website (including any legal information provided by an attorney through this service) is accurate, complete, or up-to-date. While we intend to make every attempt to keep the information on this site current, the owners of and contributors to this site make no claims, promises or guarantees about the accuracy, completeness or adequacy of the information contained in or linked to from this site.

  • Bankruptcy Lawyers
  • Business Lawyers
  • Criminal Lawyers
  • Employment Lawyers
  • Estate Planning Lawyers
  • Family Lawyers
  • Personal Injury Lawyers
  • Estate Planning
  • Personal Injury
  • Business Formation
  • Business Operations
  • Intellectual Property
  • International Trade
  • Real Estate
  • Financial Aid
  • Course Outlines
  • Law Journals
  • US Constitution
  • Regulations
  • Supreme Court
  • Circuit Courts
  • District Courts
  • Dockets & Filings
  • State Constitutions
  • State Codes
  • State Case Law
  • Legal Blogs
  • Business Forms
  • Product Recalls
  • Justia Connect Membership
  • Justia Premium Placements
  • Justia Elevate (SEO, Websites)
  • Justia Amplify (PPC, GBP)
  • Testimonials

IMAGES

  1. UNIX MCQ Questions with answers pdf OS operating system and commands

    unix assignment questions with answers

  2. Unix Assignment Questions

    unix assignment questions with answers

  3. Unix Question and Answers

    unix assignment questions with answers

  4. Unix MCQs

    unix assignment questions with answers

  5. Introduction to unix/linux: Answers

    unix assignment questions with answers

  6. Unix Questions and Answers

    unix assignment questions with answers

VIDEO

  1. UNIX INTERVIEW QUESTION AND ANSWERS #shorts #juzshineshorts #juzshinevideos

  2. UNIX Shell Programming Answers

  3. Fight Masters Ram Lakshman Farm House Tour

  4. Operating System Unit 04 Important Questions For Engineering Exam

  5. Unix interview questions for informatica developer

  6. Unix Basics

COMMENTS

  1. 50 Unix Interview Questions and Answers (2024)

    It includes the location on the disk where the file starts, the size of the file, when the file was last used when the file was last changed, what the various read, write and execute permissions are, who owns the file, and other information. 14) You have a file called tonky in the directory honky. Later you add new material to tonky.

  2. 1000 Unix MCQ (Multiple Choice Questions)

    Chapterwise Multiple Choice Questions on Unix. Our 1000+ MCQs focus on all topics of the Unix subject, covering 100+ topics. This will help you to prepare for exams, contests, online tests, quizzes, viva-voce, interviews, and certifications. Unix Architecture & General Purpose Utilities. File System.

  3. Unix Assessment Questions

    Unix Questions and Answers - Redirection and Pipes - 2. This set of Unix Assessment Questions and Answers focuses on "Redirection and Pipes - 2". 1. The category of commands which uses both standard input and standard output are called ____. a) directory oriented commands. b) standard input commands. c) filters.

  4. TOP 70+ Best UNIX Interview Questions with Answers

    Q #7) Describe the usage and functionality of the command "rm -r *" in UNIX. Answer: The command "rm -r *" is a single-line command to erase all files in a directory with its subdirectories. "rm" - command for deleting files. "-r" - command to delete directories and subdirectories with files within. "*" - indicates ...

  5. UNIX Assignment Part 1

    Read "The UNIX Time-Sharing System (PDF)" by Dennis Ritchie and Ken Thompson. Recitation 4 will focus on the first four sections of the paper; Recitation 5 will focus on the rest. To help you as you read: By the end of section three, you should understand the differences between ordinary files, directories, and special files.

  6. 60 Top Unix Shell Scripting Interview Questions and Answers

    Answer: Shell is a command interpreter, which interprets the command given by the user to the kernel. It can also be defined as an interface between a user and the operating system. Q #2) What is Shell Scripting? Answer: Shell scripting is nothing but a series or sequence of UNIX commands written in a plain text file.

  7. Top 40 Unix Interview Questions and Answers

    This section of the blog will expand on some commonly asked UNIX Interview Questions and answers on process management. Q23) What is a 'process' in UNIX? Ans: In UNIX, a 'process' is a running instance of a program, possessing its memory space and assigned a unique process ID (PID). It can be in various states, like running, sleeping, or ...

  8. UNIX

    Gate IT 2005 UNIX 50 Operating System MCQs with Answers. Discuss it. Question 4. A user level process in Unix traps the signal sent on a Ctrl-C input, and has a signal handling routine that saves appropriate files before terminating the process. When a Ctrl-C input is given to this process, what is the mode in which the signal handling routine ...

  9. Unix / Linux Questions and Answers

    This section provides a huge collection of Unix Interview Questions with their answers hidden in a box to challenge you to have a go at them before discovering the correct answer. 2: Unix Online Quiz. This section provides a great collection of Unix Multiple Choice Questions (MCQs) on a single page along with their correct answers and explanation.

  10. Top 50+ UNIX Interview Questions & Answers 2024

    Command (-argument) (-argument) (-argument) (filename) 7. Describe the UNIX term for the directory. A directory is a specific type of file that keeps track of all the files that are contained within it. A directory is given to each file. 8. Indicate the distinction between the connected path and the absolute path.

  11. Top Unix Interview Questions and Answers in 2024

    Answer: It is done by reversing the letters of the word case, i.e., esac. 17. Give an example of a file system (hierarchy) in Unix. Answer: Unix follows many standards for its file system. The first directory is 'root', represented with a forward slash (/).

  12. Top 25 Unix Programming Interview Questions and Answers

    20. Describe how the 'find' command can be used with different options. The 'find' command in Unix is a powerful tool for searching files and directories. It can be used with various options to refine the search. One common option is '-name', which allows you to find files by their name.

  13. Top 50 Unix Commands Interview Questions and Answers 2024

    We can use /sbin/shutdown -r +15 to shut down a Unix system and then reboot the system. 38. Write a Unix Command to identify the files that must not have the word 'wonderful'. We can use grep -vi wonderful *.txt command to find the files that don't have the word wonderful.

  14. Top 50 Unix Interview Questions and Answers (2023)

    Answer: You can use the 'rm' command to remove files and the 'rmdir' or 'rm -r' command to remove directories. 12.What is the ' chmod' command used for in Unix? Answer: The 'chmod' command is used to change the permissions of files and directories in Unix. 13.Explain the purpose of the 'grep' command in Unix.

  15. 6.033: Hands-on Assignment (UNIX)

    You may have to consult section 3.6 of the Unix paper to answer the question. Question 18: How long did this assignment take you to complete up to this point? VI. For Fun (not required) Question 19: Chapter 2.5 describes how (in UNIX) a file's inode maps to the file's data blocks using direct pointers and indirect blocks.

  16. 100 UNIX Interview Questions And Answers // Unstop

    Advanced UNIX interview questions and answers. UNIX is a computer operating system that was initially developed in 1969 and has been continuously updated since then. It's a multi-user, multi-tasking system that's suitable for servers, desktops, and laptops. UNIX systems include a graphical user interface (GUI) comparable to Microsoft Windows ...

  17. 15 Linux Interview Questions (With Sample Answers)

    15 Linux interview questions and answers. Linux is an open-source operating system that is considered faster and more efficient than other operating systems like Windows. Here, we give a range of technical and behavioral questions about Linux—so you can prepare for the interview all in one place. Technical questions

  18. Top 11 UNIX Interview Questions and Example Answers

    Example: "Kernel is the master program of a UNIX operating system. Its purpose is to control the resources of a user's computer. Kernels do not have direct communication with the user, and it starts up a separate, interactive program called Shell for each user when they login to a system.". 3.

  19. Top 39 Unix Interview Questions (2023)

    4) What are the core concepts of UNIX. The core concepts of UNIX are given below. Kernel- The kernel is also known as the heart of the operating system. Its fundamental role is to interact with the hardware and also monitor major processes like memory management, file management, and task scheduling. Shell- It is also called command prompt, it ...

  20. Solved Unix Assignment Question 1. List three common read

    Unix Assignment. Question 1. List three common read command options and explain their function. Question 2. How can data from STDIN be sent to both a file and STDOUT?

  21. Top 75+ Unix Interview Questions and Answers in 2024

    Q2. Define a single-user system. A personal computer which possesses an operating system designed to operate by only one user at a given time is known as a single-user system. Single user system becomes more popular since low-cost hardware and availability of a wide range of software to perform different tasks. Q3.

  22. CS107 Assignment 0: Intro to Unix and C

    The assignment is graded out of about 26 functionality points, plus a bucket grade for style. Full credit will be awarded for reasonable answers to the questions in the readme.txt file and a correct modification of triangle.c and custom_tests. This assignment is worth far fewer points than all of our other assignments.

  23. 30 UNIX Administrator Interview Questions and Answers

    13. Explain the differences between grep, sed, and awk commands. As a UNIX administrator, you'll be working with various command-line tools to manipulate text and automate tasks. The grep, sed, and awk commands are essential for text processing and data extraction.

  24. Should I sign a combined declaration and assignment if I have not seen

    A: Based on the information you've provided, there are a few important considerations: 1. Legal implications: Signing a declaration without having seen the patent application could potentially expose you to legal risks, especially if the declaration includes statements confirming aspects of the application that you cannot verify.