Linux Interview Questions

Linux Operating System questions are mostly commonly asked in interview








Networking Questions Series 1

Linux is a unix based operating system. It was first introduced by linus Torvalds. It is an open source operating system that was designed to provide free and a low cost operating system for the computer users.

Linux kernel is low level system software. It is used to manage the hardware resources for the users. It provides an interface for user- level interaction.

Unix was originally started as a propriety operating system for bell laboratories, which later release their commercial version while linux is a free, open source and a non propriety operating system for the mass uses.

Yes we can edit linux kernel because it is released under general public license(GPL) and any one can edit it. It comes under the category of free and open source software.

Three types of modes are there- 1.Regular mode or command mode 2.Insertion mode or edit mode 3.replacement mode or ex mode

Just like the other operating systems, linux has all components like kernel, shells, GUIs, system utilities and application programs.

Lilo is a boot loader for linux. It is used to load the linux operating system into the main memory to begin its operations.

Bash is a short form of bourne again shell. It was a replacement to the original bourne shell, written bu steve bourne.

Open source facilitates you to distribute your software, including source codes freely to anyone who is interested. So, you can add features and even debug and correct errors of the source code.

Swap space is used to specify a space which is used by linux to hold some concurrent running program temporarily. It is used when ram does not have enough space to hold all programs that are executing.

Every aspect comes with additional features and it provides a free downloading facility for all codes.

Bash commands are case sensitive while dos commands are not case sensitive. Dos follows a convention in naming files. In Dos, 8 character file name is followed by a dot and 3 characters for the extension. Bash doesn’t follow such convention.

The root account is like a system administrator account. It provides you full control of the system. You can create and maintain user accounts, assign different permission for each account etc.

CLI stands for command line interface. It is an interface that allow users to type declarative commands to instruct the computer to perform operations.

It stands for graphical user interface. It uses the images and the icons which are clicked by the users to communicate with the system. It is more attractive and user-friendly because the use of the images and icons.

gunzip command is used to uncompress gzip files.

SMTP stands for simple mail transfer protocol. It is an internet standard for mail transmission.

Open office suite is available free for both Microsoft and linux. You can install it on both of them.

samba service is used to connect linux machines to Microsoft network resources by providing Microsoft SMB support.

last, chage, chsh, lsof, chown, chmod, useradd, userdel, newusers etc.

255 characters.

No, there is no operating system till date that is virus free but linux is known to have less number of viruses.

/stc partition.

MD5 is an encryption method so it is used to encrypt the passwords before saving.

VI filename.

x deletes a current character. dd deletes the current line.

yes, it works like windows.

wq saves the current work and exits the vi whereas q! exits the vi without saving the current work.

gpasswd – r removes the password from the group. Here, the gpasswd changes the password of the group and when it is accompanied by –r, the password gets removed.

With the installation of Linux, a super user account is created called as ‘root’

The syslogd daemon tracks the system information and saves it to specified log files.

kernel.h

The command that I would use is: pr -l60 draft - The default page length when using pr is 66 lines. - The -l option specifies a different length.

s

This can be achieved by issuing the su command. - This will prompt you for the password of the root account. - Providing the password, logs you in as root. Now, you can perform any administrative duties.

When you select only a portion of your file hierarchy or a single partition to back up, it is called partial backup

- Write the commands, each separated by a semi-colon. Press enter after the last command. - The semi-colon would inform the shell that multiple commands are being entered at the command line, to be executed serially.

a.) Soft link files have different inode numbers than source file b.) The soft link file will be of no use if original file is deleted.

- It is a structure which has the description of all the files and pointers to the data blocks of files stored in it. - The information contained is file-size, access and modification time, permission and so on.

By default, the main system log is '/var/log/messages'. This file contains all the messages and the script written by the user. By default all scripts are saved in this file. This is the standard system log file, which contains messages from all system software, non-kernel boot issues, and messages that go to 'dmesg'. dmesg is a system file that is written upon system boot.

Security is the most important aspect of an operating system. Due to its unique authentication module, Linux is considered as more secured than other operating systems. Linux consists of PAM. PAM is Pluggable Authentication Modules. It provides a layer between applications and actual authentication mechanism. It is a library of loadable modules which are called by the application for authentication. It also allows the administrator to control when a user can log in. All PAM applications are configured in the directory "/etc/pam.d" or in a file "/etc/pam.conf". PAM is controlled using the configuration file or the configuration directory.

Minimum 2 partitions are needed for installing Linux. The one is "/ or root" which contains all the files and the other is swap. Linux file system is function specific which means that files and folders are organized according to their functionality. For example, all executables are in one folder, all devices in another, all libraries in another and so on. "/ or root" is the base of this file system. All the other folders are under this one. "/" can be consider as "C:". Swap is a partition that will be used as virtual memory. If there is no more available RAM a Linux computer will use an area of the hard disk, called swap, to temporarily store data. In other words it is a way of expanding your computers RAM.

dmesg command is used to review boot messages. This command will display system messages contained in the kernel ring buffer. We can use this command immediately after booting to see boot messages. A ring buffer is a buffer of fixed size for which any new data added to it overwrites the oldest data in it.

When a new application is installed its documentation is also installed. This documentation is stored under the directory named for application. For example if my application name is App1 then the path of the documentation will be /user/doc/App1. It contains all the information about the application. It contains date of creating application, name of application and other important module of the application. We can get the basic information of application from the documentation.

pwconv command is used for giving shadow passwords. Shadow passwords are given for better system security. The pwconv command creates the file /etc/shadow and changes all passwords to ‘x’ in the /etc/passwd file. First, entries in the shadowed file which don't exist in the main file are removed. Then, shadowed entries which don't have `x' as the password in the main file are updated. Any missing shadowed entries are added. Finally, passwords in the main file are replaced with `x'. These programs can be used for initial conversion as well to update the shadowed file if the main file is edited by hand.

useradd command is used for creating a new user account. When invoked without the -D option, the useradd command creates a new user account using the values specified on the command line and the default values from the system. The new user account will be entered into the system files as needed and initial files copied, depending on the command line options. This command uses the system default as home directory. If –m option is given then the home directory is made.

Shadow password packages are used for security of central passwords. Security is the most important aspect of every operating system. When this package is not installed the user information including passwords is stored in the /etc/passwd file. The password is stored in an encoded format. These encoded forms can be easily identified by the System crackers by randomly encoding the passwords from dictionaries. The Shadow Package solves the problem by relocating the passwords to another file (usually /etc/shadow). The /etc/shadow file is set so that it cannot be read by just anyone. Only root will be able to read and write to the /etc/shadow file.

Using ‘free’ & ‘vmstat’ command, we can display the physical and virtual memory statistics, respectively. With the help of ‘sar’ command, we can see the CPU utilization & other stats..

You cannot restore the entire operating system from tape backup device. So you should reinstall the core operating system, and then restore system configuration files and user data from tape backup device.

By default, the main system log is ‘/var/log/messages’. This file contains all the messages and the script written by the user. By default, all scripts are saved in this file. This is the standard system log file, which contains messages from all system software, non-kernel boot issues, and messages that go to ‘dmesg’. dmesg is a system file that is written upon system boot.

The crontab command is used for scheduling of the commands to run at a later time. SYNTAX crontab [ -u user ] file crontab [ -u user ] { -l | -r | -e }

LILO (Linux Loader) is the boot loader for Linux operating system to load it into the main memory so that it can begin its operations. Bootloader here is a small program that manages a dual boot. LILO resides in MBR (Master Boot Record). Its major advantage is that it allows the fast bootup of Linux when installing in the MBR. Its limitation lies in the fact that it is not possible for all computers to tolerate modification of MBR.

by using "ps -ef" you can get a list of all process and then use grep to find your process and get the PID of that process. Once you got PID you can use the kill command to kill that process as shown in this example of kill command in UNIX.

/proc is a virtual file system that provides detailed information about Linux kernel, hardware and running processes. Files under /proc directory named as Virtual files. Since /proc contains virtual files, it is called virtual file system. These virtual files have unique qualities. Most of them are listed as zero bytes in size. Virtual files such as /proc/interrupts, /proc/meminfo, /proc/mounts, and /proc/partitions provide an up-to-the-moment glimpse of the system’s hardware. Others: /proc/filesystems file and the /proc/sys/ directory provide system configuration information and interfaces.

When there are multiple windows available on the current desktop and there appears the problem of minimizing and maximizing windows or restoring all the current programs, there ‘Virtual Desktop’ serves as an alternative. It allows you to open one or more programs on a clean slate. Virtual desktops are basically stored on a remote server and serve the following benefits: Virtual desktops are basically stored on a remote server and serve the following benefits Cost savings as the resources can be shared and allocated as and when required. Resources and energy are more efficiently used. Data integrity is improved. Centralized administration Less compatibility issues.

As the name suggests, it is like a system administrator account which gives you the ability to fully control the system. Root account serves as the default account whenever Linux is installed.Below mentioned functions can be performed by Root account Below mentioned functions can be performed by Root account Create user accounts Maintain user accounts Assign different permissions to each account created and so on..

Swap space is the amount of physical memory that is allocated for use by Linux to hold some concurrent running programs temporarily. This condition usually occurs when Ram does not have enough memory to support all concurrent running programs. This memory management involves the swapping of memory to and from physical storage. There are different commands and tools available to manage the Swap space usage.

The 3 different kinds of modes in vi editor are enlisted below Command Mode/ Regular Mode Insertion Mode/ Edit Mode Ex Mode/ Replacement Mode

The work of Ctrl+Alt+Del key combination on Linux operating system is same as is for Windows i.e. to restart the system. The only difference is that there is no confirmation message displayed and a system is rebooted directly.

Linux is considered as cases sensitive. Case sensitivity can sometimes serve as the reason for displaying different answers for the same command as you might enter different format of commands each time. In terms of case sensitivity, the command is same but the only difference occurs with regard to uppercase and lowercase letters. For example cd, CD, Cd are different commands with different outputs.

As the name suggests, the shell script is the script written for the shell. This is a program file or says a flat text file where certain Linux commands are executed one after another. Although the execution speed is slow, Shell script is easy to debug and can also simplify everyday automation processes.

This so-called Free software movement allows several advantages, such as the freedom to run programs for any purpose and freedom to study and modify a program to your needs. It also allows you to redistribute copies of software to other people, as well as the freedom to improve software and have it released for the public.

In general, one desktop environment, like KDE or Gnome, is good enough to operate without issues. It’s all a matter of preference for the user, although the system allows switching from one environment to another. Some programs will work in one environment and not work on the other, so it could also be considered a factor in selecting which environment to use.

Just like any other typical operating system, Linux has all of these components: kernel, shells and GUIs, system utilities, and an application program. What makes Linux advantageous over other operating system is that every aspect comes with additional features and all codes for these are downloadable for free.

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.



codenody