Unix (8) 

Welcome to our Unix Administrator interview questions and answers page!

As a Unix Administrator, you play a crucial role in managing and ensuring the smooth operation of Unix-based systems. Here, you’ll find a curated collection of interview questions and well-crafted answers to help you excel in your interview. Good luck and happy learning!

Top 20 Basic Unix Administrator Interview Questions and Answers

1. What is Unix?
Unix is a multi-user, multitasking operating system developed in the 1960s. It provides a shell interface for users to interact with the system.

2. Describe the basic components of the Unix operating system.
The basic components include the kernel, shell, and file system. The kernel handles hardware communication, the shell provides the command-line interface, and the file system manages storage and retrieval of data.

3. What is the role of a Unix administrator?
A Unix administrator is responsible for managing and maintaining the Unix operating system, including user management, system configuration, security, and troubleshooting.

4. How do you change the permissions of a file in Unix?
The “chmod” command is used to change the permissions of a file in Unix. For example, “chmod 755 filename” gives read, write, and execute permissions to the owner, and read and execute permissions to the group and others.

5. How do you find the process ID (PID) of a running process in Unix?
The “ps” command can be used to find the PID of a running process. For example, “ps aux | grep process_name” will display the PID of the process.

6. Explain the difference between a hard link and a soft link (symbolic link) in Unix.
A hard link is a direct reference to the physical data on the disk, while a soft link (symbolic link) is a file that points to another file by name. Deleting the original file will not affect a hard link, but it will break a soft link.

7. How do you determine the amount of free disk space in Unix?
The “df” command is used to display the amount of free disk space in Unix. For example, “df -h” will show the disk space in human-readable format.

8. What is the purpose of the “grep” command in Unix?
The “grep” command is used to search for specific patterns or keywords within files. It can be used for various purposes, such as finding lines that match a particular pattern or searching for a specific word in a file.

9. How do you compress and extract files in Unix?
The “gzip” command is used to compress files in Unix, while the “gunzip” command is used to extract them. For example, “gzip filename” will compress the file, and “gunzip filename.gz” will extract it.

10. Explain the use of the “find” command in Unix.
The “find” command is used to search for files and directories based on various criteria, such as name, size, and modification time. It is a powerful tool for locating specific files within a file system hierarchy.

11. How do you check the status of a network interface in Unix?
The “ifconfig” command is used to check the status of a network interface in Unix. It displays information about the network interfaces, such as IP addresses, MAC addresses, and network statistics.

12. How do you schedule a task to run at a specific time in Unix?
The “cron” daemon is used to schedule tasks at specific times in Unix. The “crontab” command is used to create and manage cron jobs. For example, “crontab -e” opens the cron file for editing.

13. Describe the different run levels in Unix.
Unix has several run levels, which determine the state of the system and the services running on it. Run level 0 is for system shutdown, run level 1 is single-user mode, run level 2 is multi-user mode without network services, run level 3 is multi-user mode with network services, and run level 6 is system reboot.

14. What is the purpose of the “tar” command in Unix?
The “tar” command is used to create and manipulate tape archive files (tar files) in Unix. It can be used to compress and extract files, as well as create backups.

15. How do you kill a process in Unix?
The “kill” command is used to terminate a process in Unix. It sends a specified signal to a process, indicating that it should be stopped. For example, “kill -9 pid” will forcefully kill the process with the specified PID.

16. What is the purpose of the “passwd” command in Unix?
The “passwd” command is used to change the password of a user in Unix. It prompts the user to enter the current password and then the new password.

17. How do you check the system uptime in Unix?
The “uptime” command is used to check the system uptime in Unix. It displays the current time, how long the system has been running, the number of users logged in, and the system load averages.

18. What is the purpose of the “mount” command in Unix?
The “mount” command is used to mount file systems in Unix. It attaches a file system to a specific directory, allowing the files and directories on the file system to be accessed.

19. How do you view the contents of a file in Unix?
The “cat” command is used to view the contents of a file in Unix. For example, “cat filename” will display the contents of the file on the terminal.

20. What is the purpose of the “chmod” command in Unix?
The “chmod” command is used to change the permissions of a file or directory in Unix. It allows the owner, group, and others to read, write, and execute files based on assigned permissions.

Top 20 Advanced Unix Administrator interview questions and answers

1. Explain the concept of file permissions in Unix?
File permissions in Unix are used to control access to files and directories. There are three types of permissions: read(r), write(w), and execute(x). These permissions are set for three different user groups: owner, group, and others. They can be viewed and modified using the `chmod` command.

2. How do you check the disk space usage in Unix?
The `df` command is used to check the disk space usage in Unix. It displays information about the available and used space on all mounted filesystems.

3. Explain the difference between a soft link and a hard link.
A soft link (or symbolic link) is a pointer to another file or directory. It is represented by a special file that contains the path to the target file. Soft links can span across different filesystems.

A hard link, on the other hand, is a direct reference to the target file. It points to the inode of the file, rather than the path. Hard links cannot span across different filesystems.

4. What is an inode?
An inode is a data structure in Unix-like file systems. It stores metadata about a file, such as its permissions, owner, size, and location on disk. Inodes are used to uniquely identify files and directories.

5. How do you find all files modified within the last 7 days in Unix?
You can use the `find` command with the `-mtime` option to find all files modified within the last 7 days. The command would look like:

“`
find /path/to/directory -mtime -7
“`

6. How do you search for a specific text pattern within files in Unix?
The `grep` command is used to search for a specific text pattern within files in Unix. It can be used with various options, such as `-r` for recursive searching and `-i` for case-insensitive searching.

7. How do you kill a process in Unix?
The `kill` command is used to terminate a process in Unix. You need to know the process ID (PID) of the process you want to kill. For example, to kill a process with PID 1234, you would use the command:

“`
kill 1234
“`

8. How do you check the system load average in Unix?
The `uptime` command is used to check the system load average in Unix. It displays information about the current time, how long the system has been running, and the average system load over the past 1, 5, and 15 minutes.

9. What is the purpose of the `cron` daemon in Unix?
The `cron` daemon is responsible for executing scheduled commands or scripts at specified times. It is used to automate repetitive tasks in Unix. The `cron` configuration file (`/etc/crontab`) defines the schedule of these tasks.

10. How do you find all the running processes in Unix?
The `ps` command is used to list all the running processes in Unix. By default, it only shows the processes owned by the current user. Use the `-ef` option to display all processes.

11. How do you change the default shell for a user in Unix?
The `chsh` command is used to change the default shell for a user in Unix. The user must have permission to modify their own account settings. The command would look like:

“`
chsh -s /path/to/shell username
“`

12. How do you create a new user account in Unix?
The `useradd` command is used to create a new user account in Unix. It requires root or superuser privileges. For example, to create a new user called “john”, you would use the command:

“`
useradd john
“`

13. What is the purpose of the `sudo` command in Unix?
The `sudo` command allows a user to execute commands as another user, typically the superuser or root. It provides a way to perform administrative tasks while limiting access to only authorized users.

14. How do you mount a filesystem in Unix?
The `mount` command is used to mount a filesystem in Unix. It requires root or superuser privileges. The command takes the device or partition to mount and the mount point as arguments. For example:

“`
mount /dev/sda1 /mnt
“`

15. How do you check the status of a network interface in Unix?
The `ifconfig` command is used to check the status of a network interface in Unix. It displays information about the configured network devices, such as IP addresses, netmasks, and network activity.

16. Explain the concept of process priority in Unix.
Process priority in Unix determines the order in which processes are scheduled to run. It is controlled by the “nice” value or the “priority” value. Lower nice values indicate higher priority. Priorities range from -20 (highest priority) to 19 (lowest priority).

17. How do you create a tar archive in Unix?
The `tar` command is used to create tar archives in Unix. The command takes the options `c` (create), `f` (file), and `v` (verbose) followed by the name of the archive file and the list of files or directories to be included in the archive. For example:

“`
tar -cvf archive.tar file1 file2 directory
“`

18. How do you extract files from a tar archive in Unix?
The `tar` command is also used to extract files from a tar archive in Unix. The command takes the options `x` (extract), `f` (file), and `v` (verbose) followed by the name of the archive file. For example:

“`
tar -xvf archive.tar
“`

19. How do you search for a file in Unix?
The `find` command is used to search for a file in Unix. It can search for files by name, size, type, and other attributes. For example, to find a file named “example.txt” in the current directory and its subdirectories, you would use the command:

“`
find . -name example.txt
“`

20. How do you change the owner and group of a file in Unix?
The `chown` command is used to change the owner and group of a file in Unix. It requires root or superuser privileges. For example, to change the owner to “newowner” and the group to “newgroup” for a file called “myfile.txt”, you would use the command:

“`
chown newowner:newgroup myfile.txt
“`

Unix (8) 

Interview Questions and answers

Filter:AllUnanswered
Can you describe the process to add a new user in UNIX?
suresh answered 7 months ago • 
63 views1 answers0 votes