Google News
logo
Unix Interview Questions
Unix is an operating system (OS) originally developed in the late 1960s and early 1970s by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, and others. It is a multitasking, multi-user system that provides a set of tools and utilities for managing computer hardware resources and running applications.

Unix is known for its simplicity, flexibility, and portability, making it a popular choice for servers, workstations, and even embedded systems. It has been highly influential in the development of subsequent operating systems, including Linux and macOS.
Multiuser : Unix supports multiple users simultaneously, allowing them to interact with the system and run their own processes independently.

Multitasking : Unix can execute multiple processes concurrently, switching between them rapidly to give the illusion of simultaneous execution.

Hierarchical file system : Unix organizes files and directories in a hierarchical tree structure, with the root directory at the top and subdirectories branching out from there.

Shell : Unix provides a command-line interface called the shell, which allows users to interact with the system by typing commands. The shell interprets these commands and executes them, providing a powerful way to manipulate files, run programs, and manage system resources.

Portability : Unix was designed to be highly portable, meaning it can run on a wide range of hardware platforms with minimal modifications. This has contributed to its widespread adoption and longevity.

Unix has many variants, including the original AT&T Unix, BSD Unix (Berkeley Software Distribution), and various commercial versions like Solaris, AIX, and HP-UX. It also served as the inspiration for open-source Unix-like operating systems such as Linux.
The Unix comprises mainly three layers such as kernel, shell, and user application.

Unix Architecture

Kernel - This is the core layer of the operating system which interacts with the hardware of the system. The kernel provides API via system calls to process the user requests. The kernel also provides services such as signal handling, synchronization, interprocess communication,  file system services,  network services,  and hardware monitoring. Each time a process is started, the kernel has to initialize the process, assign the process apriority, allocate memory and resources for the process, and schedule the process to run. When the process terminates, the kernel frees any memory and/or resources held by the process.
Link is used to assigning more than one name to a file. It is like a pointer to a file and one file can have multiple pointers. There are two types of link

Hard link : These hard-linked files are assigned to the same inode value as the original and thus reference the same physical location of the file. Also if the file is moved to a different directory the link will still work
ln  [original filename] [link name]?

Symbolic link : A soft link is similar to the file shortcut feature and it contains a separate inode than the original one. If the original file is moved then the link might not work, but it can reference across the different file systems.
ln  -s [original filename] [link name]?
In Unix-like operating systems, files are categorized into different types based on their attributes and purposes. Here are some of the common file types found in Unix:

Regular files : These are the most common type of files in Unix. They contain data in any format, such as text, binary, or executable code. Regular files can be created, modified, and deleted by users.

Directories : Directories are special files that store lists of other files and directories. They provide a way to organize and structure the file system hierarchy. Users can navigate through directories to access and manipulate files.

Symbolic links (symlinks) : Symbolic links are files that point to another file or directory. They act as shortcuts or aliases, allowing users to reference files or directories located elsewhere in the file system. Symbolic links can span across different file systems.

Device files : Device files represent hardware devices such as hard drives, terminals, printers, and network interfaces. They provide an interface for user programs to communicate with and control hardware devices. There are two types of device files: character devices (used for streaming data, such as keyboards or mice) and block devices (used for data storage, such as hard drives).
FIFO (named pipes) : FIFOs, or named pipes, are special files that provide inter-process communication (IPC) between processes. They allow data to be passed between processes through a first-in-first-out mechanism, similar to a queue.

Sockets : Sockets are special files used for inter-process communication over a network. They enable communication between processes running on the same system or different systems connected via a network. Sockets are commonly used for network programming, such as in client-server applications.

Special files : Special files include various system-specific files and pseudo-files used for system operations and interactions. Examples include /dev/null (a special file that discards data written to it), /dev/random and /dev/urandom (special files used for generating random data), and /proc (a virtual file system that provides information about processes and system resources).

Understanding these different file types is essential for effectively managing and working with the Unix file system.
6 .
Can you write a command to erase all files in the current directory including all its sub-directories?
rm –r* is used to erase all files in the current directory including all its sub-directories. rm is used for deleting files, but with the addition of option -r it erases all files in directories and subdirectories, and finally, an asterisk represents all entries.
7 .
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.
In Unix-like operating systems, the kernel is the core component that serves as the bridge between the hardware and the software layers of the system. It is responsible for managing system resources, providing essential services to user programs, and facilitating communication between different parts of the system.

Here are some key functions of the kernel in Unix :

Process management : The kernel creates and manages processes, which are instances of running programs. It allocates system resources (such as CPU time and memory) to processes, schedules their execution, and facilitates communication and synchronization between them.

Memory management : The kernel allocates and manages system memory, ensuring that each process has access to the memory it needs without interfering with other processes. It also handles virtual memory management, including memory mapping, paging, and swapping, to efficiently utilize available physical memory and provide a unified memory abstraction to user programs.

File system management : The kernel provides an interface for user programs to access and manipulate files and directories stored on storage devices (such as hard drives and flash drives). It manages file system metadata, handles file I/O operations (such as reading and writing data), and enforces file permissions and security policies.

Device management : The kernel manages hardware devices connected to the system, including storage devices, network interfaces, input/output devices (such as keyboards, mice, and displays), and other peripheral devices. It provides device drivers to communicate with hardware devices and exposes standardized interfaces (such as device files in the /dev directory) for user programs to access and control devices.

System call interface : The kernel exposes a set of system calls, which are functions that user programs can invoke to request services from the kernel. System calls provide a standardized interface for performing privileged operations (such as accessing hardware devices and managing system resources) and interacting with the kernel on behalf of user programs.
The following table enlists the most common shells along with their indicators;

Shell

Indicators

Bourne Shell

sh

C Shell

csh

Bourne Again shell

Bash

Enhanced C shell

tcsh

Z Shell

zsh

Korn Shell

ksh

10 .
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.
The shell is a command-line interface (CLI) program that provides an interactive way for users to interact with the Unix-like operating system. It interprets user commands and executes them on behalf of the user. The basic responsibilities of a shell include:

Command interpretation : The shell interprets the commands entered by the user and translates them into actions that the operating system can understand and execute.

Command execution : The shell executes the commands entered by the user, launching processes and programs as necessary. It manages the execution of commands, including handling input/output redirection, piping, and job control.

Environment management : The shell manages the environment in which commands are executed, including environment variables, working directory, and file descriptors. It allows users to set, modify, and export environment variables, customize the shell environment, and control the behavior of commands.

File and directory management : The shell provides commands for navigating the file system, listing files and directories, creating, copying, moving, and deleting files, and managing file permissions and ownership. It allows users to manipulate files and directories from the command line.

I/O redirection : The shell allows users to redirect input and output streams of commands, enabling them to read input from files or other commands, and write output to files or other destinations. It supports input/output redirection operators such as '<', '>', and '|'.

Pipeline processing : The shell supports the creation of pipelines, allowing users to chain multiple commands together, with the output of one command serving as the input to the next command. It manages the flow of data between commands in a pipeline and ensures proper synchronization and communication.

Job control : The shell provides facilities for managing running processes and jobs, including starting, stopping, suspending, resuming, and terminating processes. It allows users to run commands in the background, foreground, or suspended state, and monitor their execution status.

Scripting : The shell supports scripting, allowing users to write shell scripts (text files containing sequences of shell commands) to automate repetitive tasks, customize the shell environment, and create complex command sequences.
A pipe is a unidirectional mechanism of interprocess communication. In a Unix command line, if a pipe is being used, the first process is assumed to be writing to stdout and the second is assumed to be reading from stdin.

$who | sort | lpr

This will create 3 processes with 2 pipes in between them.

Pipes
egrep is an extended version of grep, in addition to searching using regular expressions, egrep can use extended regular expressions for searching.
$ ls | grep '.env|.json'?

This will check whether any file has extension ‘.env|.json’ literally
$ ls | egrep '.env|.json'?

But in this case, it checks whether any file has extension ‘.env’ or ‘.json’ since ‘|’ this will be considered as a metacharacter.
The Unix command syntax consists of three parts : the command, a list of options, and arguments.

Syntax :
command - (options) argument1 argument2..?

* 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.
In Unix-like operating systems, wildcards are special characters used to represent patterns in filenames or text strings. They are widely used in command-line interfaces (CLI) to perform operations such as file matching, searching, and manipulation. Wildcards allow users to specify a set of files or text strings that match a particular pattern, rather than explicitly specifying each individual item. Some common Unix wildcards include:

1. (asterisk) : Represents zero or more characters. It matches any sequence of characters in a filename or text string. For example:

* *.txt matches all files with a ".txt" extension.
* file* matches all files whose names start with "file".

2. ? (question mark) : Represents exactly one character. It matches any single character in a filename or text string. For example:

* file?.txt matches files like "file1.txt", "fileA.txt", etc.

3. [] (square brackets) : Represents a range of characters or a character class. It matches any single character within the specified range or class. For example:

* [abc] matches any one of the characters 'a', 'b', or 'c'.
* [0-9] matches any digit from 0 to 9.
* [!0-9] matches any character that is not a digit.

4. {} (curly braces) : Represents a list of comma-separated strings or a range of numbers. It matches any of the strings or numbers specified within the braces. For example:

* {file1,file2,file3}.txt matches "file1.txt", "file2.txt", and "file3.txt".
* {1..5} matches the numbers 1, 2, 3, 4, and 5.

Unix wildcards are commonly used with commands like ls, cp, mv, rm, and grep to perform file operations, file matching, and text processing. They provide a powerful and flexible way to specify patterns and perform operations on multiple files or text strings at once, saving time and effort for users working in the command line.
16 .
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.
17 .
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.
18 .
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.
19 .
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.
20 .
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.
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
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
23 .
What is inode?
An inode is an entry created on a section of the disk set aside for a file system. The inode contains nearly all the information about a file. 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.
24 .
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.
25 .
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.
26 .
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.
27 .
Explain system bootup in UNIX.
System bootup is the first thing that takes place when the power button is pressed in UNIX. Whenever the power button is pressed, BIOS is fired up and checks if all the hardware connected to the system are working correctly, after being successful the system asks the user to provide authentication.
28 .
How to change the password in UNIX operating system?
To change the password in UNIX operating system :

* Type in the command passwd.
* You will get a screen which prompts to enter your default(current) password, type your current password.
* if the current password is verified, then the terminal will prompt you to enter the new password.
* Enter the new password twice, and your password will be updated.
Command ls can be used to list directories in command prompt. Also, we can also use a variety of ls commands like:

ls -a In Linux, hidden files start with. (dot) Symbol and they are not visible in the regular directory. The (ls -a) command will enlist the whole list of the current directory including the hidden files.
ls -l It will show the list in a long list format.
ls -lh This command will show you the file sizes in human readable format. Size of the file is tough to read when displayed regarding a byte. The (ls -lh)command will give you the data regarding Mb, Gb, Tb, etc.
ls -lhS If you want to display your files in descending order (highest at the top) according to their size, then you can use (ls -lhS) command.
ls -l - -block-size=[SIZE] It is used to display the files in a specific size format. Here, in [SIZE] you can assign size according to your requirement.
ls -d */ It is used to display only sub directories.
ls -g or ls -lG With this, you can exclude column of group information and owner.
ls -n It is used to print group ID and owner ID instead of their names.
ls --color=[Value] This command is used to print list as colored or discolored.
ls -li This command prints the index number if the file in the first column.
ls -p It is used to identify the directory easily by marking the directories with a slash (/) line sign.
ls -R It will display the content of the sub-directories also.
ls -lX It will group the files with the same extensions together in the list.
ls -lt It will sort the list by displaying a recently modified file at the top.
ls ~ It gives the contents of the home directory.
ls ../ It gives the contents of the parent directory.
ls --version It checks the version of ls command.
To perform system shutdown in UNIX, you can use the following commands :

* halt
* init 0
* init 6
* power off
* reboot
* shutdown
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 :

* .profile
* .kshrc
* .rhosts
* .cshrc
32 .
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.
Swapping : In the case of swapping the main memory is loaded with the complete process and thus only the process less than the main memory size is executable. This is fairly easy to implement but not very efficient.

Paging : On the other hand in the case of paging instead of loading the whole process into the main memory only required memory pages are loaded. This is complex to implement but allows us to run a number of processes simultaneously

There are three components of a file permissions

Owner permissions − This determines what actions the owner of the file can perform.
Group permissions − This determines what actions a group member(of the group that a file belongs to) can perform.
Other (world) permissions − This is for everyone else.
$ ls -l /home/sroy8091
-rwxr-xr--  1 sroy8091   users 1024  Feb  23 00:10  myfile
drwxr-xr--- 1 sroy8091   users 1024  Feb  23 00:10  mydir?

r, w, and x represent read, write and execute respectively.

To change the file permission we need to run chmod command.
$ ls -l testfile
-rwxrwxr--  1 sroy8091   users 1024  Feb 23 00:10  testfile
$ chmod o+wx testfile
$ ls -l testfile
-rwxrwxrwx  1 sroy8091   users 1024  Feb 23 00:10 testfile?

Here we updated the permission for other users, from only read to read, write and execute.
35 .
What do you know about the MBR?
It stands for Master Boot Record and is a small program that is executed when the computer is booting up in order to find the OS and load it into memory. During the first stage of the system boot-up process, the BIOS (basic input-output system) searches for the MBR and then loads it into memory, after which the MBR takes over.
Some commonly used networking commands in Unix are :

* telnet : This is used for remote login and for communication with another hostname.

* ping : This is used for checking network connectivity.

* hostname : This gives the IP address and domain name.

* nslookup : This performs a DNS query.

* xtraceroute : This is used to determine the number of hops and response time required to reach the network host.

* netstat : This provides information about system and ports, routing tables, interface statistics, etc.

* tcpdump : This provides info about both incoming and outgoing network traffic.
37 .
How to Kill a process in UNIX?
The kill command accepts process ID (PID) as a parameter. This is applicable only to the processes owned by the command executor.

Syntax – kill PID
38 .
Explain 'nohup' in UNIX?
nohup” is a special command that is available to run a process in the background. The process starts with ‘nohup’ command and does not terminate even if the user started to log off from the system.
39 .
What is the explanation for protection fault?
When the process accesses a page, that does not have access permission is referred to as a protection fault. Also, when a process attempt to write on a page whose copy on the write bit was set during the fork() system call is incurred for protection fault.
40 .
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.
41 .
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.
42 .
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.
43 .
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.
44 .
How do you check how much space left in current drive ?
By using "df" command in UNIX. For example "df -h ." will list how full your current drive is. This is part of anyone day to day activity so I think this Unix Interview question will be to check anyone who claims to working in UNIX but not really working on it.
45 .
What is the difference between ps -ef and ps -auxwww?
UNIX interview questions answers, UNIX Linux questionsThis is indeed a good Unix Interview Command Question and I have faced this issue while ago where one culprit process was not visible by execute ps –ef command and we are wondering which process is holding the file.

ps -ef will omit process with very long command line while ps -auxwww will list those process as well.
46 .
If one process is inserting data into your MySQL database? How will you check how many rows inserted into every second?
Purpose of this Unix Command Interview is asking about watch command in UNIX which is repeatedly execute command provided with specified delay.
Absolute Path Relative Path 
It is known as the absolute path It is known as the non-absolute path
It refers to a specific location in a file system without denoting the current directory. It refers to a location denoting the current directory
It contains the complete address of a file location. It contains the partial address of a file location. 
This path doesn’t change if we change the current directory This path changes if we change the current directory
48 .
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.
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.

Syntax
rm { file name }?

For example, if you want to remove a text file, you can use write the command as follows
rm abc. txt?
The gzip command in Unix-like operating systems is used for file compression and decompression. It is commonly used to reduce the size of files, making them easier to store, transfer, and archive. The name "gzip" stands for "GNU zip," indicating its association with the GNU project.

Here's an overview of the functions of the gzip command :

1. File compression : When used to compress a file, the gzip command replaces the original file with a compressed version, appending the ".gz" extension to the filename. It uses the DEFLATE compression algorithm to compress data efficiently, typically achieving significant reductions in file size, especially for text-based files.

Syntax for compressing a file :
gzip [options] filename?

Example :
gzip example.txt?

After compression, the original file example.txt is replaced with the compressed file example.txt.gz.

2. Decompression : The gzip command can also be used to decompress compressed files created with gzip or compatible compression programs. It restores the original uncompressed file, removing the ".gz" extension from the filename.

Syntax for decompressing a file :
gzip -d filename.gz?

Example :
gzip -d example.txt.gz?

After decompression, the compressed file example.txt.gz is replaced with the uncompressed file example.txt.

3. Options and flags :
The gzip command supports various options and flags to customize its behavior, including options to specify compression level (-1 for fastest compression, -9 for best compression), preserve file attributes (-c for output to standard output, -k to keep the original file), force compression or decompression (-f), and more. You can see the full list of options by running gzip --help.

Example of using options :
gzip -9 example.txt   # Compress with the highest compression level?

Overall, the gzip command is a versatile and efficient tool for compressing and decompressing files in Unix-like environments, helping users save disk space, reduce bandwidth usage, and simplify file management tasks.
A Path is the unique location of a file/directory and a way to access it within the hierarchy of directories. There are basically two types of pathnames that are used in Unix.

Absolute Pathname : The complete path specifying the location of a file/ directory from the very start of the actual file system(root directory).

Ex : /usr/local/Cellar/mysql/bin


Relative Pathname : The path from the current working directory where the user is i.e. the present working directory (pwd).

Ex : If current directory is /usr/local/Cellar the the relative path for bin is ./mysql/bin
A SuperBlock is a program that contains records of specific file systems such as the block size, the empty and the filled blocks and their respective counts, the size of the block groups, the disk block map, the size and location of the inode tables, and usage information. There are basically two types of superblocks:

* Default superblock : It is a fixed offset from the beginning of the system’s disk partition.

* Redundant superblock : There are multiple copies of superblocks of a default one and are referenced when the default superblock is affected by a system crash or some errors.
53 .
Explain the alias mechanism.
To reduce the time of repeatedly typing long commands, an alias is used to assign another name to that command. Basically, it is a short form of a larger command.
alias gco='git checkout -b'?

Here, we added an alias for the checkout command of git which is frequently used by devs making it less painless every time typing a long command.
54 .
Explain mount and unmount commands.
Mount :  The mount command mounts a storage device or file system onto an existing directory making it accessible to users.

Unmount : This unmount command detaches the mounted file system safely. It also informs the system of any pending read and write operations.
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 text typed on the keyboard, input from other files, or output of other files serving as input. Standard output is by default the display screen.

The most popular example of Unix filter id is the grep command. This program look for a certain 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)

Some of the options that are used along with grepping command are enlisted below :

-v : prints a line that does not match the pattern.
-n : print matched line and line number.
-l : print file names with matching lines.
-c : prints only count the matching lines.
-i : matches either uppercase or lowercase.
56 .
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.
Bourne shell is referred to as the standard shell. The default prompt here is the ‘$’ character.

The key features of the Bourne shell include :

* Input/ Output redirection.
* Use of Metacharacters for file name abbreviations.
* Using shell variables for the customizing environment.
* Creation of programs using a built-in command set.
The Korn shell is the most advanced as well as an extension to the Bourne Shell which is backward-compatible.

Some of the features of the Korn shell are listed below :

* 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 shellcode.
* Support for arrays and arithmetic expressions.
* Ability to use aliases which are defined as the shorthand names for commands.
A variable 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 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 work in a particular way. They may have default values or values that can be assigned manually by using the appropriate assignment command.

* To define a shell variable, the ‘set’ command is used.
* To delete a shell variable, the ‘unset’ command is used.
Command substitution is the method that is performed every time the commands that are enclosed in backquotes are processed by the shell.  This process replaces the standard output and displays it on the command line.

Command substitution can perform the following tasks :

* Invoke subshell
* Result in word splitting
* Remove trailing new lines
* Using the ‘redirection’ and ‘cat’ commands, allows setting a variable to the content of the file.
* Allows setting a variable to the output of the loop
61 .
You have an IP address in your network, how will you find the hostname and vice versa?
nslookup command is used to query internet domain name servers which can be used to find hostname from an IP address and for reverse lookup also, Similarly host command can also be used.
It is the first thing when the system starts. It has majorly 5 phases

* Hardware  : BIOS fired up and checks for the hardware connection

* Operating System Loader : The OS loader is located in the initial 512-byte block of the boot device known as the MBR

* Kernel : It initializes various components of the computer, operating system and each portion of software responsible for task, usually consider a driver

* root user-space process (init and inittab) : This defines what should be run when the /sbin/init program is instructed to enter a particular run-level, giving the administrator an easy way to establish an environment for some usage

* Boot scripts : For each managed service (mail, nfs server, cron, etc.), there is a single startup script located in a specific directory.
The UNIX operating system job scheduler provides three different types of job classes

* Time-share Job Class : This is the default job class and has priority 0 through 59, with 59 being the highest priority. In this job class, each process is assigned a time slice where the time slice specifies the number of CPU clock ticks that a particular task can occupy. Once the process finishes its time slice, the process is placed on the sleep queue, and the priority decreases.

* System Job Class : This class is reserved for system daemon processes. The priority range for the system job class is between 60 and 99. These are of higher priority than the time-share job class. This is to ensure that the system can provide services to the time-share job class processes when system services such as memory, and/or file I/O are requested.

* Real-Time Job Class : This is the highest priority job class and has no time slice. Real-time process priorities range between 100 and 159. This ensures that critical processes always acquire the CPU as soon as the process is scheduled to run. Because there is no time slice the number of context switches is reduced significantly.
* 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.
Some filename manipulation commands along with their description is enlisted below in the table :

Command Description
cat filename Displays contents of the file
cp source destination Used to copy source file into the destination
mv old name new name Move/rename and old name to the new name
rm filename Remove/delete filename
Touch filename Changing modification time
In [-s] old name new name Creates soft link on old name
Is –F Displays information about file type
Chmod command is used to change file or directory access permission and is the most frequently used command in Unix. According to mode, the chmod command changes the permission of each given file.

The syntax of the chmod command is :

Chmod [options] mode filename.

Here in the above format, options could be :

-R : recursively change the permission of the file or directory.
-v : verbose, i.e. output a diagnostic for every file processed.
-c : report only when the change is made.
Etc.
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 as 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.
System calls : As the name implies, system calls are defined as an interface that is basically used in the kernel itself. Although they may not be fully portable 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 a 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.
Links are defined as a second name that is used to assign more than one name to a file. Although links are referred to as a pointer to another file they cannot be used to link filenames on different computers.

A Symbolic link is also known as the soft link. It 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 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 also be used to create a file system.

The following command is used to create a symbolic link :

* Ln –s target link_name
* Here, the path is ‘target
* The name of the link is represented by link_name.