Linux Interview 1

1)  Linux Introduction
Linux is an open source operating system based on UNIX, and was first introduced by Linus Torvalds.

2) What is the difference between UNIX and LINUX?

Unix originally began as a propriety operating system from Bell Laboratories, which later on spawned into different commercial versions. but Linux is free, open source and intended as a non-propriety operating system.

3) What is BASH?
BASH is short for “Bourne Again Shell”.  It was written by Steve Bourne as a replacement to the original Bourne Shell (represented by /bin/sh). It combines all the features from the original version of Bourne Shell, plus additional functions to make it easier and more convenient to use. It has since been adapted as the default shell for most systems running Linux.

4) What is Linux Kernel?
The Linux Kernel is a low-level systems software whose main role is to manage hardware resources for the user. It is also used to provide an interface for user-level interaction.

5) What is LILO?
LILO is a boot loader for Linux. It is used mainly to load the Linux operating system into main memory so that it can begin its operations.

6) What is a swap space?
A 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 running programs.

7 ) What are the basic components of Linux?

Linux has : kernel, shells, GUIs, system utilities, and application program

8) Describe the root account.

The root account is a Linux system administrator account, and allows full control of the system. When Linux is installed by default root account is created.

9) What is CLI?
CLI is the Command Line Interface which allows user to type commands to instruct the computer to perform operations.

10)  How to find memory a Linux System  is using?

From the shell

#cat /proc/meminfo

11) What is 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.

12) What are symbolic links?
Symbolic links point to programs, files or directories. It allows users instant access to it without having to go directly to the entire path.

13) Does the Ctrl+Alt+Del key combination work on Linux?
Yes, it is used to  perform a system restart and the reboot is immediate without any confirmation.

14 ) How do you refer to the parallel port where devices such as printers are connected?
Refer to it as /dev/lpX  ( X is the number of ports available ex 1 , 2 , 3 etc)

15) Are drives such as harddrive and floppy drives represented with drive letters?
No they are not represented as drive letters instead they are referred as for example floppy drives are referred to as /dev/fd0 and /dev/fd1. IDE/EIDE hard drives are referred to as /dev/hda, /dev/hdb, /dev/hdc.

16) How do you change permissions under Linux?
You can grant permission using the chmod command. Use + symbol to add permission or – symbol to deny permission, along with any of the following letters: u (user), g (group), o (others), a (all), r (read), w (write) and x (execute). For example the command chmod go+rw FILE1.TXT grants read and write access to the file FILE1.TXT, which is assigned to groups and others.

17) In Linux, what names are assigned to the different serial ports?
Serial ports are identified as /dev/ttyS0 to /dev/ttyS7.

18) What are hard links?

Hard links point directly to the physical file on disk, and not on the path name. This means that if you rename or move the original file, the link will not break, since the link is for the file itself, not the path where the file is located.

19) What are the filenames that are preceded by a dot?

filenames that are preceded by a dot are hidden files. These files can be configuration files that hold important data or setup info. Setting these files as hidden makes it less likely to be accidentally deleted.

20) Explain virtual desktop.
This serves as an alternative to minimizing and maximizing different windows on the current desktop. Using virtual desktops, each desktop is a clean slate where you can open one or more programs. Rather than minimizing/restoring all those programs as needed, you can simply shuffle between virtual desktops with programs intact in each one.

21) How do you share a program across different virtual desktops under Linux?
To share a program across different virtual desktops, in the upper left-hand corner of a program window look for an icon that looks like a pushpin. Pressing this button will “pin” that application in place, making it appear in all virtual desktops, in the same position onscreen.

22) What is the pwd command?

The command prints the  present working directory  and is used to display the current location in the directory tree.

23) What are daemons?
Daemons are services that provide several functions that may not be available under the base operating system. Its main task is to listen for service request and at the same time to act on these requests. After the service is done, it is then disconnected and waits for further requests.

24) What are the kinds of permissions under Linux?

There are 3 kinds of permissions under Linux:
– Read: users may read the files or list the directory
– Write: users may write to the file of new files to the directory
– Execute: users may run the file or lookup a specific file within a directory

25) What are the different modes when using vi editor?

There are 3 modes under vi:
– Command mode – this is the mode where you start in
– Edit mode – this is the mode that allows you to do text editing
– Ex mode – this is the mode wherein you interact with vi with instructions to process a file

26) Is it possible to use shortcut 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/raj/game directory, you would type as follows: /ho[tab]/ra[tab]/ga[tab] . This, however, assumes that the path is unique, and that the shell you’re using supports this feature.

27) What is redirection?
Redirection is the process of directing data from one output to another. It can also be used to direct an output as an input to another process.

28) What is grep command?
grep a search command that makes use of pattern-based searching. It makes use of options and parameters that is specified along the command line and applies this pattern into searching the required file output.

29) What are the contents in /usr/local?

It contains locally installed files. This directory actually matters in environments where files are stored on the network. Specifically, locally-installed files go to /usr/local/bin, /usr/local/lib, etc.). Another application of this directory is that it is used for software packages installed from source, or software not officially shipped with the distribution.

30) How do you terminate an ongoing process?
Every process in the system is identified by a unique process id or pid. Use the kill command followed by the pid in order to terminate that process. To terminate all process at once, use kill 0.

31) What is command grouping and how does it work?

You can use parentheses to group commands. For example, if you want to send the current date and time along with the contents of a file named BINGO to a second file named ANGLES, you can apply command grouping as follows: (date cat BINGO) > ANGLES

32) How do you execute more than one command or program from a single command line entry?
You can combine several commands by separating each command or program using a semicolon symbol. For example, you can issue such a series of commands in a single entry:
ls –l cd .. ls –a MYWORK
which is equivalent to 3 commands:
ls -l
ls -a MYWORK
**Note that this will be executed one after the other, in the order specified.

33) Write a command that will look for files with an extension “c”, and has the occurrence of the string “man” in it.
#Find ./ -name “*.c” | xargs grep –i “man”

34) Write a command that will display all .txt files, including its individual permission.
# ls -a -l *.txt

35) Write a command that will do the following:
-look for all files in the current and subsequent directories with an extension c,v
-strip the,v from the result (you can use sed command)
-use the result and use a grep command to search for all occurrences of the word DON in the files.
Find ./ -name “*.c,v” | sed ‘s/,v//g’ | xargs grep “DON”

Leave a Reply

Your email address will not be published. Required fields are marked *