Linux interview questions

Linux questions

Combined


1) What is Bootstraping?


In general, bootstrapping usually refers to a self-starting process that is supposed to proceed without external input.
In computer technology the term (usually shortened to booting) usually refers to the process of loading the basic software into the memory of a computer after power-on or general reset, especially the operating system which will then take care of loading other software as needed.

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. On the other hand, Linux is free, open source and intended as a non-propriety operating system for the masses.

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?


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.

7) 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.

8 ) What are the basic components of Linux?


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.

9) Does it help for a Linux system to have multiple desktop environments installed?


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.

10) 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.

11) What is the importance of the GNU project?


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.

12) Describe the root account.


The root account is like a systems administrator account and allows you full control of the system. Here you can create and maintain user accounts, assigning different permissions for each account. It is the default account every time you install Linux.

13) What is CLI?


CLI is short for Command Line Interface. This interface allows the user to type declarative commands to instruct the computer to perform operations. CLI offers greater flexibility. However, other users who are already accustomed to using GUI find it difficult to remember commands including attributes that come with it.

14) What is GUI?


GUI, or Graphical User Interface, make use of images and icons that users click and manipulate as a way of communicating with the computer. Instead of having to remember and type commands, the use of graphical elements makes it easier to interact with the system, as well as adding more attraction through images, icons, and colors.

15) How do you open a command prompt when issuing a command?


To open the default shell (which is where the command prompt can be found), press Ctrl-Alt-F1. This will provide a command line interface (CLI) from which you can run commands as needed.

16) How can you find out how much memory Linux is using?


From a command shell, use the "concatenate" command: cat /proc/meminfo for memory usage information. You should see a line starting something like Mem: 64655360, etc. This is the total memory Linux thinks it has available to use.

You can also use commands

free - m

vmstat

top

htop
to find current memory usage

17) 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.


18) What are symbolic links?


Symbolic links act similarly to shortcuts in Windows. Such links point to programs, files or directories. It also allows you instant access to it without having to go directly to the entire pathname.

19) Does the Ctrl+Alt+Del key combination work on Linux?


Yes, it does. Just like Windows, you can use this key combination to perform a system restart. One difference is that you won't be getting any confirmation message and therefore, a reboot is immediate.

20) 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.

21) Are drives such as hard drive and floppy drives represented with drive letters
No. In Linux, each drive and device have different designations. 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, and so forth.

22) How do you change permissions under Linux?


Assuming you are the system administrator or the owner of a file or directory, 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.

23) In Linux, what names are assigned to the different serial ports?


Serial ports are identified as /dev/ttyS0 to /dev/ttyS7. These are the equivalent names of COM1 to COM8 in Windows.

24) 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.

25) What are hard links?


Hard links point directly to the physical file on disk, and not on the pathname. 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.

26) 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.

27)What are filenames that are preceded by a dot?



In general, 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.

28) Explain virtual desktop.


This serves as an alternative to minimizing and maximizing different windows on the current desktop. Using virtual desktops can clear the desktop when 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.

29) 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.

30) 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.

31) What is the pwd command?


The pwd command is short for print working directory command.

Example:

pwd
Output:

/home/guru99/myDir

32) 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.

33) How do you switch from one desktop environment to another, such as switching from KDE to Gnome?


Assuming you have these two environments installed, just log out from the graphical interface. Then at the login screen, type your login ID and password and choose which session type you wish to load. This choice will remain your default until you change it to something else.

34) 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

35) How does case sensitivity affect the way you use commands?


When we talk about case sensitivity, commands are considered identical only if every character is encoded as is, including lowercase and uppercase letters. This means that CD, cd, and Cd are three different commands. Entering a command using uppercase letters, where it should be in lowercase, will produce different outputs.

36) What are environmental variables?
Environmental variables are global settings that control the shell's function as well as that of other Linux programs. Another common term for environmental variables is global shell variables.

37) 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

38) 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.

39) 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.

40) What is grep command?


grep a search command that makes use of pattern-based searching. It makes use of options and parameters that are specified along with the command line and applies this pattern in searching the required file output.

41) What could be the problem when a command that was issued gave a different result from the last time it was used?
One highly possible reason for getting different results from what seems to be the same command has something to do with case sensitivity issues. Since Linux is case sensitive, a command that was previously used might have been entered in a different format from the present one. For example, to lists all files in the directory, you should type the command ls, and not LS. Typing LS will either result in an error message if there is no program by that exact name exist or may produce a different output if there is a program named LS that performs another function.

42) What are the contents of /usr/local?


It contains locally installed files. This directory 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.

43) 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 to terminate that process. To terminate all process at once, use kill 0.

44) How do you insert comments in the command line prompt?


Comments are created by typing the # symbol before the actual comment text. This tells the shell to completely ignore what follows. For example "# This is just a comment that the shell will ignore."

45) 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 OUTPUT to a second file named MYDATES, you can apply command grouping as follows: (date cat OUTPUT) > MYDATES

46) 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 cd.. ls -a MYWORK
**Note that this will be executed one after the other, in the order specified.

47) Write a command that will look for files with an extension "c", and has the occurrence of the string "apple" in it.


Answer:

 Find ./ -name "*.c" | xargs grep –i "apple"

48) Write a command that will display all .txt files, including its individual permission.


Answer:

ls -al *.txt

49) 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 ORANGE in the files.

Find ./ -name "*.c,v" | sed 's/,v//g' | xargs grep "ORANGE"

50) What, if anything, is wrong with each of the following commands?


a) ls -l-s
b) cat file1, file2
c) ls - s Factdir

Answers:
a) there should be space between the 2 options: ls -l -s
b) do not use commas to separate arguments: cat file1 file2
c) there should be no space between hyphen and option label: ls –s Factdir

51) What is the command to calculate the size of a folder?


To calculate the size of a folder uses the command du –sh folder1.

52) How can you find the status of a process?


Use the command

ps ux

53) How can you check the memory status?


You can use the command

free -m to display output in MB

free -g to display output in GB

54) Explain how to color the Git console?


To color the Git console, you can use the command git config—global color.ui auto. In the command, the color.ui variable sets the default value for a variable such as color.diff and color.grep.

55) How can you append one file to another in Linux?


To append one file to another in Linux you can use command cat file2 >> file 1. The operator >> appends the output of the named file or creates the file if it is not created. While another command cat file 1 file 2 > file 3 appends two or more files to one.

56) Explain how you can find a file using Terminal?


To find a file you have to use a command, find . –name "process.txt" . It will look for the current directory for a file called process.txt.

57) Explain how you can create a folder using Terminal?


To create a folder, you have to use command mkdir. It will be something like these: ~$ mkdir Guru99

58) Explain how you can view the text file using Terminal?


To view the text file, go to the specific folder where the text files are located by using the command cd and then type less filename.txt.

59) Explain how to enable curl on Ubuntu LAMP stack?


To enable curl on Ubuntu, first, install libcurl, once done use following command sudo/etc/init .d /apache2 restart or sudo service apache2 restart.

60) Explain how to enable root logging in Ubuntu?


The command which enables root logging is

#sudo sh-c 'echo "greater-show-manual-login=true" >>/etc/lightdm/lightdm.conf'

61) How can you run a Linux program in the background simultaneously when you start your Linux Server?
By using nohup. It will stop the process receiving the NOHUP signal and thus terminating it you log out of the program which was invoked with. & runs the process in the background.

62) Explain how to uninstall the libraries in Linux?


To uninstall the libraries in Linux, you can use command sudo apt-get remove library_name

Linux Basic Interview Questions

1. What is Linux?

Ans. Linux is an operating system, which is based on Linux Kernel.  It is an open-source operating system where it can run on different hardware platforms. It provides a free and low-cost operating system for users. It is a user-friendly environment where they can easily modify and create variations in the source code.

2. Who invented Linux? Explain the history of Linux?

Ans: 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.

3. What is the difference between Linux and Unix?

Ans. Linux vs Unix

Linux Unix
Both paid and free distributions are available. Different paid structures for different levels of Unix.
Linux primarily uses GUI with an optional command-line interface Unix uses the command-line interface
Linux OS is portable and can be executed in different hard drives Unix OS is not portable.
Linux is developed by a worldwide Linux community. Unix is developed by AT&T developers.
Linux is free. And it is download through the internet under GNU licenses. Most Unix Like Operating Systems is not free.
Linux is used at home-based PC's, phones, etc. Unix is used in server systems.
And some other differences.

Linux is a Unix clone. But if you consider Portable Operating System Interface (POSIX) standards then Linux can be considered as UNIX.

Linux Is Just Kernal

All Linux distributions include GUI system, GNU utilities, installation & management tools, GNU c/c++ Compilers, Editors (vi), and various applications like OpenOffice, Firefox.

UNIX operating systems are considered as a complete OS as everything come from a single vendor.

Security And Firewall

Linux comes with open source Netfilter and IPTables based firewall tool to protect your server and desktop from the crackers and hackers. UNIX operating systems comes with its own firewall products.

Backup And Recovery

UNIX and Linux come with their own set of tools for backing up data to tape and other backup media. However, both Linux and UNIX share some common tools such as tar, dump/restore, and cpio, etc.

4. What is the core of the Linux operating system?

Ans: Kernel is the core of the Linux operating system.

5. What is the Linux Kernel?

Ans: Kernel is the heart of the operating system. It acts as a bridge between software and hardware. If Software requests the hardware, then 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 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 of the Android phones use Linux kernels.

Yes, the kernel can edit, because it is released under General Public License.

6. What is BASH?

Ans: 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.

7. What is LILO?

Ans: LILO means Linux Loader is a boot loader that is used for the Linux operating system. Most of the Linux Operating systems use LILO, to boot the operating system into main memory to start the operations.

8. What is CLI?

Ans: CLI means Command language Interpreter. It interacts with the computer program, where the user issues command in the form of text lines. It Interacts with the computer terminals also, the interface accepts the text lines and converts them as a command to the operating system.

9. What is the advantage of Open Source?

Ans:  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.

10. What is the disadvantage of Open Source?

Ans: Disadvantages of Open Source Operating System mentioned below

Difficulty of use
Compatibility Issues
Liabilities and warranties
Hidden costs

11. What is Shell?

Ans:  Shell is a computer program which acts as an interface between the user and the kernel. Users can communicate with the kernel by writing programs, commands and scripts on the shell. It accepts human-readable commands and converts them into the kernel understandable language.

12. How many types of Shells are there in Linux?

Ans: They are five Shells in Linux:

C Shell (csh): It is like C syntax and provides spelling checking and job control.
Korn Shell (ksh): Is a high-level programming language shell.
Z Shell (Zsh): It provides some unique nature like it observes login/logout watching, file name generating, startup files, closing comments.
Bourne Again Shell (bash): It is the default to Linux distributions.
Friendly Interactive Shell (Fish): It provides web-based configuration,  auto-suggestions, etc.

13. What are the basic components of Linux?

Ans:  Basic components of Linux

Kernel: It is the core component of the Linux, it acts as an interface between software and hardware.
Shell: It acts as an interface between the user and the Kernel.
GUI:  It stands for Graphic User Interface, which is another way for the user to interact with the system. But it is unlike images, buttons, text boxes for interaction.
System Utilities: These are the software functions that allow users to manage the computer.
Application Programs: Set of functions designed to perform a set of tasks.

14.  How do you open a command prompt when issuing a command?

Ans: Launch your terminal by pressing CTRL+ALT+T or by giving terminal in the menu search bar.

15. What is a swap space?

Ans: Swap Space is used when then physical Ram memory is running out. It will move the Ram inactive pages to the swap space. It can consider in the form of a dedicated swap partition or a swap files.

16. What is the GUI?

Ans: GUI means Graphical User Interface. It is a human-computer interface that uses windows, images, icons and menus which can be manipulated by using a mouse. Most of the modern applications in electronic gadgets communicate with the user through GUI. GUI is a combination of graphical and textual interaction that uses buttons, menus, message boxes, etc.

17. Explain File Permissions types in Linux?

Ans: Each file or directory has 3 permissions

They are

Read-- It refers that only they can read the file.

Write-- It refers that they can write the file or modify the file of a directory.
Execute-- It affects the user’s capability to execute the file or to view the file of a directory.

18. What are the environmental variables?

Ans: 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 the information about the system behaviour.


20. What are the symbolic links?

Ans: 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.

21. What are the hard links?

Ans: 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.

22. What is redirection?

Ans: Redirection can be defined as changing the standard input and output devices. To redirect metacharacters are used, you can redirect the file or program.

23. What are Daemons?

Ans: A Daemons is a background process which accepts the requests for service from other computers, most of the operating systems use daemons in other forms.

24. Describe the root account?

Ans: Root is the user name, that default have access to all files and commands. The root user can do many things, but an ordinary user cannot do like installing software, change file permissions, etc.

25. Explain virtual desktop?

Ans: Virtual Desktop is a user interface when you are facing the problem of how to manage multiple windows on your desktop, virtual desktop serves as an alternative. Virtual desktop stores remote server and allow you to use one or more programs on a clean slate.

26. What are the different modes when using the v editor?

Ans: There are three kinds of modes in vi editors. They are

Command Mode/ Regular Mode
Insertion Mode/Edit Mode.
Ex Mode/ Replacement Mode.

27. What are inode and process id?

Ans: inode is a unique name given to each file and process id is a unique name given to each process.

28. What are the Process states in Linux?

Ans:  Five process states in Linux. They are

New/ Ready: A new process is created and ready to run.
Running: The process is being executed.
Blocked/ Wait: The process is waiting for input from the user.
Terminated/ Completed: The process completed the execution or terminated by the operating system.
Zombie: The process is deleted, but still the information regarding the process exists in the process table.
Linux Process states

29. Explain Process Management System Calls in Linux?

Ans:  The process management system calls in Linux:

fork(): Used to create a new process.
exec(): Execute new process.
wait(): wait until process execution.
exit(): exit from the process.
System calls to get the Process id :

getpid(): to find the unique process id.
getppid(): to find the unique parent process id.

30. Explain File Permission groups in Linux?

Ans: There are three user based permission groups for each file and directory.

They are:

Owner: Owners only will have to access the file or directory, they will not impact the actions of other users.
Group: These permissions apply only to the group, that has been assigned to the file or directory. They will not impact the actions of other users.
All Users: These permissions are applied to all users on the system.

31. What Is a File system in Linux?

Subscribe to our youtube channel to get new updates..!

Ans: Linux file system stores and handles the data. Without a file system, it cannot know where the file starts from and where the file ends.

32. Explain different file system types in Linux?

Ans: In Linux, there are many file systems:

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

Linux Tutorial for Beginners

Linux Admin Interview Questions

32. Why LVM is required?

Ans: LVM stands for Large Volume Management, it is a storage management device. User can create, resize and delete LVM partitions. It increases the abstraction, flexibility and control. LVM is used to gather existing storage devices into the group and allocate logical units.

33. What is umask?

Ans: unmask stands for user file creation mode. When the user creates any file, it has default file permissions. So unmask will specify few restrictions to the newly created file (it controls the file permissions).

umask [-S] [mask]

34.  How to set the mask permanently for a user?

Ans: If the unmask command invoked without any arguments, it means it will display the current mask.

To set the unmask permanently, we have two types.

They are:

Ocotal representation.
Symbolic representation.

35. What is network bonding in Linux?

Ans:  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.

36. What are the different modes of Network bonding in Linux?

Ans:
Mode-0(balance-rr): It is a default mode and based on Round-Robin policy. It offers fault tolerance and load balancing features. It used round-robin fashion to transmit the packets.

Mode-1(active-backup): It is based on Active Backup policy and only one slave will act in the band and another one will act when the others fail in the band. It also provides fault tolerance.

Mode-2(balance-xor): It sets a xor mode between the source Mac address and destination Mac address to provide fault tolerance.

Mode-3(broadcast): It is based on broadcast policy and transmitted everything in the slave interface. It also provides fault tolerance and it can be used only for a particular purpose.

Mode-4(802.3ad): It is a dynamic aggregation mode, it created aggregation groups which is having the same speed. It uses transmit hashing method to select the slaves for outgoing traffic.

Mode-5(balance-tlb): The outgoing traffic is according to the current load on the slave, and the incoming traffic is received by the slave. It is called an adaptive transmit load balancing mode.

Mode-6(balance-alb): It is an adaptive load balancing mode. It does not require any switch support.

37. How to check the default route and routing table?

Ans:  To display the default route and routing table, we use the following commands.


$ route-n


$ nestat-rn


$ ip

38. How to check which ports are listening in my Linux Server?

Ans: We have two commands to check which ports are in listening in Linux Server. Following are the two commands

# netstat --listen

# netstat -l

39. Where the kernel modules are located?

Ans: lib/modules/kernel-version/, this directory stores all the information about the compiled drives under the Linux system. Using lsmod command also we can see the installed kernel modules.

40. How to change the default run level in Linux?

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

41. How to share a directory using nfs?

Ans:  To share a directory using NFS, first edit the configuration file and ‘/etc/exports’ and add an entry like directory name ‘/’. Now restart the NFS service.

42. What are the default ports used for SMTP, DNS, FTP, DHCP, SSH, and squid?

Ans. Details mentioned below

Service Port

SMTP 25

DNS 53

FTP 20(Data Transfer) 21(Connections Established)

DHCP 68(dhcp client), 67(DHCP server)

SSH 22

Squid 3128

43.How to lock user account in Linux?

Ans: Locking user account is done for the security purpose so that unauthorized users cannot login. So, we have a few ways to lock the user account. Some of them are below.

Lock or disable the password using passwd command.
Expire the user account using usermod command or chage command.
Changing the shell using nologin command ( /sbin/nologin ).
Linux Commands Interview Questions

44. What is ls command and what it does?

Ans: It is one of the basic commands in Linux. It is used to list all the files and directories in the file system.zom

Syntax:


We can use it without passing the arguments, then it will list all the files in the current working directory. Files will be displayed in alphabetical order.

To list the specific directory files use directory name in the syntax, follow as shown in the below syntax.

ls /etc

We can also pass multiple directories names in the syntax, but separated by space.

ls /etc /var /etc/passwd


 45. What is tail command in Linux?

Ans: The Tail command print last N number of lines of the given data, it prints 10 lines by default.

Syntax:

tail [OPTION]... [FILE]


Example:

$ cat names.txt
$ tail state.txt

46. What is grep command in Linux?

Ans: grep command is a filter which is used to the global search for regular expressions.

Syntax:

grep [options] pattern [files]


47. What is ps command in Linux?

Linux Certification Training!
Explore Curriculum
Ans: ps command display the current process status of the system. And it displays the process id’s with some other related data also.

Syntax:

Ps [options]

Output:

[root@rhe17~]# ps


PID TTY    TIME CMD
12330 pts/0  00:00:00 bash
21621 pts/0  00:00:00 ps


48. What is env command in Linux?

Ans: env is a shell command is used to print a list of current environmental variables and it can run another process in another environment without any modification of the current environment.


env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]

Options

Tag Description

-i, --ignore-environment Start with an empty environment.

-0, --null output line End with a 0 (null) byte rather than a newline.

-u, --unset=NAME removes variable NAME from the environment
--help Display a help message and exit.
49. What is top Command in Linux?

Ans: top command used to show the system process and it displays and update the sorted process information.

50. What is netstat command in Linux?

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

51.  What is lsof command in Linux?

Ans: lsof means List of file, we can know which file is opened by which process.

#lsof

52. Explain about chmod command?

Ans: This command is used to change the permission of files and directories. It’s an important command so, I'll explain it briefly. Therefore, on the whole, there are three ty0pe of permission, read, write and execute and are represented by numbers as shown below.

4 - read permission
2 - write permission
1- execute permission



$ chmod options permissions file name
$ chmod [OPTION]... MODE[,MODE]... FILE...
$ chmod [OPTION]... OCTAL-MODE FILE...
$ chmod [OPTION]... --reference=RFILE FILE…

53. Explain about chown command?

Ans: Chown command: The command “chown” stands for change file owner and Group. This command is used to change the ownership of one or more files or folders for a specified user or group.

syntax:

$ chown [OPTION]… [OWNER][:[GROUP]] FILE…

$ chown [OPTION]… –reference=RFILE FILE…


54. What is cp command in Linux?

Ans: cp command: cp command is used to copy files and directories. It is also used to backup files or directories.

Syntax:

$ cp file name


55. How to remove file or directory from the system in Linux?

Ans:  rm command: The rm command is used to remove directory or file specified on the command line. You need to be careful while removing any file or directory.

Syntax:

rm filename---


Command Description

rm filename Removes single file.
rm filename1, filename2, filename 3 Removes multiple files.
 rm * .pdf Removes all pdf files in the current directory.
 rm -i filename(s) -i means to confirm before deleting the file
 rm -i filename(s) Removes files without prompting
rm -fv *.txt Remove all .txt files in the current directory without prompting

56. What is mkdir in Linux?

Ans: mkdir, command allow users to create directories in the Linux. User can create multiple directories at once and can set the permissions to the directories.

Syntax:

mkdir [options...] [directories ...]


Option Description

Directory name of the directory to be created
-m=mode, --mode=mode to set a file mode (permissions, etc.) for the created directories
-p, --parents create parent directories
--v, --verbose Verbose output. Print a message for created directory.
--Z= context, --context=context If you are using SELinux, this option sets the security context of each created directory to context.
--help shows help message and exit
--version It shows version information and exit

57. Explain rmdir command in Linux?

Ans: The rmdir is used to remove each directory specified on the command line.

Syntax:

rmdir [-p] [-v | –verbose] [–ignore-fail-on-non-empty] directories

58. How to exit from vi editors?

Ans: We can use two commands to exit from the vi editor. They are


Wq: wq command saves the current work and exits from the vi editor.

q!: q! Command does not save the current work, but it exits from the vi editor.

59.  How to delete information from a file in vi?

Ans: Following commands are used to delete information from a file in vi editors.

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

60. Enlist some Linux file content commands?

Ans: File content commands


head: Display top lines of the file.
tail: Display last lines of the file.
cat: Concatenate more than 2 files.
more: Displays the content in pager form to view in the terminal.

Linux Technical Interview Questions and Answers for Experienced

61. Enlist some Linux distributors (Distros) along with its usage?

Ans: We have so many Linux Distributors, among them, we discuss a few important ones.

Linux Mint: It is stable and robust. Linux Mint uses mate desktop and cinnamon.
Debian: It stands for robustness, stability, and well-oiled release cycle. It is user-friendly. Debian version 8 will be replaced by version 9.
Ubuntu: It is available for both desktop and server editions and is based on Debian.
openSUSE: It is a good choice for new users and existing users.
Manjaro: It gives a pleasant experience for new and experienced users.

62. Why we use LINUX?

Ans: We are some many reasons, in that few important reasons are listed out. Following are

High Stability: It is very stable and does not lead to crashes, it runs fastly as it is when it installed first.

Security: It is a dependable server, that offers high security to the user. Using Linux on your system it is easy to avoid virus and malware. The attacker cannot change any changes in the system until the user logged in at as root user.

Easy to Operate: Linux is easy to operate and we can install easily on to the system because all the variants of the Linux have there owned software repositories. You can update the system periodically with just a few clicks or you can set automatic updation.

Hardware Compatibility: Linux can use on any hardware, it doesn’t have any hardware restrictions. It uses efficiently all system resources.

Open Source: The source code is available as it is under Free and Open Source Software(FOSS).



63. What are the features of the Linux operating system?

Ans: Following are the features of the Linux Operating System

Portable:

Software can work on different types of hardware in the same way. It can carry easily in pen drives and memory cards.

Open Source:

Source code available for free, and its community-based development project.

Multi-User:

 Multiple users can use ram, applications and run programs at the same time.

Multiprogramming:

 Multiple program or applications can run at the same time.

Shell: 

It has a special interpreter program where you can execute programs and commands of the system.
Security: It provides authentication, authorization, and encryption to provide security to the data.

64.  Differentiate between BASH and DOS?

Ans:

Bash Dos

Commands are case sensitive commands are not case sensitive
Backward slash(/) represents directories separator ‘/’ represents command arguments
Forward slash ‘’ represents escape character ‘’ represents directories separator
Does not follow conventions naming in files   Follow naming convention in files

65. What is meant by internal commands and external commands?

Ans:

Internal Commands: Commands directly run by the shell is known as internal commands and there is no separate process to run the commands.

External Commands: Commands which are run by the kernel is known as external commands and for every single command has its own unique process id.

Linux Networking Interview Questions

66. What is meant by PIPE in Linux?

Ans: It is a form of redirection that is used in Linux, it is used to combine more than two commands and the output of one command can take as input to the next command.

Syntax:

command_1 | command_2 | command_3 | .... | command_N

67. Describe how a parent and child process communicates each other?

Ans: Parent process communicates with the child process by using pipes, sockets, messages queues and more.

68. What is Stateless Linux Server?

Ans: It is a centralized server which does not have any exists states on the working station. It may have scenarios when a state of a particular system takes snapshot then, the user wants all other machines to be in that particular state.

69. Explain features of Stateless Linux Server?

Ans:

Stores the prototype of every system.
Stores the snapshot was taken.
Stores the home directories.
Uses LDAP, which contains the information about which snapshot should run on which system.

70. What is Zombie Process?

Ans:  It is a process whose execution is completed but even the information exists in the process table. It occurs for the child process because the parent process needs to read the child process status. Once it is completed using the wait system call, then the zombie process is removed from the process table. This is known as Zombie Process.

71. Explain the work of Ctrl+Alt+Del key combination on the Linux operating system?

Ans: In Linux, Ctrl+Alt+Del key is used to restart the computer, and it does not display any confirmation message before rebooting the system.


72. Why is Linux considered more secure than other operating systems?

Ans:  Linux is an open-source operating system, nowadays it is rapidly growing in the technology market. We have a few reasons why Linux is more secure than other OS.


The perk of accounts:

 Linux allows only a few users to access the system. Thus, the virus cannot attack the whole system, it may cause only a few files in the system.

Strong Community:

 Linux users first accomplished the files before they open. So they can save their systems from vulnerabilities.

Iptables: Iptables used by the Linux because it checks the security circle of the system.

Different Working Environment: Linux system has different working environments like Linux Mint, Debian, Arch and many more, these working environments protect from the virus.

Recording in Linux: It maintains log history because later it can view the details of the system files easily.

Few User: Linux users are less compared to others, due to this security will be more.

73. What is tail command in Linux?

Ans: The tail command displays the last part of a file. Generally, users don't need every logline to troubleshoot. Instead, you want to check what your logs say about the most recent request to your application.

tail Example:

$ tail -n 100 /var/log/httpd/access_log

74. What is cat command in Linux?

Ans: In Linux cat command concatenates and prints files. Users might issue cat to check the contents of your dependencies file or to confirm the version of the application that you have already built locally.

cat Example:


$ cat requirements.txt
flask
flask_pymongo



75. What is grep command in Linux?

Ans: grep searches file patterns. If you are looking for a specific pattern in the output of another command, grep highlights the relevant lines. Use this grep command for searching log files, specific processes, and more.

grep 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

76. What is ps command in Linux?

Ans: ps command displays process status. Use this ps command to determine a running application or confirm an expected process.

ps Command Example:


$ ps -ef


$ ps -ef | grep tomcat

77. What is env command in Linux?

Ans: env command allows users to set or print the environment variables. During troubleshooting, users can find it useful for checking if the wrong environment variable prevents your application from starting.

env Command Example:

$ env

PYTHON_PIP_VERSION=9.0.1
HOME=/root
DB_NAME=test
PATH=/usr/local/bin:/usr/local/sbin
LANG=C.UTF-8
PYTHON_VERSION=3.4.6
PWD=/
DB_URI=mongodb://database:27017/test

78. What is top Command in Linux?

Ans: top command displays and updates sorted process information. Use this top command to determine which processes are running and how much memory and CPU they are consuming.

79. What is netstat command in Linux?

Ans: netstat command in Linux shows the network status. This netstat command shows network ports in use and their incoming connections.

80. What is lsof command in Linux?

Ans: ls of command lists the open files associated with your application.

81. What is df command in Linux?

Ans: Users can use df command to troubleshoot disk space issues. Here df stands for display free disk space.

df Command Example:

df -h

82. What is du command in Linux?

Ans: du command in Linux is used to retrieve more detailed information about which files use the disk space in a directory.

du Command Example:

$ du -sh /var/log/*

1.8M  /var/log/anaconda
384K  /var/log/audit
4.0K  /var/log/boot.log
0 /var/log/chrony
4.0K  /var/log/cron
4.0K  /var/log/maillog
64K /var/log/messages

83. What is iptables command in Linux?

Ans: iptables command blocks or allows traffic on a Linux host, similar to a network firewall. This iptables command may prevent certain applications from receiving or transmitting requests.

Linux Vs Windows
LINUX WINDOWS
Linux is available for free Windows has to be bought
It is an open-source OS It is not open-source OS
One can customize Linux No customizations available
Provides high-level security Cannot defend virus and malware attacks
Primary partitioning and logical partitioning available to boot Booting available while primary partitioning only
BackSlash separates directories Forward slash separates directories
File names are case particular Irrespective of case while naming files

84. What does cd - command do?

Ans: cd- command go to the previous directory.

85. What does cd command do?

Ans: Go to $HOME directory

86. What does (cd dir && command) do?

Ans: cd dir && command goes to the dir, execute the command and return to the current directory.

88. What does pushd command do?

Ans: pushd command put current dir on the stack so you can pop back to it.

89. What is ls -lSr command?

Ans: ls - ISr command shows files by size, biggest file will be displayed last.

90. What is du -s * | sort -k1,1rn | head command used for?

Ans: This command shows top disk users in current dir.

91. What does this du -hs /home/* | sort -k1,1h command do?

Ans: This command sort path by easy to interpret disk usage.

92. What is df -h command?

Ans: This command show free space on mounted file systems.

93. What is df -i command?

Ans: df -I command shows free inodes on mounted filesystems.

94. What is fdisk -l command used for?

Ans: fdisk -I command show disks partitions sizes and types (run as root).



95. How do you kill the program using one port in Linux?

Ans: Use this command to kills the program using one port: sudo fuser -k 8000/tcp

96. How do you limit memory usage for commands?

Ans: ulimit -Sv 1000       # 1000 KBs = 1 MB
    ulimit -Sv unlimited  # Remove limit

97. How do you get full path of a file in Linux?

 Use this command: readlink -f file.txt

98. How do you list contents of tar.gz and extract only one file?

Ans: Use these commands:

tar tf file.tgz
tar xf file.tgz filename

99. How do you find who is logged in?

Ans: Use this command to find who logged in: w

100. How do you check permissions of each directory to a file?

Ans: It is useful to detect permissions errors, for example when configuring a web server.

namei -l /path/to/file.txt


102. How to copy text to the clipboard?

Ans: Use this command: cat file.txt | xclip -selection clipboard

103. How do you check resources usage?

Ans: Use this command to check resource usage: /usr/bin/time -v ls

104. How do you run a command for a limited time?

Ans: Use this command: timeout 10s ./script.sh


# Restart every 30 minutes

while true; do timeout 30m ./script.sh; done


105. How do you combine two lines from two sorted files in Linux?

Ans: Use this command: comm file1 file2.

1) What is Linux?

Linux is a UNIX based operating system. Linus Torvalds first introduced it. It is an open source operating system that was designed to provide free and a low-cost operating system for the computer users.

2) What is the difference between UNIX and Linux?

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.

3) What is Linux Kernel?

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.

4) Is it legal to edit Linux Kernel?

Yes. You can edit Linux Kernel because it is released under General Public License (GPL) and anyone can edit it. It comes under the category of free and open source software.

5) What is LILO?

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



6) What is the advantage of open source?

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.

7) What are the basic components of Linux?

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

8) What is the advantage of Linux?

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

9) Define shell

It is an interpreter in Linux.

10) Name some shells that are commonly used in Linux.

The most commonly used shells in Linux are bash, csh, ksh, bsh.

11) Name the Linux which is specially designed by the Sun Microsystems.

Solaris is the Linux of Sun Microsystems.

12) Name the Linux loader.

LILO is the Linux loader.

13) If you have saved a file in Linux. Later you wish to rename that file, what command is designed for it?

The 'mv' command is used to rename a file.

14) Write about an internal command.

The commands which are built in the shells are called as the internal commands.

15) Define inode.

Each file is given a unique name by the operating system which is called as the inode.

16) If the programmer wishes to execute an instruction at the specified time. Which command is used?

The 'at' command is used for the same.

17) Explain process id.

The operating system uniquely identifies each process by a unique id called as the process id.

18) Name some Linux variants.

Some of the Linux commands are:

CentOS
Ubuntu
Redhat
Debian
Fedora

19) What is Swap Space?

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.

20) What is BASH?

BASH is a short form of Bourne Again SHell. It was a replacement to the original Bourne shell, written by Steve Bourne.

21) What is the basic difference between BASH and DOS?

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.

22) What is a root account?

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.

23) What is CLI?

CLI stands for Command Line Interface. It is an interface that allows users to type declarative commands to instruct the computer to perform operations.

24) What is the GUI?

GUI 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 of the use of the images and icons.

25) Which popular office suite is available free for both Microsoft and Linux?

Open Office Suite is available free for both Microsoft and Linux. You can install it on both of them.

26) Suppose your company is recently switched from Microsoft to Linux and you have some MS Word document to save and work in Linux, what will you do?

Install Open Office Suite on Linux. It facilitates you to work with Microsoft documents.

27) What is SMTP?

SMTP stands for Simple Mail Transfer Protocol. It is an internet standard for mail transmission.

28) What is Samba? Why is it used?

Samba service is used to connect Linux machines to Microsoft network resources by providing Microsoft SMB support.

29) What are the basic commands for user management?

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

30) What is the maximum length for a filename in Linux?

255 characters.

31) Is Linux Operating system virus free?

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

32) Which partition stores the system configuration files in Linux system?

/stc partition.

33) Which command is used to uncompress gzip files?

gunzip command is used to uncompress gzip files.

34) Why do developers use MD5 options on passwords?

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

35) What is a virtual desktop?

The virtual desktop is used as an alternative to minimizing and maximizing different windows on the current desktop. Virtual desktop facilitates you to open one or more programs on a clean slate rather than minimizing or restoring all the needed programs.

36) What is the difference between soft and hard mounting points?

In the soft mount, if the client fails to connect the server, it gives an error report and closes the connection whereas in the hard mount, if the client fails to access the server, the connection hangs; and once the system is up, it again accesses the server.

37) Does the Alt+Ctrl+Del key combination work in Linux?

Yes, it works like windows.

38) What are the file permissions in Linux?

There are 3 types of permissions in Linux OS that are given below:

Read: User can read the file and list the directory.
Write: User can write new files in the directory .
Execute: User can access and run the file in a directory.

39) What are the modes used in VI editor?

There are 3 types of modes in vi Editor:

Regular mode or command mode
Insertion mode or edit mode
Replacement mode or Ex-mode

40) How to exit from vi editors?

The following commands are used to exit from vi editors.

:wq saves the current work and exits the VI.
:q! exits the VI without saving current work.

41) How to delete information from a file in vi?

The following commands are used to delete information from vi editors.

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

42) How to create a new file or modify an existing file in vi?

vi filename

Q #1) What do you understand by Linux Kernal? Is it legal to edit it?


Ans: ‘Kernal’ basically refers to that core component of the computer operating system that provides basic services for the other parts as well as interacts with user commands. When it comes to ‘Linux Kernal’, it is referred to as low-level system software providing an interface for user-level interactions.

Linux Kernal is considered as free and open source software which is capable of managing hardware resources for the users. As it is released under General Public Licence (GPL), it becomes legal for anyone to edit it.

Q #2) Differentiate between LINUX and UNIX?


Ans:  Although there are multiple differences between LINUX and UNIX, enlisted below table covers all the major differences.

LINUX UNIX

LINUX is an open source software development and free operating system used for computer hardware & software, game development, PCs, etc. UNIX is an operating system which is basically used in Intel, HP, internet servers, etc.
LINUX has priced as well as freely distributed and downloaded versions. Different versions/flavours of UNIX have different price structures.

Users of this operating system could be anyone including home users, developers, etc. This operating system was basically developed for mainframes, servers and workstations except for OSX which is designed such that it can be used by anyone.

File support system includes Ext2, Ext3, Ext4, Jfs, Xfs, Btrfs, FAT, etc. File support system includes jfs, gpfs, hfs, etc.

BASH (Bourne Again Shell) is the Linux default shell i.e. text mode interface which supports multiple command interpreters. Bourne shell serves as the text mode interface which is now compatible with many others including BASH.

LINUX provides two GUIs, KDE and Gnome. Common desktop environment was created which serves as a GUI for UNIX.

Examples: Red Hat, Fedora, Ubuntu, Debian, etc. Examples: Solaris, All Linux

It provides higher security and has about 60-100 viruses listed till date. It is also highly secured and has about 85-120 viruses listed till date.

Q #3) Enlist the basic components of LINUX?


Ans: Linux operating system basically consists of 3 components which are enlisted below

Kernel: 

This is considered as the core part and is responsible for all major activities of the Linux operating system. Linux Kernel is considered as free and open-source software which is capable of managing hardware resources for the users. It consists of various modules and interacts directly with the underlying hardware.

System Library: 

Most of the functionalities of the operating system are implemented by System Libraries. These act as a special function using which application programs accesses Kernel’s features.

System Utility: 

These programs are responsible for performing specialized, individual-level tasks.

Q #4) Why we use LINUX?


Ans: LINUX is used widely because it is completely different from other operating systems where every aspect comes with something extra i.e. some additional features. Some of the major reasons to use LINUX are listed below

It is an open-source operating system where programmers get the advantage of designing their own custom OS
Software and the server licensing required to install Linux is completely free and can be installed on many computers as required
It has low or minimum but controllable issues with viruses, malware, etc
It is highly secured and supports multiple file systems

Q #5) Enlist the features of the Linux operating system?


Ans: Following are some important features of the LINUX operating system

Linux kernel and application programs can be installed on any kind of hardware platform and thus is considered as portable.
It serves the purpose of multitasking by serving various functions simultaneously.
It provides security services in three ways namely, Authentication, Authorization, and Encryption.
It supports multiple users to access the same system resource but by using different terminals for operation.
Linux provides a hierarchical file system and its code is freely available to all.
It has its own application support (to download and install applications) and customized keyboards.
Linux distros provide live CD/USB to their users for installation.

Q #6) Explain LILO?


Ans: LILO (Linux Loader) is the boot loader for the 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.

Q #7) What is Swap space?


Ans: 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.

Q #8) What do you understand by the Root account?


Ans: As the name suggests, it is like a system administrator account which gives you the ability to fully control the system. The root account serves as the default account whenever Linux is installed. Below mentioned functions can be performed by the Root account

Below mentioned functions can be performed by the Root account

Create user accounts
Maintain user accounts
Assign different permissions to each account created and so on.

Q #9) Explain the virtual desktop?


Ans: 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
Fewer compatibility issues.

Q #10) Differentiate between BASH and DOS?


Ans: The basic differences between BASH and DOS can be understood from the below table

Show  entriesSearch:
BASH DOS
BASH commands are case sensitive. DOS commands are not case sensitive.
‘/’ character used as a directory separator.
‘\’ character acts as an escape character. ‘/’ character: serves as a command argument delimiter.
‘\’ character: serves as a directory separator.
File naming convention includes: 8 character file name followed by a dot and 3 characters for the extension. No file naming convention is followed in DOS.
Showing 1 to 3 of 3 entriesPreviousNext

Q #11) Explain the term GUI?


Ans: GUI stands for the Graphical user interface. GUI is considered as the most attractive and user-friendly because it consists of the usage of images and icons. These images and icons are clicked and being manipulated by the users for the purpose of communication with the system.

Advantages of GUI:


It allows users to navigate and operate the software with the help of visual elements.
The more intuitive and rich interface is possible to be created.
Fewer chances of occurrence of errors as complex, multi-step, dependent tasks are easily grouped together.
Productivity is enhanced with the means of multitasking as with a simple click of the mouse, the user is able to maintain multiple open applications and transitions between them.

Disadvantages of GUI:


End-users have less control over the operating system and file systems.
Although it is easier to use a mouse and keyboard for navigation and controlling the operating system, the whole process is a bit slow.
It requires more resources because of the elements that need to be loaded such as icons, fonts, etc.

Q #12) Explain the term CLI?


Ans: CLI stands for Command Line Interface. It is a way for humans to interact with computers and is also known as the Command-line user interface. It relies on textual request and response transaction process where user types declarative commands to instruct the computer to perform operations.

Advantages of CLI


Very flexible
Can easily access commands
Much faster and easier to use by expert
It does not use much CPU processing time.
Disadvantages of CLI

Learning and remembering type commands is hard.
Have to be typed precisely.
Can be very confusing.
Surfing web, graphics, etc are a few tasks that are hard or impossible to do on the command line.

Q #13) Enlist some Linux distributors (Distros) along with its usage?


Ans: Different parts of LINUX say kernel, system environment, graphical programs, etc are developed by different organizations. LINUX Distributions (Distros) assemble all these different parts of Linux and give us a compiled operating system to be installed and used.

There are around six hundred Linux distributors. Let us see some of the important ones

UBuntu: It is a well known Linux Distribution with a lot of pre-installed apps and easy to use repositories libraries. It is very easy to use and works like a MAC operating system.
Linux Mint: It uses cinnamon and mates desktop. It works on Windows and should be used by newcomers.
Debian: It is the most stable, quicker and user-friendly Linux Distributors.
Fedora: It is less stable but provides the latest version of the software. It has a GNOME3 desktop environment by default.
Red Hat Enterprise: It is to be used commercially and to be well tested before release. It usually provides a stable platform for a long time.
Arch Linux: Every package is to be installed by you and is not suitable for beginners.

Q #14) How can you determine the total memory used by LINUX?


Ans: It is always required to keep a check on the memory usage in order to find out whether the user is able to access the server or the resources are adequate. There are roughly 5 methods that determine the total memory used by Linux.

This is explained as below

Free command: 

This is the most simple and easy to use command to check memory usage. For example: ‘$ free –m’, the option ‘m' displays all the data in MBs.

/proc/meminfo: 

The next way to determine memory usage is to read /proc/meminfo file. For example: ‘$ cat /proc/meminfo’

Vmstat:

 This command basically lays out the memory usage statistics. For example: ‘$ vmstat –s’
Top command: This command determines the total memory usage as well as also monitors the RAM usage.

Htop: 

This command also displays memory usage along with other details.

Q #15) Explain the 3 kinds of file permissions under LINUX?


Ans: Every file and directory in Linux are assigned three types of owners namely ‘User’, ‘Group’, and ‘Others’. Find the three kinds of permissions defined for all the three owners

Read: This permission allows you to open and read the file as well as list the contents of the directory.
Write: This permission allows you to modify the contents of the file as well as allows adding, removing and renaming files stored in the directories.
Execute: User can access and run the file in the directory. You cannot run a file unless the execute permission is set.

Q #16) What is the maximum length for any file name under LINUX?


Ans: The maximum length for any filename under Linux is 255 characters.

Q #17) How permissions are granted under LINUX?


Ans: A system administrator or the owner of the file can grant permissions using the ‘chmod’ command. Following symbols are used while writing permissions


‘+’ for adding permission
‘-‘ for denying permission
Permissions also includes a single letter which denotes

u : user; g: group; o: other; a: all; r: read; w: write; x: execute.

Q #18) What are the different modes when using the vi editor?


Ans: The 3 different kinds of modes in vi editor are enlisted below

Command Mode/ Regular Mode
Insertion Mode/ Edit Mode
Ex Mode/ Replacement Mode

Q #19) Explain the Linux Directory commands along with the description?


Ans: Enlisted below are the directory commands along with descriptions

pwd: It is a built-in command which stands for ‘print working directory’. It displays the current working location, working path starting with / and directory of the user. Basically, it displays the full path to the directory you are currently in.
Is: This command list out all the files in the directed folder.
cd: This stands for ‘change directory’. This command is used to change to the directory you want to work from the present directory. We just need to type cd followed by the directory name to access that particular directory.
mkdir: This command is used to create an entirely new directory.
rmdir: This command is used to remove a directory from the system.

Q #20) Differentiate between Cron and Anacron?


Ans: Difference between Cron and Anacron can be understood from the below table

Cron Anacron

Cron allows the user to schedule tasks to be executed every minute. Anacron allows the user to schedule tasks to be run either on a specific date or the first available cycle after the date.
Tasks can be scheduled by any normal user and are basically used when tasks have to be completed/executed at a particular hour or minute. Anacron can be used only by super users and is used when a task has to be executed irrespective of hour or minute.
It is ideal for servers It is ideal for desktops and laptops
Cron expects the system to be running 24x7. Anacron does not expects the system to be running 24x7.

Q #21) Explain the work of Ctrl+Alt+Del key combination on Linux operating system?


Ans: 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.

Q #22) What is the role of case sensitivity in affecting the way commands are used?


Ans: 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 the 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.

Q #23) Explain Linux Shell?


Ans: For executing any commands user uses a program known as the shell. Linux shell is basically a user interface used for executing the commands and communicating with Linux operating system. Shell does not use the kernel to execute certain programs, create files, etc. There are several shells available with Linux which includes the following

BASH (Bourne Again SHell)
CSH ( C Shell)
KSH ( Korn Shell)
TCSH
There are basically two types of Shell commands

Built-in shell commands: These commands are called from the shell and executed directly within the shell. Examples: ‘pwd’, ’help’, ’type’, ’set’, etc.
External/ Linux commands: These commands are totally shell independent, have their own binary and are located in the file system.

Q #24) What is a Shell script?


Ans: 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.

Q #25) Explain the features of a Stateless Linux server?


Ans: The word stateless itself means ‘no state’. When on a single workstation, no state exists for the centralized server, and then the stateless Linux server comes into the picture. Under such conditions, scenarios like keeping all the systems on the same particular state can occur.

Some of the features of Stateless Linux server are explained below

Stores prototype of every machine
Store snapshots
Store home directories
Uses LDAP which determines the snapshot of state to be run on which system.

Q #26) What are system calls used for process management in Linux?


Ans: Process management in Linux uses certain system calls. These are mentioned in below table with a brief explanation

System calls Explanation
Fork() To create a new process
Exec() For execution of a new program
Wait() To make the process to wait
Exit() Exit/terminate the process
Getpid() To find the unique process id
Getppid() To find the parent process id
Nice() To bias the currently running process property

Q #27) Enlist some Linux to file content commands?


Ans: There are many commands present in Linux which are used to look at the contents of the file.

Some of them are enlisted below

head: Displays the beginning of the file
tail: Displays the last part of the file
cat: Concatenate files and print on the standard output.
more: Displays the content in pager form and is used to view text in the terminal window one page or screen at a time.
less: Displays the content in pager form and allows backward and single line movement.

Q #28) Explain Redirection?


Ans: It is well known that every command takes an input and displays output. Keyboard serves as the standard input device and the screen serves as the standard output device. Redirection is defined as the process of directing data from one output to another or even cases exist where output serves as input data for another process.

There are basically three streams available in which input and output of Linux environment are distributed.

These are explained as below

Input Redirection: ‘<’ symbol is used for input redirection and is numbered as (0). Thus it is denoted as STDIN(0).
Output Redirection: ‘>’ symbol is used for output redirection and is numbered as (1). Thus it is denoted as STDOUT(1).
Error Redirection: It is denoted as STDERR(2).

Q #29) Why is Linux considered as more secured than other operating systems?


Ans: Linux is an open-source operating system and nowadays it is growing rapidly in the tech world/market. Although the entire code written in Linux can be read by anyone, then to it is considered as more secure because of the following reasons

Linux provides its user with limited default privileges which are basically restricted to the lower levels .i.e. in the case of any virus attack, it will reach only local files and folders where the system-wide damage is saved.
It has a powerful auditing system which includes detailed logs.
Enhanced features of IPtables are used in order to implement a greater level of security for Linux machine.
Linux has tougher program permissions before installing anything on your machine.

Q #30) Explain command grouping in Linux?


Ans: Command grouping is basically done by the use of braces ‘()’ and parenthesis ‘{}’. Redirection is applied to the entire group when the command is grouped.

When commands are placed within the braces, then they are executed by the current shell. Eg: (list)
When the commands are placed within the parenthesis, then they are executed by a subshell. Eg: {list;}

Q #31) What is Linux pwd (print working directory) command?


Ans: Linux pwd command displays the whole path of the current location you are working in starting from the root ‘/’. For example, to print the current working directory enter “$ pwd”.

It can be used for the bellow purposes

To find the full path of the current directory
Store the full path
Verify the absolute and physical path

Q #32) Explain the Linux ‘cd’ command options along with the description?


Ans: ‘cd’ stands for change directory and is used to change the current directory on which the user is working.

cd syntax : $ cd {directory}

Following purposes can be served with ‘cd’ commands

Change from current to a new directory
Change directory using the absolute path
Change directory using the relative path
Few of the ‘cd’ options are enlisted below

cd~: Brings you to the home directory
cd-: Brings you to the previous directory
. : Bring you to the parent directory
cd/: Takes you to the entire system’s root directory

Q #33) What is know about grep commands?


Ans: Grep stands for ‘global regular expression print’. This command is used for matching a regular expression against text in a file. This command performs pattern-based searching and only the matching lines are displayed as output. It makes use of options and parameters that are specified along with the command line.

For example: Suppose we need to locate the phrase “our orders” in HTML file named as “order-listing.html”. Then the command will be as follows:

$ grep “our orders” order-listing.html

The grep command outputs the entire matching line to the terminal.

Q #34) How to create a new file and modify an existing file in vi editor? Also, enlist the commands used to delete information from vi editor.?


Ans: Find below the commands with the description

vi filename: This is the command used to create a new file as well as modify an existing file.
View filename: This command opens an existing file in read-only mode.
X: This command deletes the character which is under the cursor or before the cursor location.
dd: This command is used to delete the current line.

Q #35) Enlist some Linux networking and troubleshooting commands?


Ans: Every computer is connected to network internally or externally for the purpose of exchanging information. Network troubleshooting and configuration are essential parts of and network administration. The networking commands enable you to quickly troubleshoot connection issues with another system, check the response of another host, etc.

A network administrator maintains a system network that includes network configuration and troubleshooting. Mentioned below are few commands along with their description:

Mentioned below are few commands along with their description

Hostname: 

To view the hostname (domain and IP address) of the machine and to set the hostname.

Ping: 

To check if the remote server is reachable or not.

ifconfig: 

To display and manipulate route and network interfaces. It displays network configuration. ‘ip’ is the replacement of ifconfig command.

netstat: 

It displays network connections, routing tables, interface statistics. ‘ss’ is the replacement of netstat command which is used to get more information.

Traceroute:

 It is a network troubleshooting utility that is used to find the number of hops required for a particular packet to reach the destination.

Tracepath:

 It is the same as traceroute with a difference that it does not require root privileges.

Dig: 

This command is used to query the DNS name servers for any task related to the DNS lookup.

nslookup: 

To find DNS related query.

Route:

 It shows the details of the route table and manipulates the IP routing table.

mtr: 

This command combines ping and track path into a single command.
Ifplugstatus: This command tells us whether the network cable is plugged in or not.



Q.1: What is the core of Linux Operating System?

Shell
Kernel
Command
Script
Terminal
Answer : Kernel is the core of Linux Operating System. Shell is a command Line Interpreter, Command is user Instruction to Computer, Script is collection of commands stored in a file and Terminal is a command Line Interface

Q.2: What Linus Torvalds Created?

Fedora
Slackware
Debian
Gentoo
Linux
Answer : Linus Torvalds created Linux, which is the kernel (heart) of all of the above Operating System and all other Linux Operating System.

Q.3: Torvalds, Wrote most of the Linux Kernel in C++ programming Language, do you agree?

Answer : No! Linux Kernel contains 12,020,528 Lines of codes out of which 2,151,595 Lines are comments. So remaining 9,868,933 lines are codes and out of 9,868,933 Lines of codes 7,896,318 are written in C Programming Language.
The remaining Lines of code 1,972,615 is written in C++, Assembly, Perl, Shell Script, Python, Bash Script, HTML, awk, yacc, lex, sed, etc.

Note : The Number of Lines of codes varies on daily basis and an average of more than 3,509 lines are being added to Kernel.

Q.4: Linux initially was developed for intel X86 architecture but has been ported to other hardware platform than any other Operating System. Do you agree?.

Answer : Yes, I do agree. Linux was written for x86 machine, and has been ported to all kind of platform. Today’s more than 90% of supercomputers are using Linux. Linux made a very promising future in mobile phone, Tablets. In-fact we are surrounded by Linux in remote controls, space science, Research, Web, Desktop Computing. The list is endless.

Q.5: Is it legal to edit Linux Kernel?

Answer : Yes, Kernel is released under General Public Licence (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).

Q.6: What is the basic difference between UNIX and Linux Operating System.

Answer : Linux Operating System is Free and Open Source Software, the kernel of which is created by Linus Torvalds and community. Well you can not say UNIX Operating System doesn’t comes under the category of Free and Open Source Software, BSD, is a variant of UNIX which comes under the category of FOSS. Moreover Big companies like Apple, IBM, Oracle, HP, etc. are contributing to UNIX Kernel.

Q. 7: Choose the odd one out.

HP-UX
AIX
OSX
Slackware
Solaris
Answer : Slackware is the odd in the above list. HP-UX, AIX, OSX, Solaris are developed by HP, IBM, APPLE, Oracle respectively and all are UNIX variant. Slackware is a Linux Operating System.

Q.8: Is Linux Operating system Virus free?

Answer : No! There doesn’t exist any Operating System on this earth that is virus free. However Linux is known to have least number of Viruses, till date, yes even less than UNIX OS. Linux has had about 60-100 viruses listed till date. None of them actively spreading nowadays. A rough estimate of UNIX viruses is between 85 -120 viruses reported till date.

Q.9: Linux is which kind of Operating System?

Multi User
Multi Tasking
Multi Process
All of the above
None of the above
Answer : All of the Above. Linux is an Operating System which supports Multi User, Running a Number of Processes performing different tasks simultaneously.

Q.10: Syntax of any Linux command is:

command [options] [arguments]
command options [arguments]
command [options] [arguments]
command options arguments
Answer : The correct Syntax of Linux Command is Command [options] [arguments].

Q.11: Choose the odd one out.

Vi
vim
cd
nano

Answer : The odd one in the above list is cd. Vi, vim and nano are editors which is useful in editing files, while cd command is used for changing directory.


Linux is not just an operating system. Instead, it is a humongous family of free and open-source software operating systems that are based on the Linux kernel.


System security and Linux administration go hand to hand. So, expect Linux questions coming your way when interviewed for a security-based job profile.


Question: Can you tell us about the basic components of Linux?

Answer: Like any other typical operating system, Linux has an application program, GUIs, kernel, and shells. The main advantage of using Linux as an operating system lies in the fact that it is open source and heavily customizable, which makes it equally ideal to use for seasoned professionals as well as newcomers.


Question: Please draw a comparison between BASH and DOS.

Answer: DOS stands for Disk Operating System, while BASH is a contraction of Bourne Again Shell. A shell is simply a user interface meant for accessing the services offered by an operating system. It can either use a CLI, a GUI or both.

Following are the notable differences between DOS and BASH:

Case Sensitivity – While DOS commands are not case sensitive, BASH commands are.
Use of / and \ - In BASH, / acts as a directory separator and \ acts as an escape character. The use of / in DOS is to serve as a command argument delimiter and \ serves the role of directory separator.
Naming Convention – DOS follows the naming convention under which a file must have an 8-character filename followed by a dot and 3-character extension. No naming convention is available for BASH.
Question: How will you check out how much memory Linux is using?
Answer: From the command shell, use the concatenate command:

cat /proc/meminfo

This will give an output like this:


Mem: “some number in bytes”

Question: Please explain symbolic links in Linux.

Answer: Symbolic links point to directories, files, and programs in Linux. They allow gaining instant access to the object they are pointing without the need to traverse the entire path. Hence, symbolic links are like shortcuts in Windows.

Question: Can you tell us about the various kinds of permission under Linux? Also, explain how to change permissions.

Answer: There are three types of permissions under Linux:

Read – Users are allowed to read the files or list the directory
Write – Users are allowed to write to the file or add new files to the directory
Execute – Users are allowed to run the file or lookup for a specific file within a directory
A system administrator or the owner of the file or directory can grant permission to others using the chmod command. It is followed by specifying the receiver(s) of the permission followed by whether permission is granted or denied, then type of permission, and finally having the name of the file.

The general syntax is something like this:


chmod permissionreceiver+typeofpermissions file
The permission receiver can be a for all, g for group, o for others, and u for the user. Typeofpermissions can be r for read, w for write, and x for executing. For instance, a command:

chmod go+rwx DemoFile.TXT

will grant read, write, and execute permission to group and others for the file named DemoFile.


Question: Please explain the virtual desktop and how to share a program across different virtual desktops under Linux.

Answer: Simply, a virtual desktop presents an alternative to minimizing and maximizing different windows. Instead of minimizing or restoring different programs, virtual desktops allow shuffling between desktops having different program windows.

Many times there is a need to share a program across different virtual desktops. For doing so, simply go to the upper left corner of the program window and click on the pushpin-like icon. It will pin the application, making it accessible across all the virtual desktops.

Question: What do you understand by daemons?

Answer: Daemons are a way of extending the functionality of the base operating system. In other words, daemons are services that offer several functions that might not be available in the operating system.

The main task of a daemon is to actively listen for a service request and to act upon them at the very same time. Once it completes the service, a daemon gets disconnected and waits for further requests.

Question: Please explain the various modes when using the vi editor.

Answer: The vi editor offers 3 modes:

Command Mode – This is the mode where the user starts
Edit Mode – This mode allows to do the text editing
Ex Mode – This mode allows interacting with vi, allowing executing instructions to process a file

Question: What are the contents of /usr/local?

Answer: The /usr/local directory contains the locally installed files. The importance of the directory is when files are stored on some network. Moreover, the directory is used for storing software packages installed from a source or software not officially accompanying the distribution.

Question: Tell us how you will execute more than one command or program from a single command line entry.

Answer: Linux allows for combining several commands in a single line. Each of the commands is separated by a semicolon (:). The execution is carried in the order the commands are specified, from left to right.

Question: What do you mean by hard links in Linux?

Answer: Hard links in Linux point directly to the physical file present on the disk. It doesn’t concern the pathname. It simply means that in case the file is renamed or moved to some other location, the link will not break and will still function like before.

Question: Please explain case-sensitivity issues in Linux.

Answer: Sometimes entering the same command in Linux results in different outputs. This is typically attributed to case sensitivity. Because Linux is case sensitive, a command that previously produced the desired output might not do the same when executed again.

For example, the ls command is responsible for listing all files in the directory. However, entering LS, lS, or Ls will display an error. Moreover, if there is a program that is named LS, then entering the LS command will execute it rather than listing all files in the directory.


Question: Can you tell what does a nameless directory represents in Linux?

Answer: The empty directory name serves as the nameless base of the Linux file system. It serves as an attachment for all other devices, directories, drives, and files present on the system.

Question: Can you draw the Linux architecture?

Answer:Linux Architecture

Question: Please explain how to enable curl on Ubuntu LAMP stack and root logging in Ubuntu?
Answer: To enable curl on Ubuntu LAMP stack:

Install libcurl

Use the command:sudo/etc/init .d /apache2 restartORsudo service apache2 restart
To enable root logging in Ubuntu, use the command:

#sudo sh-c 'echo "greater-show-manual-login=true" >>/etc/lightdm/lightdm.conf'

Question: How will you append one file to another in Linux?

Answer: The command:

cat file1 > file2

appends two files in Linux. You can append as many files using the command. For example, to append three files, named file1, file2, and file3, we can use the command:

cat file1 > file2 > file3

Another way of appending one file to another in Linux is by using the command:

cat file2>>file1
The >> operator appends the output of the named files.


Question: What command would you use for editing, searching, and replacing text in Linux?

Answer:

Editing:

You can use the cd command followed by the name of the text editor, like vi, with which you need to edit the file.

Searching:


You can search a file in Linux by using the command:

find –iname “filename”

For searching and printing text in a file in Linux, you can use the command grep.


Replacing:


This procedure involves using the Stream Editor (sed). You need to use the command:

sed -i 's/old-text/new-text/g' input.txt

Enter the text that needs to be replaced in place of the old-text and the new text that needs to be added in place of the new-text.

Question: What do you understand by swap space in Linux?

Answer: The swap space comes into play when the RAM doesn’t have enough memory to hold all programs that are currently executing. The swap space is some memory space used by the Linux operating system to temporarily hold programs that are running concurrently.

Question: Please explain how you will run a Linux program in the background together with starting the Linux Server.

Answer: You need to use the nohup command first. It will stop the process receiving the NOHUP signal. The termination will log you out of the program that was invoked. Then start the Linux server, and enter the name of the Linux program followed by the & symbol to run the process in the background.

Question: Can you explain how to remotely login with SSH?

Answer: Although there are many ways of accessing a remote computer, using the SSH (Secure SHell) protocol is widely preferred. The protocol makes use of a public-key cryptography authentication method for securing communication between the hosts.

For using the SSH command, the user needs to define the server by entering its IP address. If 192.168.100.22 is the IP address of the system to which the SSH access is needed then enter the command:


ssh 192.168.100.22


Also, you can specify the explicit username as:


ssh someusername@192.168.100.22


SSH allows for data compression as well as sending graphical commands via X11. When configured correctly, the SSH protocol provides a secure line that is capable of protecting itself against DNS spoofing and man-in-the-middle attacks.


Question: Please explain the checking for Rootkit infections in Linux.

Answer: A Rootkit is an advanced form of malware that can yield a range of security issues and in many cases go undetected by average antivirus programs. Hence, advanced anti-spyware tools need to be used for checking Rootkit infections in Linux. One such is the rkhunter.

Rkhunter can be installed from the software repository by following the instructions of your distribution’s package management. Debian and Ubuntu users can use the (sudo) apt-get install rkhunter command while Red Hat-based distributions can use either the dnf or yum command.

A few other notable security tools available for checking rootkit infections in Linux are:

Chkrootkit
ClamAV
LMD (Linux Malware Detect)
Lynis

Question: How will you setup Password Aging in Linux?

Answer: The chage command allows the system administrators in Linux to enforce password aging. The command is used to change the number of days between mandatory password resets. The /etc/login.defs file is responsible for handling system-wide configuration. It can be edited for:

PASS_MAX_DAYS – Defines the maximum number of days a password may be used.
PASS_MIN_DAYS – Defines the minimum number of days allowed between password changes.
PASS_WARN_AGE – Defines the number of days warning is given before a password expires.




1. 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


2. How to terminate a running process in Linux?

Every process has a unique process id. To terminate the process, we first need to find the process id. The ps command will list all the running processes along with the process id. And then we use the kill command to terminate the process.

Operating Systems Training
The command for listing down all the processes:

$ ps


Suppose the process id of the process you want to terminate is 3849, then you will have to terminate it like this:

$ kill 3849


3. How to rename a file in Linux?

There is no specific command to rename a file in Linux. But you use the copy or move command to rename the file.

Using the Move command

$ mv <oldname> <newname>


Using the Copy command

$ cp <oldname> <newname>


And then delete the old file.

$ rm <oldname>


4. How to write the output of a command to a file?
You can use the redirection operator (>) to do this.

Syntax: $ (command) > (filename)


5. How to see the list of mounted devices on Linux?
By running the following command:

$ mount -l


6. How to find where a file is stored in Linux?

You can use the locate command to find the path to the file.

Suppose you want to find the locations of a file name sample.txt, then your command would be:

$ locate sample.txt


7. How to find the difference in two configuration files?

You can use the diff command for this:


$ diff abc.conf xyz.conf


diff - linux interview questions - edureka


8. Write a bash script to delete all the files in the current directory that contains the word “linux”.

for i in *linux*; do rm $i; done

9. How would you create a text file without opening it?

The touch command can be used to create a text file without opening it. The touch command will create an empty file. The syntax is as follows:


$ touch <filename>


Suppose you want to create a file named sample.txt, then the command would be:

$ touch sample.txt


10. How would you delete a directory in Linux?

There are two commands that can be used to delete a directory in Linux.

rmdir

$ rmdir <directory name>


rm -rf

$ rm -rf <directory name>


Note: The command rm -rf should be used carefully because it will delete all the data without any warnings.


11. How would you schedule a task in Linux?

There are two commands to schedule tasks in Linux: cron and at.

The cron command is used to repeatedly schedule a task at a specific time. The tasks are stored in a cron file and then executed using the cron command. The cron command reads the string from this file and schedules the task. The syntax for the string to enter in the cron file is as follows:

<minute> <hour> <day> <month> <weekday> <command>


Suppose you want to run a command at 4 pm every Sunday, then the string would be:

0 16 * * 0 <command>


The at command is used to schedule a task only once at the specified time.

Suppose you want to shut down the system at 6 pm today, then the command for this would be:

$ echo "shutdown now" | at -m 18:00


12. Suppose you try to delete a file using the rm command and the deletion fails. What could be the possible reason?

The path specified to the file or the file name mentioned might be wrong
The user trying to delete the file might not have permissions to delete the file.

13. How do you look at the contents of a file named sample.z?

The .z extension means that the file has been compressed. To look at the contents of the compressed file, you can use the zcat command. Example:

$ zcat sample.z

14. How to copy files to a Floppy Disk safely?

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

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

15. How to identify which shell you are using?

Open the terminal and run:

$ echo $SHELL


This will print the name of the Shell being used.

16. How can you login to another system in your network from your system?

SSH can be used for this. The Syntax is as follows:


ssh <username>@<ip address>


Suppose you want to login into a system with IP address 192.168.5.5 as a user “mike”, then the command would be:

$ ssh mike@192.168.5.5


17. How would you open a file in read-only mode using the vim editor?

$ vim -R <filename>


18. How would you search for a specific Employee ID in a file using the vim editor?

$ vim +/<employee id to be searched> <filename>


19. How to jump to a particular line in a file using vim editor?

$ vim +<line number> <filename>

20. How do you sort the entries in a text file in ascending order?

This can be done using the sort command.


$ sort sample.txt


21. What is the export command used for?

The export command is used to set and reload the environment variables. For example, if you want to set the Java path, then the command would be:

$ export JAVA_HOME = /home/user/Java/bin


22. How do you check if a particular service in running?

$ service <servicename> status


23. How do you check the status of all the services?

$ service --status-all


24. How do you start and stop a service?

To start:

$ service <servicename> start


To stop:

$ service <servicename> start


25. Explain the free command.

This command is used to display the free, used, swap memory available in the system.

Typical free command output. The output is displayed in bytes.

$ free



Q1. What operating system is the Linux based on?


Ans. UNIX



Q2. What is the difference between Linux and UNIX?


Ans. Linux is a non-propriety free, open sourced OS, while UNIX started as a propriety OS.


Q3. Is it legal to edit the Linux kernel?


Ans. Yes, as it is under General Public License (GPL) and anyone can edit.


Q4. What are the basic components of Linux?


Ans. It has the same components as any typical OS: kernel, shells and GUIs, system utilities and application program.


Q5. What is LILO?


Ans. LILO stands for Linux Loader and is a boot loader to load the operating system in the main memory.

Q6. Which command would you use if you want to remove the password assigned to a group?


Ans. The gpasswd – r removes the password assigned to a group.


Q7. What is BASH?


Ans. BASH is short for Bourne Again SHell. Written by Steve Bourne, it acts as the default shell for most Linux systems since it has been adapted.


Q8. What is the difference between BASH and DOS?


Ans. There are three key differences between BASH and DOS:


BASH commands are case sensitive while DOS commands are not
BASH follows no convention in naming files, while DOS follows a convention
Under BASH, / character serves as a directory separator while in DOS \ serves as the directory separator


Q9. What is the alternative method to a GUI installation in Linux?


Ans. Linux provides text base installation as the alternative method of GUI installation.


Q10. What is the root account in Linux?


Ans. The root account is like a systems administrator account, and allows full control of the system.


Q11. How can you find out how much memory Linux is using?


Ans. From a command shell, use the “concatenate” command: cat /proc/meminfo for memory usage information.


Q12. Does the Ctrl+Alt+Del key combination work on Linux?


Ans. Yes


Also Read>> How To Write a Technical Resume


Q13. How do you create a new user without logging on as a root user?


Ans. Using the su command


Q14. What is the minimum number of partitions that you need to install Linux?


Ans. Minimum 2 partitions are needed for installing Linux



Q15. Which command would you use to create a file system on a new hard drive?


Ans. The mkfs command


Q16. Which command is used to review boot messages?

Ans. The dmesg command



Q17. Which file is used to automatically mount file systems?

Ans. fstab file



Q18. What is the difference between internal and external commands?


Ans. Internal commands are those which are already loaded in the system. External commands are those which can be executed any time and are independent.


Q19. What is the difference between home directory and working directory?


Ans. Home directory is the default working directory when a user logs in.


Working directory is the user’s current directory


Q20. Which daemon controls the print spooling process?


Ans. The line printing daemon


Q21. How can you check the memory status?


Ans. free -m to display output in MB


free -m to display output in GB



Q22. Explain how to uninstall the libraries in Linux?


Ans. By using the command sudo apt – get remove library_name


Q23. Which command is used to delete a group?


Ans. The groupdel command


Q24. How do you terminate an ongoing process?


Ans. Use the kill command followed by the pid in order to terminate that process. To terminate all process at once, use kill 0.


Q25. Can Linux computer be made a router so that several machines may share a single Internet connection? How?


Ans. Yes, by IP masquerading


Q26. What daemon is used for scheduling of the commands?


Ans. The crontab command



2. What is LILO?

LILO (Linux Loader) is a boot loader for Linux. It is used to load Linux into memory and start the operating system. LILO can be configured to boot other operating systems as well. LILO is customizable, i.e., if the default configuration is not correct, it can be changed. The config file for LILO is lilo.conf. LILO is also a code snippet that loads PC BIOS into the main memory at the time of starting the computer system.

It handles the following tasks:

Locating Linux kernel

Identifying other supporting programs and loading them in memory
Starting the kernel
The selection of various Kernel images and boot routines is supported by LILO. For this reason, it is known as the boot manager.






3. Suppose, you wish to print a file ‘draft’ with 60 lines on a page. What command would you use?
The command used for this purpose would be as follows:

pr -l60 draft

Note: The default page length when using pr is 66 lines. The -l option specifies a different length.

4. What is LD_LIBRARY_PATH?

LD_LIBRARY_PATH is an environment variable used for debugging a new library or a non-standard library. It is also used to identify the directories that need to be searched for; in order to do this, the path to search for the directories needs to be specified.

The variable can be set using the following:

setenv—LD_LIBRARY_PATH--$PATH

It is used to search for the shared objects/dynamic libraries by the operating system for extendable functionality at the runtime.
Prepare yourself for the Linux certification with this comprehensive Linux Training in London!

5. Name a service that you should disable (which acts both as web and FTP servers) on a Linux server.

The finger service should be disabled on a Linux server because a remote user can get important information about the system by using this command.

6. What does sar provide? Where are the sar logs stored?

In Linux, the sar command collects, reports, or saves system activity information, and it serves to log and evaluate a variety of information regarding system activity. With performance problems, sar also permits retroactive analysis of the load values for various sub-systems (CPUs, memory, disks, interrupts, network interfaces, and so on). If CPU utilization is near to 100 percent, the sampled workload is considered to be CPU-bound.

By default, the log files of the sar command are located at the /var/log/sa/sadd file, where the dd parameter indicates the current day.

7. How to check memory stats and CPU stats as a Linux Admin?

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

Enroll in our Linux Training to get a clear understanding of the Linux concepts!

8. How to reduce or shrink the size of the LVM partition?

Below are the logical steps to reduce the size of the LVM partition:

Unmount the file system using the unmount command
Use the resize2fs command as follows:
resize2fs /dev/mapper/myvg-mylv 10G
Then, use the lvreduce command as follows:
lvreduce -L 10G /dev/mapper/myvg-mylv
This way, we can reduce the size of the LVM partition and fix the size of the file system to 10 GB.

9. What are the different modes of Network Bonding in Linux?

Below is the list of various modes used in Network Bonding:

balance-rr or 0: The round-robin mode for fault tolerance and load balancing
active-backup or 1: Sets the active-backup mode for fault tolerance
balance-xor or 2: Sets an XOR (exclusive-or) mode for fault tolerance and load balancing
broadcast or 3: Sets a broadcast mode for fault tolerance. All transmissions are sent on all the slave interfaces

802.3ad or 4: Sets an IEEE 802.3ad dynamic link aggregation mode and creates aggregation groups that share the same speed and duplex settings

balance-tlb or 5: Sets a transmit load balancing (TLB) mode for fault tolerance and load balancing
balance-alb or 6: Sets an active load balancing (ALB) mode for fault tolerance and load balancing
For more details, check out Intellipaat’s Linux Training in Sydney!

10. How to check and verify the status of the bond interface?

Using the following command, we can check which mode is enabled and what LAN cards are used in this bond:

cat /proc/net/bonding/bond0

In this example, we have a single bond interface. However, we can have multiple bond interfaces like bond1, bond2, and so on.

11. How can you enhance the security of the password file in Linux?

It is in the test file named ‘/etc/passwd’ that Linux usually keeps its user account details, including the one-way encrypted passwords. However, this file can be accessed with the help of different tools, which might throw security issues.

To minimize this risk, we will make use of the shadow password format that saves the account details in a regular file /etc/passwd as in the traditional method but with the password stored as a single ‘x’ character, i.e., it is not the original password that is actually stored in this file. Meanwhile, a second file /etc/shadow will have the encrypted password, along with the other relevant information, such as the account/password expiration date, etc. Most importantly, the latter file is readable only by the root account, and thus it minimizes the security risk.

12. What command can you use to make a tape archive file of /home directory and send it to the /dev/tape device?

The command used here is:

tar -cvf /dev/tape /home

The -xvf option is used to extract files from an archive.

13. Suppose, your FTP Server is hacked and the entire server needs to be restored. How would you restore the original kernel system files?

We cannot restore the entire operating system from the tape backup device. Therefore, we should reinstall the core operating system and then restore the system configuration files and user data from the tape backup device.

14. Why should you avoid Telnet to administer a Linux system remotely?

Telnet uses the most insecure method for communication. It sends data across the network in plain text format, and anybody can easily find out the password using the network tool. It includes the passing of the login credentials in plain text, i.e., anyone running a sniffer on the network can find the information he/she needs to take control of the device in a few seconds by eavesdropping on a Telnet login session.

15. Name the four Configuration Management Tools used in UNIX-like operating systems.

Ansible
Chef
Puppet
CFEngine

16. What is the difference between Cron and Anacron?

There are many differences between Cron and Anacron as given below:

Minimum granularity with Cron is in minutes, while it is in days with Anacron.
A Cron job can be scheduled by any normal user, while Anacron can be scheduled only by a superuser (a superuser is a special user account used for system administration. Depending on the operating system, the actual name of this account might be root, administrator, admin, or supervisor).
Cron expects the system to be up and running, while Anacron doesn’t expect this all the time. In the case of Anacron, if a job is scheduled and the system is down at this time, it will execute the job as soon as the system is up and running.
Cron is ideal for servers, while Anacron is ideal for both desktops and laptops.
Cron should be used when we want a job to be executed at a particular hour and minute, while Anacron should be used when the job can be executed at any time.

17. Which command is used to check the number of files, disk space, and each user’s defined quota?

The repquota command is used to check the status of a user’s defined quota, along with the disk space and the number of files used.

This command gives a summary of the user’s quota, i.e., how much space and files are left for the particular user. Each user has a defined quota in Linux. This is done mainly for security as it restricts files from unwanted access. The quota can be given to a single user or to a group of users.

18. What is the name and path of the main system log?

By default, the main system log is /var/log/messages. This file contains all messages and scripts written by a 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. The dmesg file is a system file that is written upon the system boot.


19. Can we convert a Linux computer into a router in order to enable multiple machines to work on the same Internet connection? If yes, how?

Yes! We can convert a Linux PC into a router so that it can act as an IP gateway for a network. This process of turning a Linux machine to a router is referred to as IP Masquerade, which is basically a Linux networking function that is quite similar to the one-to-many network address translation servers.

Linux IP Masquerading enables the other ‘internal’ computers that are linked to this Linux system to get connected to the Internet. This Linux feature is available even when these machines do not have their own IP addresses.

In Linux, we can perform IP Masquerading by following the below steps:

Step 1: First of all, we have to make sure that our Linux PC is having an Internet connection, along with a LAN connection. In fact, a Linux PC will be having a PPP connection and an Ethernet card.
Step 2: As the default gateway for TCP/IP networking, all the other systems on our LAN use the Linux machine. Hence, we have to use the same DNS addresses provided by the Internet service provider on all our systems.
Step 3: Now, for enabling IP forwarding, we will use the following command:

echo 1 > /proc/sys/net/ipv4/ip_forward

For checking whether we have IP forwarding enabled already, we can use the following:

sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0
Or, we will just check out the value i /proc/sys/net/ipv4/ip_forward:


~]# cat /proc/sys/net/ipv4/ip_forward


Step 4: Finally, we will run /sbin/iptables for setting up those rules that enable IP Masquerading.




20. In Linux, how would you change the window manager?

The /.xinitrc file lets us change the window manager that we will use while logging into the X window session. The dot (.) here tells us that this particular file is a hidden. It also means that this file will not be present when we carry out a normal directory listing. In order to set up a window manager, the following command should be saved in this file:

exec window manager

Once we are done with this part, the next step is to save the file. This way, a new window manager opens up every time we run a startx, and it becomes the default.

Now, let’s check out the commands used for starting some very common desktop environments and window managers:

KDE = startkde
GNOME = gnome-session
BlackBox = blackbox
FVWM = fvwm
Window Maker = wmaker
IceWM = icewm

21. How are shadow passwords given in Linux?

In Linux, the pwconv command is used for providing the shadow passwords. Shadow passwords are given for better system security. This command creates the file /etc/shadow and changes all passwords to ‘x’ in the /etc/passwd file.

First, the entries in the shadowed file, which don’t exist in the main file, are removed. Then, the shadowed entries that don’t have ‘x’ as the password in the main file are updated. Any missing shadowed entries are also 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.

Get certified from the top Linux Course in Singapore now!

22. What daemon is used for scheduling commands?

The crontab command is used for scheduling commands to run at a later time.

Syntax:

crontab [ -u user ] file

crontab [ -u user ] { -l | -r | -e }
Options:

-l: Displays the current crontab entries

-r: Removes the current crontab

-e: Edits the current crontab using the editor specified by the VISUAL or EDITOR environment variables

When a user exits from the editor, the modified crontab will be installed automatically. Each user can have their own crontab and though these are files in /var, they are not intended to be edited directly.

If the -u option is given, then the crontab gives the name of the user whose crontab is to be tweaked. If it is given without this option, then it will display the crontab of the user who is executing the command.


23. What shell does a Linux Administrator assign to a POP3 mail-only account?

A Linux Administrator assigns a POP3 mail-only account to the /bin/false shell. However, assigning a bash shell to a POP3 mail-only account gives the user the login access, which is usually avoided. The /bin/nologin shell can also be used. This shell is provided to the user when we don’t want to give shell access to the user. The user cannot access the shell, and it rejects shell login on the server as in Telnet. It is mainly meant for the security of the shells.

POP3 is basically used for downloading mail-to-mail programs. So for the illegal downloading of emails on the shell, this account is assigned to the /bin/false shell or the /bin/nologin shell. Both shells are the same as they do the same work of rejecting the user login to the shell.
The main difference between these two shells is that the false shell shows the incorrect code and any unusual coding when a user logs in to it, whereas the nologin shell simply tells us that no such account is available. Therefore, the nologin shell is used often in Linux.

24. If a volume group named VG0 already exists and we need to extend this volume group up to 4 GB, how do we do it?

First, we would create a physical volume (/dev/sda7) of size 4 GB.
Then, we would run the following command:
vgextend VG0 /dev/sda7
25. Is there any relation between the modprobe.conf file and network devices?
Yes, this file assigns a kernel module to each network device.

Example:


[root@localhost ~]# cat /etc/modprobe.conf

alias eth0 b44
Here, b44 is the kernel module for network device eth0.
We can confirm whether this module “b44” is present or not by the following command
[root@localhost ~]# lsmod |grep b44
b44 29005 0

26. What is YUM?

YUM stands for Yellow dog Updater, Modified because it is based on YUP, the Yellow dog Updater. Yellow Dog is a version of Linux for the Power Architecture hardware and is RPM-based, just like Red Hat Enterprise Linux and Fedora. YUP, and later YUM, were written by the Linux community as a way to maintain an RPM-based system.

27. What is the role of Kudzu?

Kudzu is used to detect new hardware. Red Hat Linux runs a hardware discoverer, called Kudzu. When attempting to identify a serial port, Kudzu resets the serial port. This stops the serial console. Kudzu is configured from the following file:

/etc/sysconfig/kudzu

Kudzu can be prevented from resetting hardware, by setting the configuration parameter SAFE to ‘yes.’

28. What is the difference between ext2 and ext3 file systems?

The ext3 file system is an enhanced version of the ext2 file system.
The most important difference between ext2 and ext3 is that ext3 supports journaling.
After an unexpected power failure or system crash (also called an unclean system shutdown), each ext2 file system must be checked for consistency by the e2fsck program. This is a time-consuming process and during this time, any data on the volumes is unreachable.
The journaling provided by the ext3 file system means that this sort of a file system check is no longer necessary after an unclean system shutdown. The only time a consistency check occurs while using ext3 is in certain rare hardware failure cases, such as hard drive failures. The time to recover an ext3 file system after an unclean system shutdown does not depend on the size of the file system or on the number of files. Rather, it depends on the size of the journal used to maintain consistency. The default journal size takes almost a second to recover, depending on the speed of the hardware.

29. Explain the /proc file system?

The /proc file system is a virtual file system that provides detailed information about Linux Kernel, hardware, and running processes. Files under the /proc directory are named as virtual files.

Since /proc contains virtual files, it is called a 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, such as the /proc/filesystems file and the /proc/sys/ directory, provide system configuration information and interfaces.

30. How would you create an ext4 file system?

We can create an ext4 file system with the following command:

# mke2fs -t ext4 /dev/DEV

31. How to enable ACLs for the /home partition?

Add the following entry in /etc/fstab:
LABEL=/home /home ext3 acl 1 2
Then, remount the /home partition with the acl option:
mount -t ext3 -o acl /dev/sda3 /home



Question 1. What Is Linux Shell?


Answer :

Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands. In UNIX, any program can be the users shell. Shell categories in Linux are:
Bourne shell compatible, C shell compatible, nontraditional, and historical.

Question 2. What Is Shell Script?


Answer :

A shell script, as the name suggests, is a script written for the shell. Script here means a programming language used to control the application. The shell script allows different commands entered in the shell to be executed. Shell script is easy to debug, quicker as compared to writing big programs. However the execution speed is slow because it launches a new process for every shell command executed. Examples of commands are cp, cn, cd.

Question 3. What Is Kernel? Explain The Task It Performs.


Answer :

Kernel is used in UNIX like systems and is considered to be the heart of the operating system. It is responsible for communication between hardware and software components. It is primarily used for managing the systems resources as well.

Kernel Activities:


The Kernel task manager allows tasks to run concurrently.

Managing the computer resources: Kernel allows the other programs to run and use the resources.

Resources include i/o devices, CPU, memory.

Kernel is responsible for Process management. It allows multiple processes to run simultaneously allowing user to multitask.

Kernel has an access to the systems memory and allows the processes to access the memory when required.

Processes may also need to access the devices attached to the system. Kernel assists the processes in doing so.

For the processes to access and make use of these services, system calls are used.



Question 4. What Are Pipes?


Answer :

A pipe is a chain of processes so that output of one process (stdout) is fed an input (stdin) to another. UNIX shell has a special syntax for creation of pipelines. The commands are written in sequence separated by |. Different filters are used for Pipes like AWK, GREP.
e.g. sort file | lpr ( sort the file and send it to printer)

Linux Embedded systems Tutorial

Question 5. Explain Trap Command; Shift Command, Getopts Command Of Linux

Answer :

Trap command: controls the action to be taken by the shell when a signal is received.
Trap [OPTIONS] [ [arg] signspec..]
Arg is the action to be taken or executed on receiving a signal specified in signspec.
e.g. trap “rm $FILE; exit” // exit (signal) and remove file (action).

Shift Command: Using shift command, command line arguments can be accessed. The command causes the positional parameters shift to the left. Shift [n] where n defaults to 1. It is useful when several parameters need to be tested.

Getopts command: this command is used to parse arguments passed. It examines the next command line argument and determines whether it is a valid option.

Getopts {optstring} {variable1}. Here, optsring contains letters to be recognized if a letter is followed by a colon, an argument should be specified. E.g (whether the argument begins with a minus sign and is followed by any single letter contained inside options ) If not, diagnostic messages are shown. It is usually executed inside a loop.


Question 6. What Stateless Linux Server? What Feature It Offers?


Answer :

A stateless Linux server is a centralized server in which no state exists on the single workstations. There may be scenarios when a state of a partilcuar system is meaningful (A snap shot is taken then) and the user wants all the other machines to be in that state. This is where the stateless Linux server comes into picture.

Features:
It stores the prototypes of every machine.
It stores snapshots taken for those systems.
It stores home directories for those system.

Uses LDAP containing information of all systems to assist in finding out which snapshot (of state) should be running on which system.



Question 7. What Does Nslookup Do? Explain Its Two Modes.


Answer :

Nslookup is used to find details related to a Domain name server. Details like IP addresses of a machine, MX records, servers etc. It sends a domain name query packet to the corresponding DNS.

Nslookup has two modes. Interactive and non interactive. Interactive mode allows the user to interact by querying information about different hosts and domains.

Non interactive mode is used to fetch information about the specified host or domain.

Interactive mode:

Nslookup [options] [server]

Unix/Linux Tutorial Red Hat Linux System Administration Interview Questions

Question 8. What Is Bash Shell?


Answer :

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.



Question 9. What Are The Process States In Linux?


Answer :

Process states in Linux:
Running: Process is either running or ready to run.

Interruptible: a Blocked state of a process and waiting for an event or signal from another process.

Uninterruptible:- a blocked state. Process waits for a hardware condition and cannot handle any signal.

Stopped: Process is stopped or halted and can be restarted by some other process.

Zombie: process terminated, but information is still there in the process table.

Ubuntu Certified Professional Interview Questions

Question 10. What Is A Zombie?


Answer :

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.

Question 11. Explain Each System Calls Used For Process Management In Linux.


Answer :

System calls used for Process management:
Fork () :- Used to create a new process
Exec() :- Execute a new program
Wait():- wait until the process finishes execution
Exit():- Exit from the process
Getpid():- get the unique process id of the process
Getppid():- get the parent process unique id
Nice():- to bias the existing property of process

Question 12. How Do You List Files In A Directory?


Answer :

ls - list directory contents
ls -l (-l use a long listing format)

Question 13. How Do You List All Files In A Directory, Including The Hidden Files?


Answer :

ls -a (-a, do not hide entries starting with .)

Question 14. How Do You Find Out All Processes That Are Currently Running?


Answer :

ps -f (-f does full-format listing.)


Question 15. How Do You Find Out The Processes That Are Currently Running Or A Particular User?


Answer :

ps -au Myname (-u by effective user ID (supports names)) (a - all users)


Question 16. How Do You Kill A Process?


Answer :

kill -9 8 (process_id 8) or kill -9 %7 (job number 7)
kill -9 -1 (Kill all processes you can kill.)
killall - kill processes by name most (useful - killall java)

Question 17. What Would You Use To Edit Contents Of The File?


Answer :

vi screen editor or jedit, nedit or ex line editor

Question 18. What Would You Use To View Contents Of A Large Error Log File?


Answer :

tail -10 file_name ( last 10 rows)


Question 19. How Do You Log In To A Remote Unix Box?


Answer :

Using telnet server_name or ssh -l ( ssh - OpenSSH SSH client (remote login program))

Question 20. How Do You Get Help On A Unix Terminal?


Answer :

man command_name
info command_name (more information)



Question 21. How Do You List Contents Of A Directory Including All Of Its Subdirectories, Providing Full Details And Sorted By Modification Time?


Answer :

ls -lac
-a all entries
-c by time

Question 22. What Is A Filesystem?


Answer :

Sum of all directories called file system.
A file system is the primary means of file storage in UNIX. File systems are made of inodes and superblocks.



Question 23. How Do You Get Its Usage (a Filesystem)?


Answer :

By storing and manipulate files.


Question 24. How Do You Check For Processes Started By User 'pat'?


Answer :

ps -fu pat (-f -full_format u -user_name )


Question 25. How Do You Start A Job On Background?


Answer :

bg %4 (job 4)

Question 26. What Utility Would You Use To Replace A String '2001' For '2002' In A Text File?


Answer :

Grep, Kde( works on Linux and Unix)


Question 27. What Utility Would You Use To Cut Off The First Column In A Text File?


Answer :

awk, kde


Question 28. How To Copy File Into Directory?


Answer :

cp /tmp/file_name . (dot mean in the current directory)

Question 29. How To Remove Directory With Files?


Answer :

rm -rf directory_name

Question 30. What Is The Difference Between Internal And External Commands?


Answer :

Internal commands are stored in the; same level as the operating system while external commands are stored on the hard disk among the other utility programs.

Question 31. List The Three Main Parts Of An Operating System Command:


Answer :

The three main parts are the command, options and arguments.

Question 32. What Is The Difference Between An Argument And An Option (or Switch)?


Answer :

An argument is what the command should act on: it could be a filename, directory or name. An option is specified when you want to request additional information over and above the basic information each command supplies.

Question 33. What Is The Purpose Of Online Help?


Answer :

Online help provides information on each operating system command, the syntax, the options, the arguments with descriptive information.


Question 34. Name Two Forms Of Security.


Answer :

Two forms of security are Passwords and File Security with permissions specified.

Question 35. What Command Do You Type To Find Help About The Command Who?


Answer :

$ man who

Question 36. What Is The Difference Between Home Directory And Working Directory?


Answer :

Home directory is the directory you begin at when you log into the system. Working directory can be anywhere on the system and it is where you are currently working.


Question 37. Which Directory Is Closer To The Top Of The File System Tree, Parent Directory Or Current Directory?


Answer :

The parent directory is above the current directory, so it is closer to the root or top of the file system.

Question 38. What Are Two Subtle Differences In Using The More And The Pg Commands?


Answer :

With the more command you display another screenful by pressing the spacebar, with pg you press the return key.

The more command returns you automatically to the UNIX shell when completed, while pg waits until you press return.

Question 39. When Is It Better To Use The More Command Rather Than Cat Command?


Answer :

It is sometimes better to use the more command when you are viewing a file that will display over one screen.

Question 40. What Are Two Functions The Move Mv Command Can Carry Out?


Answer :

The mv command moves files and can also be used to rename a file or directory.

HP-ux 11iv3 system administration Interview Questions

Question 41. Name Two Methods You Could Use To Rename A File?


Answer :

Two methods that could be used:
a. use the mv command
b. copy the file and give it a new name and then remove the original file if no longer needed.

Question 42. List All The Files Beginning With A?


Answer :

To list all the files beginning with A command: ls A*


Question 43. Which Of The Quoting Or Escape Characters Allows The Dollar Sign ($) To Retain Its Special Meaning?


Answer :

The double quote (") allows the dollar sign ($) to retain its special meaning. Both the backslash (\) and single quote (') would remove the special meaning of the dollar sign.

Question 44. What Is A Faster Way To Do The Same Command? Mv Fileo.txt Newdir Mv Filel.txt Newdir Mv File2.txt Newdir Mv File3.txt Newdir?


Answer :

A shortcut method would be: mv file?.txt newdir

Question 45. List Two Ways To Create A New File:


Answer :

a.Copy a file to make a new file.
b. Use the output operator e.g. ls -l > newfile.txt

Question 46. What Is The Difference Between > And >> Operators?


Answer :

The operator > either overwrites the existing file (WITHOUT WARNING) or creates a new file.
The operator >> either adds the new contents to the end of an existing file or creates a new file.

Question 47. How Can You See All Mounted Drives?


Answer :

mount -l


Question 48. How Can You Find A Path To The File In The System?


Answer :

locate file_name (locate - list files in databases that match a pattern)


Question 49. What Linux Hotkeys Do You Know?


Answer :

Ctrl-Alt-F1 Exit to command prompt
Ctrl-Alt-F7 or F8 Takes you back to KDE desktop from command prompt
Crtl-Alt-Backspace Restart XWindows
Ctrl-Alt-D Show desktop

Question 50. What Can You Tell About The Tar Command?


Answer :

The tar program is an immensely useful archiving utility. It can combine an entire directory tree into one large file suitable for transferring or compression.

Question 51. What Types Of Files You Know?


Answer :

Files come in eight flavors:
Normal files
Directories
Hard links
Symbolic links
Sockets
Named pipes
Character devices
Block devices

Question 52. How You Will Uncompress The File?


Answer :

Use tar command (The GNU version of the tar archiving utility):
tar -zxvf file_name.tar.gz

Question 53. What Does Grep() Stand For?


Answer :

General Regular Expression Parser.

Question 54. What Does The Top Command Display?


Answer :

Top provides an ongoing look at processor activity in real time.It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive interĂ‚¬ face for manipulating processes. (q is to quit)

Question 55. How To Find Difference In Two Configuration Files On The Same Server?


Answer :

Use diff command that is compare files line by line
diff -u /usr/home/my_project1/etc/ABC.conf /usr/home/my_project2/etc/ABC.conf

Question 56. What Is The Best Way To See The End Of A Logfile.log File?


Answer :

Use tail command - output the last part of files
tail -n file_name ( the last N lines, instead of the last 10 as default)

Question 57. Please Write A Loop For Removing All Files In The Current Directory That Contains A Word 'log'?


Answer :

for i in *log*; do rm $i; done

Question 58. How To Switch To A Previously Used Directory?


Answer :

cd -

Question 59. How Many Vi Editor Modes Do You Know?


Answer :

Three modes -
Command mode: letters or sequence of letters interactively command vi.
Insert mode: Text is inserted.
Command line mode: enter this mode by typing ":" and entry command line at the foot of the screen.

Question 60. How Can You Terminate Vi Session?


Answer :

Use command: ZZ that is save changes and quit.
Use command line: ":wq" that is write changes and quit.
Use command line: ":q!" to ignore changes and quit.

Question 61. How Can You Copy Lines Into The Buffer In Command Mode?


Answer :

yy - copy a single line defined by current cursor position
3yy - copy 3 lines. Current line and two lines below it.

Question 62. We Saw The Mention On The Linux Bios Website About One Million Devices Shipped With Linux Bios. Could You Tell Us More About These Devices?


Answer :

Yes, these are internet terminals that were built in India, based on the [x86 system-on-chip] STPC chip, I am told; also, there evidently is a Turkish-built digital TV that runs Linux BIOS. I have also heard that there are routers and many other embedded devices running Linux BIOS. I think at this point that 1 million is a low number. I am in contact with other set-top box vendors that are talking about numbers in the lOs of millions for their products. These numbers actually make the OLPC numbers seem small, which is in it amazing.

Question 63. What's Your Goal For Your Talk At Fosdem?


Answer :

I’d like to communicate the basic ideas — that Linux is a good BIOS, and why; why Linux BIOS is built the way it is; where we are going; and how people can help. Most importantly, why it all matters — and it really matters a lot. We’re on the verge of losing control of the systems we buy, and we need to make a conscious effort, as a community, to ensure this loss of control does not happen. That effort will not be without some sacrifice, but if we are to maintain our ability to use and program our machines, and have fun with them, we have to act now. Because, if the computing business stops being fun, what’s the point$

Question 64. What Are Mysql Transactions?


Answer :

A set of instructions/queries that should be executed or rolled back as a single atomic unit.

Question 65. Explain Multi-version Concurrency Control In Mysql?


Answer :

Each row has two additional columns associated with it - creation time and deletion time, but instead of storing timestamps, MySQL stores version numbers.

Question 66. Explain Mysql Locks.


Answer :

Table-level locks allow the user to lock the entire table, page-level locks allow locking of certain portions of the tables (those portions are referred to as tables), row-level locks are the most granular and allow locking of specific rows.

Question 67. Explain Mysql Architecture.


Answer :

The front layer takes care of network connections and security authentications, the middle layer does the SQL query parsing, and then the query is handled off to the storage engine. A storage engine could be either a default one supplied with MySQL (MyISAM) or a commercial one supplied by a third-party vendor (ScaleDB, InnoDB, etc.)

Question 68. List The Main Applications Of 8 Bit Microprocessors?


Answer :

8 bit microprocessors are used in a variety of applications such as appliances automobiles ,industrial process and control applications.

Question 69. What Is Nv-ram?


Answer :

Nonvolatile Read Write Memory, also called Flash memory. It is also know as shadow RAM.

Question 70. Can Rom Be Used As Stack?


Answer :

ROM cannot be used as stack because it is not possible to write to ROM.

Question 71. What Is Stack?


Answer :

Stack is a portion of RAM used for saving the content of Program Counter and general purpose registers.

Question 72. What Is Flag?


Answer :

Flag is a flip-flop used to store the information about the status of a processor and the status of the instruction executed most recently .

Question 73. Which Processor Structure Is Pipelined?


Answer :

All x86 processors have pipelined structure.

Question 74. What Is A Compiler?


Answer :

Compiler is used to translate the high-level language program into machine code at a time. It doesn’t require special instruction to store in a memory, it stores automatically. The Execution time is less compared to Interpreter.

Question 75. Differentiate Between Ram And Rom?


Answer :

RAM: Read / Write memory, High Speed, Volatile Memory. ROM: Read only memory, Low Speed, Non Voliate Memory.

Question 76. Which Transistor Is Used In Each Cell Of Eprom?


Answer :

Floating .gate Avalanche Injection MOS (FAMOS) transistor is used in each cell of EPROM.

Question 77. What Is Called .scratch Pad Of Computer.?


Answer :

Cache Memory is scratch pad of computer.

Question 78. What Is Cache Memory?


Answer :

Cache memory is a small high-speed memory. It is used for temporary storage of data & information between the main memory and the CPU (center processing unit). The cache memory is only in RAM.

Question 79. What Is Interrupt?


Answer :

Interrupt is a signal send by external device to the processor so as to request the processor to perform a particular work.

Question 80. Difference Between Static And Dynamic Ram?


Answer :

Static RAM: No refreshing, 6 to 8 MOS transistors are required to form one memory cell, Information stored as voltage level in a flip flop.

Dynamic RAM: Refreshed periodically, 3 to 4 transistors are required to form one memory cell, Information is stored as a charge in the gate to substrate capacitance.

Question 81. What Is The Difference Between Primary & Secondary Storage Device?


Answer :

In primary storage device the storage capacity is limited. It has a volatile memory. In secondary storage device the storage capacity is larger. It is a nonvolatile memory. Primary devices are: RAM / ROM. Secondary devices are: Floppy disc I Hard disk.

Question 82. Why Does Microprocessor Contain Rom Chips?


Answer :

Microprocessor contain ROM chip because it contain instructions to execute data.

Question 83. What Is Meant By Latch?


Answer :

Latch is a D- type flip-flop used as a temporary storage device controlled by a timing signal, which can store 0 or 1. The primary function of a Latch is data storage. It is used in output devices such as LED, to hold the data for display.

Question 84. What Is The Difference Between Microprocessor And Microcontroller?


Answer :

In Microprocessor more op-codes, few bit handling instructions. But in Microcontroller: fewer op-codes, more bit handling Instructions, and also it is defined as a device that includes micro processor, memory, & input / output signal lines on a single chip.

Question 85. What Is The Disadvantage Of Microprocessor?


Answer :

It has limitations on the size of data. Most Microprocessor does not support floating-point operations.

Question 86. Is The Data Bus Is Bi-directional?


Answer :

The data bus is Bi-directional because the same bus is used for transfer of data between Micro Processor and memory or input / output devices in both the direction.

Question 87. Is The Address Bus Unidirectional?


Answer :

The address bus is unidirectional because the address information is always given by the Micro Processor to address a memory location of an input I output devices.

Question 88. Define Hcmos?


Answer :

High-density n- type Complimentary Metal Oxide Silicon field effect transistor.

Question 89. What Is 1st / 2nd / 3rd / 4th Generation Processor?


Answer :

The processor made of PMOS I NMOS / HMOS I HCMOS technology is called 1st / 2nd / 3rd / 4th generation processor, and it is made up of 4 / 8 / 16 / 32 bits.

Question 90. Why 8085 Processor Is Called An 8 Bit Processor?


Answer :

Because 8085 processor has 8 bit ALU (Arithmetic Logic Review). Similarly 8086 processor has 16 bit ALU.

Question 91. Give Examples For 8 I 16 / 32 Bit Microprocessor?


Answer :

8-bit Processor - 8085 I Z80 / 6800; 16-bit Processor - 8086 / 68000 / Z8000; 32-bit Processor - 80386 I 80486.

Question 92. What Is A Microprocessor?


Answer :

Microprocessor is a program-controlled device, which fetches the instructions from memory, decodes and executes the instructions. Most Micro Processor is single- chip devices.

Question 93. What Command Would You Use To Create An Empty File Without Opening It To Edit It?


Answer :

You use the touch command to create an empty file without needing to open it. Answers a and e point to invalid commands, though either of these might actually be aliased to point to a real command. Answers b and c utilize editors, and so do not satisfy the requirements of the question. actually touch is used to change the timestamps of a file if its exits, otherwise a new file with current timestamps will be created.

Question 94. What Do You Type To Stop A Hung Process That Resists The Standard Attempts To Shut It Down?


Answer :

The kill command by itself tries to allow a process to exit cleanly. You type kill -9 PID, on the other hand, to abruptly stop a process that will not quit by any other means. Also, pressing CtrI+C works for many programs. Answers b and d are only valid in some contexts, and even in those contexts will not work on a hung process.

Question 95. Which Two Commands Can You Use To Delete Directories?


Answer :

You can use rmdir or rm -rf to delete a directory. Answer a is incorrect, because the rm command without any specific flags will not delete a directory, it will only delete files. Answers d and e point to a non-existent command.

Question 96. What Is Difference Between At And Cron?


Answer :

Cron command is used to schedule the task daily at the same time repeatedly ,“at” command is used to schedule the task only once i.e. to run only one time.

Question 97. Which Of The Following Tasks Cannot Be Accomplished With The Touch Command?


Answer :

The touch command is usually used to modify either a file’s access or modification time. It can also be used to create a new file.

Question 98. You Want To Copy The User's Home Directories To A New Location. Which Of The Following Commands Will Accomplish This?


Answer :

The -r option tells the cp command to recurs the directories. The -P option retains the original permissions.

Question 99. You Read An Article That Lists The Following Command: Dd If=/dev/fdo Bs=512 Of=/new What Does This Accomplish?


Answer :

The dd command is a special copy command often used for floppy disks and tapes. The if= option specifies the source; the bs= is the block size; and the of= option is the output.

Question 100. You Attempt To Delete A File Called Sales.mem Using The Rm Command But The Command Fails. What Could Be The Problem?


Answer :

In order to delete a file, you must have write rights to the directory containing the file.

Question 101. You Want To Search For Sale And Sales. What Regular Expression Should You Use?


Answer :

Use the asterick (*) to match to zero or more characters. The ‘$‘ matches to any one character so sale$ would not find sale.

Question 102. You Want To Know How Many Lines In The Kickoff File Contains 'prize'. Which Of The Following Commands Will Produce The Desired Results?


Answer :

Using the -c option with the grep command will show the total number of lines containing the specified pattern rather than displaying the lines containing the pattern.

Question 103. You Want To Verify Which Lines In The File Kickoff Contain 'bob'. Which Of The Following Commands Will Accomplish This?


Answer :

The -n option when used with sed prints only the lines containing the pattern. In this case, the pattern is ‘Bob’ and the file to be searched is kickoff.

Question 104. You Have A File Called Docs.z But Do Not Know What It Is. What Is The Easiest Way To Look At The Contents Of The File?


Answer :

The .Z extension indicates that this is a file that has been compressed using the compress utility. The zcat utility provides the ability to display the contents of a compressed file.

Question 105. After Copying A File To A Floppy Disk, What Should You Do Before Removing The Disk?


Answer :

If you do not unmount the floppy before removing it, the files on the floppy may become corrupted.

Question 106. You Have Set Quotas For All Your Users But Half Of Your Users Are Using More Space Than They Have Been Allotted. Which Of The Following Could Be The Problem?


Answer :

Quotas are set on a partition by partition basis. If your users have home directories on different partitions, you will need to configure quotas for each partition.

Question 107. What Command Should You Use To Check The Number Of Files And Disk Space Used And Each User's Defined Quotas?


Answer :

The repquota command is used to get a report on the status of the quotas you have set including the amount of allocated space and amount of used space.

Question 108. You Have A Large Spreadsheet Located In The /data Directory That Five Different People Need To Be Able To Change. How Can You Enable Each User To Edit The Spreadsheet From Their Individual Home Directories?


Answer :

By creating a link to the file in each user’s home directory, each user is able to easily open and edit the spreadsheet. Also, any changes that are made are seen by all the users with access.

Question 109. You Have A File Called Sales Data And Create Symbolic Links To It In Bob's Home Directory. Bob Calls You And Says That His Link No Longer Works. How Can You Fix The Link?


Answer :

Because the link in bob’s directory is a symbolic link, if the file sales data in the /data directory is deleted, the symbolic link will no longer work.

Question 110. What Is Meant By Sticky Bit?


Answer :

When the sticky bit is set on a world writable directory, only the owner can delete any file contained in that directory.

Question 111. Your Default Umask Is 002. What Does This Mean?


Answer :

The digits of your umask represent owner, group and others in that order.
The 0 gives read and write for files and the 2 gives read only for files.

Question 112. Which Of The Following Commands Will Replace All Occurrences Of The Word Rate With The Word Speed In The File Racing?


Answer :

When using sed to do a search and replace, its default action is to only replace the first occurrence in each line. Adding the ‘g’ makes sed replace all occurrences of the search term even when it occurs multiple times on the same line.

Question 113. You Have A Tab Delimited File Called Phonenos And Want To Change Each Tab To Four Spaces. What Command Can You Use To Accomplish This?


Answer :

By default, expand converts tabs to eight spaces. Use the -t option to change this behavior.

Question 114. You Issue The Command Head * What Would The Resulting Output Be?


Answer :

If the number of lines to display is not specified, the first ten lines of the specified file are displayed. The asterick tells head to display the content of each file in the present working directory.

Question 115. What Text Filter Can You Use To Display A Binary File In Octal Numbers?


Answer :

The od text filter will dumpt the contents of a file and display it in 2-byte octal numbers.

Question 116. What Would Be The Result Of The Command Paste -s Dog Cat?


Answer :

The paste text filter usually joins two files separating the corresponding lines with a tab. The -s option, however, will cause paste to display the first file, dog, then a new line character, and then the file cat.

Question 117. You Wish To Print The File Vacations With 60 Lines To A Page. Which Of The Following Commands Will Accomplish This?


Answer :

The default page length when using pr is 66 lines. The -l option is used to specify a different length.

Question 118. What Would Be The Result Of Issuing The Command Cat Phonenos?


Answer :

The tac text filter is a reverse cat. It displays a file starting with the last line and ending with the first line.

Question 119. You Need To See The Last Fifteen Lines Of The Files Dog, Cat And Horse. What Command Should You Use?


Answer :

The tail utility displays the end of a file. The -15 tells tail to display the last fifteen lines of each specified file.

Question 120. What Is The Real Mean Of Dhcp?


Answer :

Dynamic addressing simplifies network administration because the s/w keeps track of IP addresses rather than requiring an administrator to manage the task. That means new computer can be added to the network without any risk of manually assigning unique IP address.

Question 121. What Is Nfs? What Is Its Job?


Answer :

NFS stands for Network File System. NFS enables filesystems physically residing on one computer system to be used by other computers in the network, appearing to users on the remote host as just another local disk.

Question 122. In Linux Os, What Is The File Server?


Answer :

The file server is a machine that shares its disk storage and files with other machines on the network.

Question 123. What Are The Techniques That You Use To Handle The Collisions In Hash Tables?


Answer :

We can use two major techniques to handle the collisions. They are open addressing and separate chaining. In open addressing, data items that hash to a full array cell are placed in another cell in the array. In separate chaining, each array element consists of a linked list. All data items hashing to a given array index are inserted in that list.

Question 124. What Is The Major Advantage Of A Hash Table?


Answer :

The major advantage of a hash table is its speed. Because the hash function is to take a range of key values and transform them into index values in such a way that the key values are distributed randomly across all the indices of a hash table.

Question 125. What Is Write Command?


Answer :

The write command enables you to write an actual message on the other terminal online. You have to issue the write command with the login ID of the user with whom you want to communicate. The write command informs the user at the other end that there is a message from another user. write pastes that message onto the other user’s terminal if their terminal’s write permissions are set. Even if they are in the middle of an edit session, write overwrites whatever is on the screen. The edit session contents are not corrupted; you can restore the original screen on most editors with Ctrl-L. write is mostly used for one-way communication, but you can have an actual conversation as well.

Question 126. Why You Shouldn't Use The Root Login?


Answer :

The root login does not restrict you in any way. When you log in as root, you become the system. The root login is also sometimes called the super user login. With one simple command, issued either on purpose or by accident, you can destroy your entire Linux installation. For this reason, use the root login only when necessary. Avoid experimenting with commands when you do log in as root.

Question 127. How Big Should The Swap-space Partition Be?


Answer :

Swap space is used as an extension of physical RAM, the more RAM you have, the less swap space is required. You can add the amount of swap space and the amount of RAM together to get the amount of RAM Linux will use. For example, if you have 8MB of RAM on your machine’s motherboard, and a 16MB swap-space partition, Linux will behave as though you had 24MB of total RAM.

Question 128. Which Field Is Used To Define The User's Default Shell?


Answer :

command-The last field, called either command or login command, is used to specify what shell the user will use when he logs in.

Question 129. When You Create A New Partition, You Need To Designate Its Size By Defining The Starting And Ending?


Answer :

cylinders-When creating a new partition you must first specify its starting cylinder. You can then either specify its size or the ending cylinder.

Question 130. What Can You Type At A Command Line To Determine Which Shell You Are Using?


Answer :

echo $SHELL-The name and path to the shell you are using is saved to the SHELL environment variable. You can then use the echo command to print out the value of any variable by preceding the variable’s name with $. Therefore, typing echo $SHELL will display the name of your shell.

Question 131. In Order To Display The Last Five Commands You Have Entered Using The Fc Command, You Would Type?


Answer :

fc -5-The fc command can be used to edit or rerun commands you have previously entered. To specify the number of commands to list, use -n.

Question 132. What Command Should You Use To Check Your File System?


Answer :

fsck-The fsck command is used to check the integrity of the file system on your disk.

Question 133. What File Defines The Levels Of Messages Written To System Log Files?


Answer :

kernel.h-To determine the various levels of messages that are defined on your system, examine the kernel.h file.

Question 134. What Account Is Created When You Install Linux?


Answer :

root-Whenever you install Linux, only one user account is created. This is the super user account also known as root.

Question 135. What Daemon Is Responsible For Tracking Events On Your System?


Answer :

Syslogd-The syslogd daemon is responsible for tracking system information and saving it to specified log flies.

Question 136. Where Standard Output Is Usually Directed?


Answer :

To the screen or display-By default, your shell directs standard output to your screen or display.

Question 137. What Utility Can You Use To Show A Dynamic Listing Of Running Processes?


Answer :

Top-The top utility shows a listing of all running processes that is dynamically updated.

Question 138. Who Owns The Data Dictionary?


Answer :

The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created.

Question 139. What Command Can You Use To Review Boot Messages?


Answer :

dmesg
The dmesg command displays the system messages contained in the kernel ring buffer.
By using this command immediately after booting your computer, you will see the boot messages.

Question 140. What Is The Minimum Number Of Partitions You Need To Install Linux?


Answer :

Linux can be installed on two partitions, one as / which will contain all files and a swap partition.

Question 141. What Is The Name And Path Of The Main System Log?


Answer :

/var/log/messages
By default, the main system log is /var/log/messages.

Question 142. What Utility Can You Use To Automate Rotation Of Logs?


Answer :

logrotate
The logrotate command can be used to automate the rotation of various logs.

Question 143. What Key Combination Can You Press To Suspend A Running Job And Place It In The Background?


Answer :

ctrl-z
Using ctrl-z will suspend a job and put it in the background.

Question 144. What Command Is Used To Remove The Password Assigned To A Group?


Answer :

gpasswd -r
The gpasswd command is used to change the password assigned to a group. Use the -r option to remove the password from the group.

Question 145. In Order To Improve Your System's Security You Decide To Implement Shadow Passwords. What Command Should You Use?


Answer :

The pwconv command creates the file /etc/shadow and changes all passwords to 'x' in the /etc/passwd file.

Question 146. What Command Should You Use To Check The Number Of Files And Disk Space Used And Each User's Defined Quotas?


Answer :

The repquota command is used to get a report on the status of the quotas you have set including the amount of allocated space and amount of used space.

Question 147. You Have A File Called Phonenos That Is Almost 4,000 Lines Long. What Text Filter Can You Use To Split It Into Four Pieces Each 1,000 Lines Long?


Answer :

The split text filter will divide files into equally sized pieces. The default length of each piece is 1,000 lines.

Question 148. You Want To Create A Compressed Backup Of The Users' Home Directories. What Utility Should You Use?


Answer :

You can use the z modifier with tar to compress your archive at the same time as creating it.

Question 149. You Wish To Restore The File Memo.ben Which Was Backed Up In The Tarfile Mybackup.tar. What Command Should You Type?


Answer :

This command uses the x switch to extract a file. Here the file memo.ben will be restored from the tarfile MyBackup.tar.

Question 150. Where Is Standard Output Usually Directed?


Answer :

By default, your shell directs standard output to your screen or display.

Popular posts from this blog

script and validation for the lvm

Important concepts and bits

shell script to create and extending the volume