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
Also Read:- Top 10 Linux Interview Questions and Answers
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.
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
Also Read:- Top 20 Linux Interview Questions and Answers
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
40. How to copy text to clipboard?
Use this command: cat file.txt | xclip -selection clipboard
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