Check the list of 50 Linux Interview Questions and Answers for experienced person.

Q. How to setup a password that never expire?

A. chage -M -1 [username] Here, -1 will set for never expire

Q. User info saved in /etc/passwd or /etc/shadow

A. /etc/shadow is only accessible by root so this is secure and /etc/passwd can be accessible by other application as well.

Q. To run the process in background?

A. “nohub” command will be used for process execution in background you can execute a command in the background by using the “&” symbol at the end of the command

Q. What is debug mod in shell scripting

A. In shell scripting, “debug mode” typically refers to a state in which you enable debugging features to help you identify and troubleshoot  issues in your scripts.

Using the -x Option: You can add the -x option to the shebang line (the first line of your script) or   directly in the script to enable verbose debugging output. 

Q. How can we collect CPU usage, memory usage and disk usage from diff Linux servers?

A. In windows: – task manager

   In Linux: – Using top command, iostat Command for Average Usage, sar Command to Show CPU Utilization, netstat command to check system network information.

Q. To list of all files open by particular PID (process id)

A. lsof -p PID   Here, lsof = list of all files

Q. how to check health of your linux server?

A. using vmstat command.

It can be run by typing ‘vmstat 5 ‘ which will display one line of data every 5 seconds until it is cancelled. I recommend that you run vmstat for a 24-hour period and save the information into a file. This can be done by typing ‘vmstat 1200 > /tmp/vmstat.

Q. We are unable to unmount the file system. What are the reasons behind it?

A. 1. You are in the same directory   -pwd

  2. Some users are present in the directory and using its contents.   -Fuser -cu /dev/sda

  3. Some of the files are open in the directory     -lsof /dev/sda7

Q. What could be the reason if server takes more time after reboot?

A. File system got corrupt and its ext2, ext2 is not having its journaling feature.

Q. Unit Testing in application?

A. Mokito in java, npm for node js

Q. Run levels in linux?

A. Run levels are a way to describe the state or mode in which the operating system operates.

Run Level 0: Halt or Shutdown. The system is shutting down, and all processes are stopped.

This is used to power off the system.

Run Level 1: Single-User Mode. The system boots into a single-user, text-only mode, typically used for system maintenance or recovery. In some systems, this mode is referred to as “rescue mode.”

Run Level 2: Multi-User Mode without Networking. The system boots into a multi-user mode without networking services. User-level services are started.

Run Level 3: Multi-User Mode with Networking. This is the standard multi-user mode with networking services. It’s the level where you typically have a full login prompt and access to all services.

Run Level 4: Not typically used. This run level is available for system-specific purposes and is not commonly used for user-defined configurations.

Run Level 5: Graphical Mode. This run level is used for systems with a graphical user interface (GUI). In this mode, a graphical login manager (such as GDM or KDM) is started.

Run Level 6: Reboot. The system reboots, and it is similar to Run Level 0 in that it brings down all running processes and restarts the system.

100 Blog Ideas and Topics for Bloggers

Q. We are trying to create the file under any partition but we are getting permission denied alert. What could be the reason? However, no space issue and no permission issue?

A. I am running out of Inode.

Sometimes df command shows there is enough free space but system claims file system is full. So, we need to check the Inode which identifies the file and its attributes on the file system using the command:

 df -i

df -i  /ftpusers/

If 100% of Inode are used then find unwanted files and we will move to some other location.

Find unwanted large files and move to other location or delete it.

Q. How to check Kernel routing table information?

A. Three commands: –

route -n

Ip route

netstat -rn

Q. Umask value for root user?

A. The default umask (user file-creation mode mask) for the root user is 022 result into default directory permissions are 755 and default file permissions are 644.

Q. How to check open ports in linux?

A. Another option is to use the netstat command to list all ports in Linux. Apart from “ss / netstat “one can use the” lsof “command to list open files and ports on Linux based system.

Q. What is the use swap memory in Linux?

A. Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory is moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM.

Q. How to set sticky bit and what is the difference b/w smalls and capital S?

A. Sticky bit is special permission applied on file or directory, then only root or owner

of file or directory can delete it, even if others have full permission.

Chmod o + t /opt/dump/

Chmod t /opt/dump/

Chmod 1757 /opt/dump

s: – setuid and executable 

S: – setuid and non-executable

 Q. Which file is used to specify the default gateway?

A. . /etc/sysconfig/network

Q. What is NFS? How to configure it? What port number it does use?

A. NFS allows a system to share directories and files with others over a network

Port number 2049. We have to configure both nfs server and client both

For NFS Server: –

  1. Install nfs util package.
  2. Create directory on partition and add some data on it.
  3. Export the directory by editing /etc/export/ file and using exportfs command
  4. Restart the service and make is permanent in /etc/fstab file

For NFS Client: –

  1. Check and install NFS package if not installed.
  2. Start the NFS service.
  3. Check which directory is exported for this machine using showmount command
  4. Make the directory and mount the nfs directory over it
  5. Add some data on it and check if same is updated on server side.

Q. What is the location of NFS shared info?

A. . /etc/fstab

Q. What is nice value and how to set it up?

A. This is used to set the priority for the execution.

nice -n command

Q. Difference between ftp and tftp?

A. FTP port number 20,21 and tftp port number 69

FTP is based on TCP and tftp is based on UDP.

FTP software is heavier and tftp is light weight.

Authentication is required in case of FTP and not required in tftp case.

Q. How to extend the file system in Linux?

A. using logical volume Management

Command: – lvextend and resize2fs

lvextend -L 1G /dev/data_vg01/data_lv01

Q. How will you rollback the packages after patching?

A. yum install vsftpd

Yum history

Yum history info 8

Yum history undo 8

How to improve speaking English Skills

Q. What is rsync command?

A. rsync command is used to backing up or mirroring a directory

rsync <option> <encryption> <source dir.> <destination Ip><location of destination directory>

Q. How to set numbering of lines for file using vi editor?

A. :se nu

Q. Difference between soft link and hard link?

A. soft link can be created across the partition but hard link cannot be created across the partition.

Inode number of source and link file is different but same in hard link.

Soft link is short cut file and hard link is backup file.

If original file is deleted then link is broken and data is lost but

if original file is deleted then also link contain data

Q. Can we create the SOFT link across the partition? (yes/No). Please describe your answer?

A. Yes, we can create softlink across the partition because it is a short cut file and Inode number of source and link file is different.

Q. How to check if any particular port is listening or not?

A. using netstat command

Netstat -anp | grep 80

Q. What is difference between du and df command?

Du: – disk usage

Df: – disk free

Du: – checks how much disk space being used by these files.

Df: – How much free disk space do I have.

Q. What is booting process of Linux?

A. Start with BIOS. Checks the bios and search for the boot loader and execute MBR. Select the kernel images if multiple has been installed. Mount the file system.

Q. RPM vs Yum

A. Redhat Package Manager and YellowDog Updated Modified

Q. Cronjob can be schedule for 2 sec?

A. No Cronjob support from 60 sec or 1 min.

Q. Which command is used to see the memory?

A. using free -m command and free -g command

Q. How to delete the command which is older than 30 days?

A. using find command. Find from directory with name which are 30 days older and delete it.

Q. User is running ls-l command in server, but he is not getting any output. What could be the issue?

A. It means disk is having some issue, might be file system got corrupt.

Fsck: – file system check command

Q. TCP vs UDP?

A. Transmission Control Protocol (TCP) and User Datagram Protocol (UDP)

Secure vs insecure

Connection-oriented vs connection-less

Slow vs fast

Three-way handshaking vs no handshaking

Advance error checking vs basic error checking

FTP, http, smtp VS DHCP, DNS, SNMP, RIP, tftp

Q. Normal user is trying to do telnet to another server, but it’s getting timeout. What could be the reason?

A. Server is not up

Firewall is blocking

There is no network route to that destination

Q. What is RAID?

A. Redundant Array of Independent Disk.

Raid-0: – Two disks A1 in one disk and A2 in another disk, A3 in one disk and

A4 in other disk like that it will go.

Raid-1: – two disks. A1, A2, A3, A4 will be both the disks at the same time

Raid -2 Not in use

Raid -3: – Four disk: – A1 in one disk, A2 in second disk, A3 in third disk and parity in fourth disk. This is good for backup point of view.

Raid-4 is same like Raid-3

Raid-5: – Four disks: – Data in blocks with parity in all four disks so data and parity will be available in all four disks. Good for backup of point of view

Raid-6: – Five Disk. same like Raid-5 with two parities in all blocks. This is last raid level and very good for backup and data availability point of view.

Q. Which command is used to list system summary information and current utilisation?

A.  #top command

Q. To display process details of specific user?

A. top -u username

Q. How to kill the process using top command?

A. Using top -kill command

Q. How to troubleshoot network issue?

Using tcpdump command: – It will capture the packets on particular network interface.

Q. How to diagnose performance issue with storage devices?

A. Using iostat command: – Input Output statistics.

Used to monitor the CPU Device, network, report.

Q. How to see the Kernel routing table?

A. netstat -r command

Leave a Reply

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