1. What can you type at a command line to determine which shell you are using?

$ echo $SHELL

2. What command is used to remove the password assigned to a group?

$ gpasswd -r.

3. What are LVM1 and LVM2?

LVM1 and LVM2 are the versions of LVM.

LVM2 uses device mapper driver contained in 2.6 kernel version.

LVM 1 was included in the 2.4 series kernels.

4. What command should you use to check the number of files and disk space used and each users’s quota?

$ repquota

5. What is LVM?

LVM stands for Logical Volume Manager. LVM, is a storage management solution that allows administrators to divide hard drive space into physical volumes (PV), which can then be combined into logical volume groups (VG), which are then divided into logical volumes (LV) on which the filesystem and mount point are created.

6. What is the standard directory used to store html website files? 

The standard directory is /var/www/html.

7. What type of remote software can you use to encrypt communication but control your server?

SSH is a remote desktop software that lets you remotely control the Red Hat server using a command line but also encrypts the information across the Internet. SSH uses port 22, so you must open this port when you set up Red Hat.

8. When you install Apache, what is the default web port is used to server the web pages to public viewers?

Most web servers run on port 80, and Apache defaults to port 80 when you install the software. You can use an alternative port, but this forces the user to type a port into the browser when they access the website. The other popular port for web applications is port 8080.

9. What is the total number of primary partition you can have on your drive in Linux?

You can have four primary partitions in Linux.

10. What is Red Hat network?

A systems management platform providing lifecycle management of the operating system and applications.

  • Installing and provisioning new systems
  • Updating systems.
  • Managing configuration files.
  • Monitoring performance.

11. Which daemon tracks events on your system?

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

12. You are logged on as a regular user. Without logging off and logging on as root, you are required to create a new user account immediately. How would you do it?    

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

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

The main system log is ‘/var/log/message

14. What is BASH?

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

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

16. What is the maximum length for a file name in Linux

255 characters

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

SMTP          25
DNS            53
FTP             20 (data transfer) , 21 ( Connection established)
DHCP         67/UDP(dhcp server) , 68/UDP(dhcp client)
SSH            22
Squid         3128

18. How to check default route and routing table ?

Using the Commands ‘netstat -nr’ and ‘route -n’ we can see the default route and routing tables.

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

Use the Command ‘netstat –listen’ and ‘lsof -i’

20. How to upgrade Kernel in Linux ?

We should never upgrade Linux Kernel , always install the new New kernel using rpm command because upgrading a kenel can make your linux box in a unbootable state.

# rpm -ivh Kernel or # yum install kernel

21. How to add & change the Kernel parameters ?

To Set the kernel parameters in linux , first edit the file ‘/etc/sysctl.conf’ after making the changes save the file and run the command ‘sysctl -p’ , this command will make the changes permanently without rebooting the machine

22. What is load average in Linux ?

Load  Average is defined as the average sum of the number of process waiting in the run queue and number of process currently executing over the period of 1,5 and 15  minutes. Using the ‘top’ and ‘uptime’ command we find the load average of a Linux sever.

23. What does Sar provides and at which location Sar logs are stored ?

Sar Collect, report, or save system activity information. The default version of the sar command (CPU utilization report) might be one of the first facilities the  user  runs  to  begin system  activity investigation, because it monitors major system resources

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

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

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

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

27. How you can run an 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.

28. What is initrd ?

Initrd stands for initial ram disk , which contains the temporary root filesystem and necessary modules which helps in mounting the real root filesystem in read mode only.

29. What is Bootloader ?

Bootloader is a program that boots the operating system and decides from which kernel OS will boot.

30. How to check all the installed Kernel modules ?

Using the Command ‘lsmod’ we can see the installed kernel modules.

31. What is name of first process in linux ?

‘init’ is the first process in linux which is started by kernel and whose pid is 1.

32. When you try to boot a linux system, you receive a message that it cannot mount /home partition because of errors, while debugging, you found it occur due to data error. What can you do to fix the problem?

You can run e2fsck to recover from errors.

Eg : e2fsck /home

33. Which log file keeps track of all user logins and logouts?

/var/log/wtmp or /var/log/utmp file keeps track of all user logins and logouts.

Reading wtmp file : $ utmpdump /var/log/wtmp

34. Why should you periodically update the kernel and package versions?.

To enhance the security of system .

35. If a system shutdown abnormally, will fsck run on mount points?.

Yes as the partitions are not unmounted properly, so the fsck check will run.

36. Which necessary steps should be taken to enhance the security of server just after the initial installations?.

  • Kernel package should be upgraded to the latest version.
  • Unnecessary services and daemons should be disabled.
  • Set complex password policy.
  • Unnecessary ports should be disabled.

37. What are the basic components of Linux?

Linux has these components: kernel, shells and GUIs, system utilities and application program. What makes Linux productive over other operating system is that every perspective goes with additional features and all codes for these are downloadable for free.

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

39. How many primary partitions is possible on one drive?

There are a maximum of 4 primary partition possible on a drive.

40. How do you terminate an ongoing process?

Explain how every process in the system is identified by a unique process id or pid.Using the ‘kill’ command followed by pid terminates that process.

$ kill9 pid

41. What is NFS ?

NFS is Network File System (NFS) allows remote machine to mount file systems over a network and interact with those file systems as though they are mounted locally.

NFS uses 2049 TCP port by default.

42. What are configuration files of NFS server ?.

/etc/exports is the main configuration file.

43. How to list available nfs share on local machine & remote machine ?

showmount -e localhost: shows the available shares on your local machine
showmount -e <remote-server-ip or hostname>: lists the available shares at the remote server.

44. What is pNFS ?

Parallel NFS (pNFS) as part of the NFS v4.1 standard is available as of Red Hat Enterprise Linux 6.4. The pNFS architecture improves the scalability of NFS, with possible improvements to performance. That is, when a server implements pNFS as well, a client is able to access data through multiple servers concurrently. It supports three storage protocols or layouts: files, objects, and blocks.

45. What is the difference between Hard mount & Soft mount in nfs ? (imp Question must prep).

Soft Mount – When a program or application requests a file from the NFS filesystem, NFS client daemons will try to retrieve the data from the NFS server. But, if it doesn’t get any response from the NFS server (due to any crash or failure of NFS server), the NFS client will report an error to the process on the client machine requesting the file access. The advantage of this mechanism is “fast responsiveness” as it doesn’t wait for the NFS server to respond. But, the main disadvantage of this method is data corruption or loss of data. So, this is not a recommended option to use.

Hard Mount – NFS share using hard mount, it will repeatedly retry to contact the server. Once the server is back online the program will continue to execute undisturbed from the state where it was during server crash. We can use the mount option “intr” which allows NFS requests to be interrupted if the server goes down or cannot be reached. Hence the recommended settings are hard and intr options.

46. How to check nfs server version ?

‘nfsstat -o all’ , “rpcinfo -p localhost” command shows all information about active versions of NFS.


Linux Interview Questions

Leave a Reply

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