Unix Interview Questions

What is Unix and its primary features?

Unix is a powerful multitasking, multiuser operating system developed in the 1970s. Its primary features include a hierarchical file system, powerful command-line interface, support for networking, portability across different hardware platforms, and a focus on simplicity and flexibility in design.

Explain the difference between Unix and Linux.

Unix is an older, proprietary operating system developed by Bell Labs, while Linux is an open-source operating system based on Unix. Linux is available for free, customizable by users, and has many distributions. Unix, on the other hand, is more expensive, proprietary, and typically used in commercial environments.

What is a shell in Unix?

In Unix, a shell is a command-line interpreter that allows users to interact with the operating system. It processes commands entered by the user and executes them, as well as providing features such as scripting capabilities, file manipulation, and environment control.

0+ jobs are looking for Unix Candidates

Curated urgent Unix openings tagged with job location and experience level. Jobs will get updated daily.

Explore

How do you change permissions for a file in Unix?

To change permissions for a file in Unix, you can use the 'chmod' command followed by the desired permission settings. For example, 'chmod 755 filename' will give read, write, and execute permissions to the owner, and read and execute permissions to the group and others.

What is the purpose of the 'ls' command in Unix?

The 'ls' command in Unix is used to list files and directories in a directory. It shows a detailed listing of the contents, including permissions, ownership, size, and timestamps. This command is widely used by Unix users to navigate and manage files and directories within the file system.

Explain the difference between soft link and hard link in Unix.

Soft links (symbolic links) are pointers to another file or directory, while hard links are direct references to the physical location of the file data on the disk. Soft links can span across different file systems, while hard links must be on the same file system as the original file.

How do you find out the current user's username in Unix?

To find out the current user's username in Unix, you can use the "whoami" command. Simply type "whoami" in the terminal and hit enter. This command will display the username of the currently logged in user.

What is a wildcard in Unix?

A wildcard in Unix is a symbol or character used to represent one or more other characters in a file or directory name. Common wildcards include * (matches any number of characters) and ? (matches a single character). Wildcards are used with commands like ls, cp, and rm to target multiple files efficiently.

How do you search for a specific text within files in Unix?

In Unix, you can search for specific text within files using the "grep" command followed by the text you want to search for and the file name. For example: ```bash grep "specific_text" file.txt ``` This will display any lines in the "file.txt" that contain the "specific_text".

Explain the difference between the vi and vim editors in Unix.

Vi is a basic text editor in Unix, while Vim (Vi Improved) is an enhanced version with additional features like syntax highlighting, multiple undo/redo, and plugins support. Vim is more advanced and customizable compared to Vi, making it a preferred choice for many users.

How do you create a tar archive in Unix?

To create a tar archive in Unix, you can use the following command: tar -cvf archive_name.tar files_to_include This command will create a tar archive file named archive_name.tar containing the specified files (or directories) in the current directory.

What is the purpose of the 'grep' command in Unix?

The 'grep' command in Unix is used to search for specific text patterns within files. It is a powerful tool for locating and filtering specific information quickly within a file or a set of files based on the provided criteria.

How do you kill a process in Unix?

To kill a process in Unix, you can use the `kill` command followed by the process ID (PID) of the process you want to terminate. For example, you can use `kill 1234` to kill a process with PID 1234.

Explain the significance of the PATH variable in Unix.

The PATH variable in Unix stores a list of directories where the operating system looks for executable files. When a user enters a command in the terminal, the system searches through the directories listed in the PATH variable to find the corresponding executable file to run the command.

What is the difference between a relative and absolute path in Unix?

In Unix, a relative path is defined in relation to the current working directory, while an absolute path represents the complete path from the root directory. Relative paths do not start with a forward slash (/) and are used to navigate within the current directory, while absolute paths identify the full directory structure.

What is a cron job in Unix?

A cron job in Unix is a task scheduler that allows users to automate repetitive tasks at regular intervals. Users can set up specific commands or scripts to run automatically at set times or dates without the need for manual intervention, enhancing efficiency and productivity in managing system tasks.

Explain the difference between foreground and background processes in Unix.

Foreground processes are executed in the foreground and interact with the user directly via the terminal, blocking other processes until they are completed. Background processes run in the background, allowing the user to continue working in the terminal while the process runs concurrently.

How do you check disk usage in Unix?

To check disk usage in Unix, you can use the "df" command which stands for "disk free". Simply open a terminal window and type "df -h" to display the disk usage information in a human-readable format. This will show you the usage of each filesystem mounted on your system.

What is the purpose of the 'find' command in Unix?

The 'find' command in Unix is used to search for files and directories based on certain conditions such as name, size, ownership, and permissions. It is a powerful tool for locating specific files or directories within the Unix file system.

How do you list all environment variables in Unix?

To list all environment variables in Unix, you can use the following command: `printenv` or `env`. These commands will show you a list of all environment variables currently set in your Unix system.

What is Unix and its primary features?

Unix is a powerful multitasking, multiuser operating system developed in the 1970s. Its primary features include a hierarchical file system, powerful command-line interface, support for networking, portability across different hardware platforms, and a focus on simplicity and flexibility in design.

Unix is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix developed in the 1970s. It is renowned for its stability, scalability, and robustness, making it a popular choice for servers and high-performance computing systems. Unix operating systems have been influential in the development of subsequent operating systems, including Linux and macOS.

Primary Features of Unix:

  1. Multiuser: Unix supports multiple users accessing the system concurrently, each with their own user account and permissions. Users can work independently and securely, keeping their files and processes separate.
  2. Multitasking: Unix allows multiple processes to run concurrently, efficiently utilizing system resources. Users can perform tasks in parallel, enhancing productivity and system responsiveness.
  3. Hierarchical File System: Unix organizes files and directories in a hierarchical structure, starting from the root directory ('/'). This system allows for efficient file management, navigation, and access control.
  4. Shell: Unix provides a command-line interface called the shell, which allows users to interact with the system through textual commands. The shell offers powerful scripting capabilities, automation tools, and access to a wide range of utilities and programs.
  5. Numeric UID/GID: Unix uses unique numeric identifiers (User ID and Group ID) to identify users and groups, irrespective of their names. This system enhances security and enables efficient management of permissions and access control.

Unix systems are known for their efficiency, stability, and adherence to standards, making them ideal for various computing tasks ranging from simple desktop usage to complex server deployments.