Unix/Linux interview question set 1/Unix/Lunux Interview Questions and Answers for Freshers & Experienced

Is it possible to use shortcuts for a long pathname?

Yes, there is. A feature known as filename expansion allows you do this using the TAB key. For example, if you have a path named /home/iceman/assignments directory, you would type as follows: /ho[tab]/ice[tab]/assi[tab] . This, however, assumes that the path is unique and that the shell you're using supports this feature.

What does a nameless (empty) directory represent?

This empty directory name serves as the nameless base of the Linux file system. This serves as an attachment for all other directories, files, drives, and devices.

What is the maximum length for a filename under Linux?

Any filename can have a maximum of 255 characters. This limit does not include the path name, so therefore the entire pathname and filename could well exceed 255 characters.

How do you access partitions under Linux?

Linux assigns numbers at the end of the drive identifier. For example, if the first IDE hard drive had three primary partitions, they would be named/numbered, /dev/hda1, /dev/hda2 and /dev/hda3.

How do you refer to the parallel port where devices such as printers are connected?

Whereas under Windows you refer to the parallel port as the LPT port, under Linux you refer to it as /dev/lp . LPT1, LPT2 and LPT3 would therefore be referred to as /dev/lp0, /dev/lp1, or /dev/lp2 under Linux.

What is netstat command in Linux?

netstat command gives various information about the network and routing tables, interface statics and more about the system.

How to change the default run level in Linux?

To change the default run level in Linux use the init command.

How to copy files to a Floppy Disk safely?

Follow these steps to copy files to a Floppy Disk safely:

1. Mount the floppy disk
2. Copy the files
3. Unmount the floppy disk

If you don’t unmount the floppy disk, then the data might become corrupted.

How to copy a file in Linux?

You can use the cp command to copy a file in Linux. The general syntax is:

$ cp <source> <destination>

Suppose you want to copy a file named questions.txt from the directory /new/linux to /linux/interview, then the command will be:

$ cp questions.txt /new/linux /linux/interview

What is network bonding in Linux?

Network Bonding is a process of combining more than two network interfaces to form a single network interface. It offers performance improvement and redundancy by increasing network throughput and bandwidth.

No need to worry if one interface is down or unplugged because the other will work. The behaviour of the bonded interface depends on the bonding method.

Explain different file system types in Linux?

In Linux, there are many file systems:

Ext, Ext2, Ext3, Ext4, JFS, XFS, btrfs, ufs, autofs, devpts, ntfs and swap.

Where are kernel modules located?

The directory name is lib/modules/kernel-version/, this is the directory where we can see the Kernel module, this stores all the valuable information about the compiled drivers. Using lsmod command users can see the installed kernel modules.

What is Umask?

Umask = users for file creation mode. When you create the file, this offers the default file access permissions. Umask also specify a new restriction to the newly created file type.

Why LVM is required?

LVM means large volume management; it is nothing but a storage management device. With the help of LVM users can create, resize, or delete the partitions. LVM also increases the abstraction, flexibility, control, gather existing storage device, and allocates the logical units.

What is a file system in Linux?

The Linux file system is used to store and handle the data. Without a file system, it becomes a very difficult task to know where the file begins from and where the file ends.

Does the CTRL+ALT+DELETE key combination work on Linux?

Yes, it works on Linux; we can use this key combination to restart the system.

What Is A Zombie?

Zombie is a process state when the child dies before the parent process. In this case the structural information of the process is still in the process table. Since this process is not alive, it cannot react to signals. Zombie state can finish when the parent dies. All resources of the zombie state process are cleared by the kernel.

What Is Bash Shell?

Bash is a free shell for UNIX. It is the default shell for most UNIX systems. It has a combination of the C and Korn shell features. Bash shell is not portable. any Bash-specific feature will not function on a system using the Bourne shell or one of its replacements, unless bash is installed as a secondary shell and the script begins with #!/bin/bash. It supports regular and expressions. When bash script starts, it executes commands of different scripts.

What is a typical size for a swap partition under a Linux system?

The preferred size for a swap partition is twice the amount of physical memory available on the system. If this is not possible, then the minimum size should be the same as the amount of memory installed.

How can you append one file to another in Linux?

One file can be appended to another file by using the command cat file 2 >> file 1. The operator “>>” appends the output of the named file or creates the file if it is not created. There is another command cat file 1 file 2 > file 3 which appends two or more files to one.

What is a Microprocessor?

A Microprocessor is a device that executes instructions. It is a single-chip device that fetches the instruction from the memory, decodes it and executes it. A Microprocessor can carry out 3 basic functions:

a) Mathematical operations like addition, subtraction, multiplication, and division
b) Move data from one memory location to another
c) Make decisions based on conditions and jump to new different instructions based on the decision.

What is a Latch?

A Latch is a temporary storage device controlled by timing signal which can either store 0 or 1. A Latch has two stable states (high-output or 1, and low-output or 0) and is mainly used to store state information. A Latch can store one bit of data as long as it is powered on.

Is it legal to edit Linux Kernel?

Yes , it is absolutely legal to edit Linux Kernel. Kernel is released under General Public License(GPL) , and anyone can edit Linux Kernel to the extent permitted under GPL. Linux Kernel comes under the category of Free and Open Source Software(FOSS).

What is meant by PIPE in Linux?

A pipe is a form of redirection used in Linux. It is used in combining more than two commands and the output of one command can take as input to the next command.

Syntax:

What is cat command in Linux?

The cat command in Linux is used for concatenating and printing the files. Users apply cat command to check the contents of the dependencies file or to confirm the version of an application which is already built locally.

Example:

$ cat requirements.txt

flask

flask_pymongo

What are daemons?

A daemon is a computer program that runs as a background process to provide functions that might not be available in the base Operating System. Daemons are usually used to run services in the background without directly being in control of interactive users. The purpose of Daemons are to handle periodic requests and then forward the requests to appropriate programs for execution.

Which are the different modes of vi editor?

There are 3 modes of vi editor:

1. Regular/Command mode: Lets you view the content
2. Insertion/edit mode: Lets you delete or insert content
3. Replacement mode: Lets you overwrite content

What are the hard links?

A hard link is another name for an existing file on Linux. We can create so many numbers of hard links, for any file. They can create links for other hard links.

What are the symbolic links?

It will be redirected to another file using its path. Target files do not contain any data. Symbolic links redirect to another entry somewhere in the file system. If the target file is deleted, the link to that file is removed, but not the file.

Which are the Linux Directory Commands?

There are 5 main Directory Commands in Linux:

What are inode and process id?

inode is the unique name given by the operating system to each file. Similarly, process id is the unique id given to each process.

What are the environmental variables?

They are dynamic values that affect the process of programs on a computer. They exist in every operating system and their types may vary. They can be created, edited, saved, and deleted and they also give information about the system behaviour.

How do you change permissions in linux?

To change permissions in linux , we need to understand the concept of binary assignment.

Each permission within a permission group is assigned a binary representation.

Read - 4 ( 100 )

Write - 2 (010)

Execute - 1 (001)

For example, if we wanted to give the owner ‘rwx’ , owner’s group ‘r-x’ and others ‘r--’ permissions will be summed up to give the permission i.e for owner- r + w + x = 4 + 2 + 1 = 7 , for owner’s group r + x = 4+1=5 , and for others = r = 2.

So, the permission will be “752”.

Now coming to the question , an admin or an owner can change the permissions of a file using the “chmod” command line utility.

Syntax of the chmod command is of the form:

chmod <file-permission> file-name.
So for bringing the permissions of the above example into effect ,we can use the command chmod 752 file.txt

Explain the Linux directory commands.


pwd: The command stands for “print working directory”. It is a built-in command which displays the current working location, working path that starts with / and directory of the user. It displays the full path of the current directory.

ls: The command is used for listing all the files in the directed folder.

cd: The command stands for “change directory”. It is used for changing the directory on which you want to work from the present directory. To access a particular directory type cd followed by the directory name.

mkdir: The command is used for creating a new directory.

rmdir: The command is used for removing a directory from the system.

What is grep command in Linux?

Ans: The grep searches file patterns. The grep searches the relevant lines for a specific pattern in the output of another command.

Example:

$ cat tomcat.log | grep org.apache.catalina.startup.Catalina.start

12-Jan-2018 17:08:35.542 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 681 ms

What is the disadvantage of Open Source?

Disadvantages of Open Source Operating System mentioned below

1. Difficulty of use
2. Compatibility Issues
3. Liabilities and warranties
4. Hidden costs

What command would you use to check how much memory is being used by Linux?

You can use any of the following commands:

1. free -m
2. vmstat
3. top
4. htop

What is the advantage of Open Source?

Linux was one of the first open-source technologies, many programmers added software that completely open to the users, which means you can download the file and change the code as you like. It has a wide range of options for users and increased security.

What is the basic difference between BASH and DOS?

The key differences between the BASH and DOS console lie in 3 areas:

- BASH commands are case sensitive while DOS commands are not;

- Under BASH, / character is a directory separator and acts as an escape character. Under DOS, / serves as a command argument delimiter and is the directory separator

- DOS follows a convention in naming files, which is 8 character file name followed by a dot and 3 characters for the extension. BASH follows no such convention.

What are the basic components of Linux?

The basic components of Linux are:

a) Kernel: It is the core component of the Operating System that manages operations and hardware.
b) Shell: Shell is a Linux interpreter which is used to execute commands.
c) GUI: GUI stands for Graphical User Interface which is another way for a user to interact with the system. But unlike CLI, GUI consists of Images, Buttons, TextBoxes for interaction.
d) System Utilities: These are the software functions that allows the user to manage the computer.
e) Application Programs: Software programs or set of functions designed to accomplish a specific task.

What is the advantage of open source?

Open source allows you to distribute your software, including source codes freely to anyone who is interested. People would then be able to add features and even debug and correct errors that are in the source code. They can even make it run better and then redistribute these enhanced source code freely again. This eventually benefits everyone in the community.

What is a swap space?

Swap space is a certain amount of space used by Linux to temporarily hold some programs that are running concurrently. This happens when RAM does not have enough memory to hold all programs that are executing.

Explain permission types in Linux.

Each file or directory has three permissions in Linux.

1. Read: It refers only to read the file.
2. Write: It refers to write the file or can modify the file of a directory.
3. Execute: It affects the user’s capability to execute the file or to view the file of a directory.

What is the Core of the Linux operating system?

The kernel is the core source of the Linux operating system.

Which linux command is used for providing informationabout the currently running processes?

The ps (i.e., process status) command is used to provide information about the currently running processes, including their process identification numbers(PIDs).

A process, also referred to as a task, is an executing (i.e., running) instance of a program. Every process is assigned a unique PID by the system.The basic syntax of ps is - ps [options]

What are the process states in Linux?

A linux process can be in any one of the following process states:

1. Running: Process is either running or ready to run.
2. Interruptible: a Blocked state of a process and waiting for an event or signal from another process.
3. Uninterruptible: a blocked state. Process waits for a hardware condition and cannot handle any signal.
4. Stopped: Process is stopped or halted and can be restarted by some other process.
5. Zombie: process terminated, but information is still there in the process table.

What is BASH?

Bash is a Unix shell and command processor written by Brian Fox for the GNU project. It is free software and acts as a replacement for Bourne Shell. It is an interpreted and not compiled process which can also be run in the terminal window.

This allows users to write commands and cause actions. Bash is capable of reading commands from shell scripts.

What is Linux Kernel?

Linux kernel is the heart of the operating system. It acts as a bridge between software and hardware. If Software requests the hardware, then the kernel delivers the data between software and hardware.

For example, if you want to play a song you should launch your default player, it requests the kernel to play a song, now the kernel will contact the hardware to seek the permissions or to seek the hardware components like if you plugged in any headset to the device. Most Android phones use Linux kernels.

Who invented Linux? Explain the history of Linux?

Linus Torvalds created Linux. Linus Torvalds was a student at the University of Helsinki, Finland in 1991. He started writing code on his own to get the academic version of Unix for free. Later on, it became popular as Linux Kernel.

What is Linux?

Linux is an Open-Source Operating System based on Unix. Linux was first introduced by Linus Torvalds. The main purpose of Linux was to provide free and low-cost Operating System for users who could not afford Operating Systems like Windows or iOS or Unix.

Search
R4R Team
R4R provides Unix/Lunux Freshers questions and answers (Unix/Lunux Interview Questions and Answers) .The questions on R4R.in website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers,Unix/Linux interview question set 1,Unix/Lunux Freshers & Experienced Interview Questions and Answers,Unix/Lunux Objetive choice questions and answers,Unix/Lunux Multiple choice questions and answers,Unix/Lunux objective, Unix/Lunux questions , Unix/Lunux answers,Unix/Lunux MCQs questions and answers Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for Unix/Lunux fresher interview questions ,Unix/Lunux Experienced interview questions,Unix/Lunux fresher interview questions and answers ,Unix/Lunux Experienced interview questions and answers,tricky Unix/Lunux queries for interview pdf,complex Unix/Lunux for practice with answers,Unix/Lunux for practice with answers You can search job and get offer latters by studing r4r.in .learn in easy ways .