1. Name a service that you should disable (which acts both as Web and FTP Server) on a Linux Server.
The finger service should be disabled because a remote user can get important information about the system by using that command.
2. How shadow passwords are given by in Linux?
pwconv command is used for giving shadow passwords. Shadow passwords are given for better system security. The pwconv command creates the file /etc/shadow and changes all passwords to ‘x’ in the /etc/passwd file.
First, entries in the shadowed file which don’t exist in the main file are removed. Then, shadowed entries which don’t have `x’ as the password in the main file are updated. Any missing shadowed entries are added. Finally, passwords in the main file are replaced with `x’. These programs can be used for initial conversion as well to update the shadowed file if the main file is edited by hand.
3. What command should you use to check the number of files and disk space used by each user’s defined quotas?
The command ‘repquota’ comes to rescue here. Command repquota summaries quotas for a file system.
4. What are the different layers of Linux?
Hardware’s – Innermost layer consists of physical devices like RAM, CPU etc. There might be driver software to communicate with devices in some OS.
Kernel – Kernel is a heart of an OS with hides complexities of the underlying hardware and provides a high-level abstraction to upper layers. There are different types of kernels like a microkernel, Monolithic Kernel etc. Linux kernel is a Monolithic type.
Shell – Shell is a program running on top of Kernel, which acts as a primary method of interaction between user and kernel. Simply saying it is a program that can run other programs. Nowadays GUI replaces shell to a large extent. Shell accepts commands and passes it for execution.
Utility Programs(Utilities) – These programs or software running on a top layer of OS help user for day to day generic activities like schedule a cron job or a specific task like create text documents.
5. What is a pipeline operator in Linux?
Pipeline operator in Linux is used to redirect the output of one program or command to another program/command for further processing. Usually termed as redirection. Vertical bars,’|’ (“pipes” in common Unix verbiage) are used for this. For example, ls -l | grep key, will redirect the output of ls -l command to grep key command
6. What is a process in a Linux context?
A process can only be created by another process. We refer to the creating process as the parent and the created process as the child. The parent process spawns one or more child processes. The spawning of a process can be accomplished in one of several ways. Each requires a system call (function call) to the Linux kernel. These function calls are fork(), vfork(), clone(), wait(), and exec().
7. What is sed command?
This is the popular Linux interview questions asked in an interview. Sed is a stream editor. A stream editor is a program that takes a stream of text and modifies it. With sed, you specify a regular expression which represents a pattern of what you want to replace. The generic form of a sed command is sed ‘s/pattern/replacement/’ filename.
8. What is the difference between Hard Link and Soft Link?
A soft link(Symbolic Link) points to another file by name. As it just contains a name, that name does not actually have to exist or exist on a different file system. If you replace the file or change file content without changing a name, then the link still contains the same name and points to that file. A hard link points to the file by inode number. A file should actually exist in the same file system. A file will only be deleted from disk when the last link to its inode is removed.
9. What shell does a Linux Administrator assign to a POP3 mail-only account?
POP3 mail only account is assigned to the /bin/false shell. However, assigning bash shell to a POP3 mail only gives user login access, which is avoided. /bin/nologin 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 for the security of the shells.
POP3 is basically used for downloading mail to mail program. So for illegal downloading of emails on the shell, this account is assigned to the /bin/false shell or /bin/nologin. These both shells are same as they both do the same work of rejecting the user login to the shell.
The main difference between these two shells is that false shell shows the incorrect code and any unusual coding when user login to it. But the nologin shell simply tells that no such account is available. So nologin shell is used often in Linux.
10. What is YUM?
YUM stands for Yellow dog Updater, Modified because it is based on YUP, the Yellow dog Updater. Where does the name Yellow dog come from? 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
11. What is the role of Kudzu?
Kudzu is used to detect new Hardware. RedHat Linux runs a hardware discoverer, named kudzu. When attempting to identify a serial port Kudzu resets the serial port. This stops the serial console. Kudzu is configured from the file/etc/sysconfig/kudzu.
Kudzu can be prevented from resetting hardware, by setting the configuration parameter SAFE to yes.
12. Explain /proc filesystem?
/proc is a virtual file system that provides detailed information about Linux kernel, hardware and running processes. Files under /proc directory named as Virtual files.
Since /proc contains virtual files, it is called virtual file system. These virtual files have unique qualities. Most of them are listed as zero bytes in size.
Virtual files such as /proc/interrupts, /proc/meminfo, /proc/mounts, and /proc/partitions provide an up-to-the-moment glimpse of the system’s hardware. Others: /proc/filesystems file and the /proc/sys/ directory provide system configuration information and interfaces.
13. How do you create ext4 file system?
# mke2fs -t ext4 /dev/DEV
14. How to Enable ACLs for /home partition?
Add following entry in /etc/fstab
LABEL=/home /home ext3 acl 1 2
Now remount /home partition with acl option.
mount -t ext3 -o acl /dev/sda3 /home
15. What is LILO?
LILO is Linux Loader is a boot loader for Linux. It is used to load Linux into the memory and start the Operating system. LILO can be configured to boot other operating systems as well. LILO is customizable, which means that if the default configuration is not correct, it can be changed. Config file for LILO is lilo.conf.
LILO is also a code snippet which loads PC BIOS into the main memory at the time of starting the computer system. It handles the following tasks :
1. Locating Linux kernel.
2. Identifying other supporting programs and loading them in the memory.
3. Starting Kernel.
The selection of various kernel images and boot routines is supported by LILO. For this reason, it is known as boot manager.
Also Read:- Top 10 Linux Interview Questions and Answers
16. How to check Memory stats and CPU stats as a Linux admin?
Using ‘free’ & ‘vmstat’ command, we can display the physical and virtual memory statistics, respectively. With the help of ‘sar’ command, we can see the CPU utilization & other stats.
17. How to check and verify the status of the bond interface?
Using the command ‘cat /proc/net/bonding/bond0,’ we can check what mode is enabled and what LAN cards are used in this bond. In this example, we have one one bond interface. However, we can have multiple bond interfaces like bond1, bond2 and so on.
18. How can you enhance the security of password file?
Linux keep user account information in a text file called /etc/passwd. This file also stores one way encrypted password. It is accessed by several tools to get user information, which is a security risk, so file need to ‘Word Readable.’ To minimize the security risk, you can use shadow password format. This method saves account information in regular file /etc/passwd.
However, the password is stored as a single “x” character (not actually stored in this file). A second file, called “/etc/shadow” contains encrypted password as well as other information such as account or password expiration values, etc. The /etc/shadow file is readable only by the root account and is therefore less of a security risk.
19. What command can you use to make a tape archive file of a /home directory and send it to the /dev/tape device?
The correct command is tar -cvf /dev/tape /home.
The -xvf option is used to extract files from an archive.Expert Linux Professionals are in much demand.
20. Suppose your FTP Server is hacked and the entire server needs to be restored. How should you restore the original kernel system files?
You cannot restore the entire operating system from tape backup device. So you should reinstall the core operating system, and then restore system configuration files and user data from tape backup device.
21. Why should you avoid Telnet to administer a Linux system remotely?
Telnet uses 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. In the case of Telnet, these include the passing of login credentials in plain text, which means anyone running a sniffer on your network can find the information he needs to take control of a device in a few seconds by eavesdropping on a Telnet login session.
22. What is cat command in Linux?
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 requirements.txt
23. What is ps command in Linux?
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
24. What is top Command in Linux?
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.
25. What is netstat command in Linux?
netstat command in Linux shows the network status. This netstat command shows network ports in use and their incoming connections.
26. What is lsof command in Linux?
lsof command lists the open files associated with your application.
27. What does cd - command do?
cd- command go to the previous directory.
28. What does cd command do?
Go to $HOME directory
29. What does (cd dir && command) do?
cd dir && command goes to the dir, execute the command and return to the current directory.
30. What does pushd command do?
pushhd command put current dir on stack so you can pop back to it.
31. What is ls -lSr command?
ls - ISr command shows files by size, biggest file will be displayed last.
32. What is du -s * | sort -k1,1rn | head command used for?
This command shows top disk users in current dir.
33. What does this du -hs /home/* | sort -k1,1h command do?
This command sort path by easy to interpret disk usage.
34. What is df -h command?
This command show free space on mounted file systems.
35. What is df -i command?
df -i command shows free inodes on mounted filesystems.
36. What is fdisk -l command used for?
fdisk -I command show disks partitions sizes and types (run as root).
37. How do you kill program using one port in Linux?
Use this command to kills the program using one port: sudo fuser -k 8000/tcp
38. How do you get full path of a file in Linux?
Use this command: readlink -f file.txt
39. How do you find who is logged in?
Use this command to find who logged in: w
Also Read:- Top 20 Linux Interview Questions and Answers
40. How to copy text to clipboard?
Use this command: cat file.txt | xclip -selection clipboard
41. How do you check resources usage?
Use this command to check resource usage: /usr/bin/time -v ls
42. How do you combine two lines from two sorted files in Linux?
Use this command: comm file1 file2.
43. What is Puppet Server?
Puppet is an open-source & enterprise software for configuration management toll in UNIX like operating system. Puppet is an IT automation software that is used to push configuration to its clients (puppet agents) using code. Puppet code can do multiple tasks from installing new software to checking file permissions to updating user accounts.
44. What command is used to check the number of files, disk space and each user’s defined quota?
repquota command is used to check the status of the user’s quota along with the disk space and number of files used.
This command gives a summary of the user’s quota that how much space and files are left for the user. Each user has a defined quota in Linux. This is done mainly for the security as some users have only limited access to files. This provides a security to the files from unwanted access. The quota can be given to a single user or to a group of users.
45. 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 the messages and the script written by the user. By default, all scripts are saved in this file. This is the standard system log file, which contains messages from all system software, non-kernel boot issues, and messages that go to ‘dmesg’. dmesg is a system file that is written upon system boot.
50. You have lots of running jobs, how would you remove all the running processes, without restarting the machine?
The Linux command ‘disown -r’ will remove all the running Processes.
51. Who own the data dictionary?
The user ‘SYS’ owns the data dictionary. Users ‘SYS’ and ‘SYSEM are created by default, automatically.
52. What is Linux?
Linux is an operating system based on UNIX and was first introduced by Linus Torvalds. It is based on the Linux Kernel and can run on different hardware platforms manufactured by Intel, MIPS, HP, IBM, SPARC, and Motorola. Another popular element in Linux is its mascot, a penguin figure named Tux.
53. 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.
54. 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.
55. 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.
56. 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.
57. 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.
58. 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.
59. 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.
60. 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.
Also Read:- Top 30 Linux Interview Questions and Answers
Follow Knowledge Guru on Twitter, Facebook, LinkedIn, Reddit, Mix, Pinterest, be updated with latest news, Stay in the know with what's happening in the tech world. Get the best of news stories and information about “Innovation & Tech, Business, Startups, Latest News, Photography and trending”. Subscribe to Knowledge Guru Newsletters. For more details email us at email@example.com