Live Classes: Upskill your knowledge Now!
Chat NowPublished - Tue, 06 Dec 2022
A list of top frequently asked Unix interview questions and answers are given below.
UNIX is a portable operating system that is designed for efficient multitasking and multi-user functions. Since it is a portable operating system, it can run on different hardware platforms. It is written in C language. It was developed by Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe Ossanna.
UNIX has many distributions including Solaris UNIX, AIX, HP UNIX and BSD and many more.
UNIX includes the following features:
UNIX supports the multiuser system: In UNIX it is possible that many users can use the system with their separate workspace and logins i.e.it has full support for the multiuser environment.
UNIX supports the multitasking environment: In UNIX many apps can run at a single instance of time this is also known as a multitasking environment.
The core concepts of UNIX are given below.
The UNIX shell is a program which is used as an interface between the user and the UNIX operating system. It is not a part of the kernel, but it can communicate directly with the server.
A filter is a program that takes input from standard inputs and performs some operation on that input to produce a result as standard output.
All devices in UNIX are represented by particular files that are located in /dev directory.
Yes, you should use "rm-r*" command for this purpose.
Here, the "rm" command is used for deleting files, the -r option will erase directories and subdirectories with their internal data and * is used for selecting all entries.
You must make the shell script executable by using the UNIX "chmod" command.
A shell script if statement can be terminated by using "fi."
The cat command is used to display the file contents on the terminal, whereas more command is used like a pager which displays the screen page by page If the file is large and you have to scroll off the screen before you view it.
The "mesg" command is used to restrict incoming messages.
The "kill $!" Command is used to kill the last background job.
The "inode" data structure is used to maintain the file identification. Each file has a separate inode and a unique inode number.
A pipe is used to join two or more commands by using a pipe "I" character. The output of the first command is propagated to the second command through the pipe.
A link is a second name for a file. Links are used to assign more than one name to a file, but cannot be used to designate a directory more than one name or link filenames on different computers.
Symbolic links are the files that only contain the name of another file. The operations on the symbolic link are directed to the file pointed by it. Both the limitations of connections are eliminated in symbolic links.
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.
To change the password in UNIX operating system :
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 display the date in UNIX use the date command in command prompt.
To log out of UNIX type the logout command in the command prompt.
To perform system shutdown in UNIX, you can use the following commands:
There are three kinds of 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:
.(Single dot)-represents the current directory
..(Double dot)-represents the parent directory.
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.
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.
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.
Blank files can be created by using the touch command, the syntax for the touch command is as follows:
$ touch filename
To know the present working directory, Run the following command on the terminal.
$ pwd
To fetch the information about a file, use the following command.
$ file filename
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
In UNIX, mv command is used to move the file from one directory to some other directory.
$ mv <file-name> <destination path>
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.
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.
To make a new directory, you can use the mkdir command.
$ mkdir <directory-name>
To remove the directory, you can use the rmdir command. To use this command, use the following syntax.
$ rmdir filename.
Fri, 16 Jun 2023
Fri, 16 Jun 2023
Fri, 16 Jun 2023
Write a public review