You are on page 1of 15

Linux Interview Q & A

1. What is Linux ?
 Linux is a Kernel and Kernel is a core level part of a Linux operating system and also
known as open source operating system (OS). An operating system is the software that
directly manages a system's hardware and resources, like CPU, memory, and storage.
The OS sits between applications and hardware and makes the connections between all
of your software and the physical resources that do the work

2. Linux and UNIX difference ?

Linux Unix

Development Linux is open source and is Unix was developed by AT&T Bell
1 developed by Linux community labs and is not open source.
of developers.

2 Cost Linux is free to use. Unix is licensed OS.

Supportd File Ext2, Ext3, Ext4, Jfs, ReiserFS, fs, gpfs, hfs, hfs+, ufs, xfs, zfs.
3
systems Xfs, Btrfs, FAT, FAT32, NTFS.

GUI Linux uses KDE and Gnome. Unix was initially a command based
4 Other GUI supported are LXDE, OS. Most of the unix distributions
Xfce, Unity, Mate. now have Gnome.

Usage Linux is used in wide varieties Unix is mostly used on servers,


5 from desktop, servers, workstations or PCs.
smartphones to mainframes.

Default Shell Bash (Bourne Again SHell) is Bourne Shell is default shell for
6
default shell for Linux. Unix.

Example Ubuntu, Debian GNU, Arch SunOS, Solaris, SCO UNIX, AIX,
7
Linux, etc. HP/UX, ULTRIX etc.
3. Linux and Windows difference?

LINUX WINDOWS
Linux is a open source While windows are not the
operating system open-source operating
system
Linux is free cost While it is costly
Its file name is case-sensitive While its file are case-insensitive
Linux is more efficient in While windows are less efficient
comparison of windows
Linux provides more security While it provides less security
than windows than Linux
Linux is widely used in hacking While windows does not provide
purpose-based system much efficiency in hacking

4. RHEL 7 AND RHEL 8 difference?

Features RHEL 8 RHEL 7

Default File System XFS XFS

Kernel Version 4.18.0-x 3.10.0-x

Kernel Code Name Ootpa Maipo

General Availability
2019-05-07 (Kernel Version 2014-06-09 (Kernel Version 3.10.0-
Date of First Major
4.18.0-80) 123)
Release
Using only Chronyd. The ntp
Network Time
implementation is not Using either ntp or chronyd.
Synchronization
supported in RHEL8.
Package management is done
Package/Software by DNF (YUMv4). Yum being used and it is based on
Management version 3.0.x
 - MySQL 8.0
   - MariaDB 10.3 MariaDB is the default
Default Database    - PostgreSQL 10 and implementation of MySQL in Red
PostgreSQL 9.6 Hat Enterprise Linux 7
   - Redis 5.0
ISO Image Types - Boot ISO
- Binary DVD ISO
Available for    - Binary DVD ISO
    - Boot ISO
installation    - Supplementary Binary DVD
   - Python 3
New version of    - Python 2 ( 2.7.X)
   - PHP 7.2
Programming    - PHP 5.4
   - Ruby 2.5
Languages    - Ruby 2.0.0
   - Node.js 10

5. Explain all Basic Commands?


 # touch - [To create a empty file]
 # mkdir - [To create a empty folder/directory]
 # rm - [To remove file]
 # rm -r - [To remove folder/directory]
 # cp -iv - [To copy and paste files]
 # cp -ivr - [To copy and paste folder/directory]
 # mv - [To move files and folders to any destination]
 # cd - [To change directory]
 # ls - [To show list of a folder/directory]

6. Explain Linux partitions?


 Partitioning also allows you to divide your hard drive into isolated
sections, where each sections behaves as its own hard drive.
There are lots of powerful tools for creating, removing, and
otherwise manipulating disk partitions in Linux.
There are 3 types of partitions:
 Primary partition - A primary partition can be used to boot an
operating system. [Max 4 partitions can be created]
 Extended partition – Container of the logical partition [Max 1
partition can be created]
 Logical partition – Logical drives hold files unrelated to the
operating system [Example – data, audio, video, etc.] [Max 60
partitions can be created]

7. Linux Installation steps?


 Boot the RHEL 8 installer.
 Select Time and Date.
 Select software to be installed.
 Choose disks/partitions for installation.
 Create your user ID and set the root password.
 Begin the installation.
 Reboot and eject installation media.

8. How many types of bootable files are in Linux and which?


 There are 2 types of Bootable file
* Vmlinz
* Initrd.img

9. What is swap partitions?


 Swap is a space on a disk that is used when the amount of physical
RAM memory is full. When a Linux system runs out of RAM,
inactive pages are moved from the RAM to the swap space.
10. What is LVM partition?
 Logical volume manager (LVM) was originally written in 1998. LVM
is an externally flexible disk manager tool. Allowing you to create
and resize logical disk volumes of multiple physical hard drive with
on downtime. Logical volume manager helps you manage your
storage better re-size volume dynamically

 Logical volume types.

* Physical volume [PV] = Partition marked as usable space for


logical volume.
* Volume Group [VG] = Collection of PV.
* Logical volume [LV] = A piece of a VG.

11. LVM Commands Explain?


 # fdisk - [To check hard disk Info.]
 # fdisk /dev/sda - [To create partition]
 # partx -u /dev/sda - [To update partition table]
 # pvcreate - [To create PV]
 # pvdisplay - [To display PV]
 # vgcreate - [To create VG]
 # vgdisplay - [To display VG]
 # lvcreate - [To create LV]
 # lvdisplay - [To display LV]
12.How many types of Run-level and explain? (rhel6)

 There are 7 types of Run-levels in RHEL6.

Run
Mode Action
Level
0 Halt Shuts down system
1 Single-User Mode Used for Single-user mode
2 Multi-User Mode Used for Multi-user mode without Network Support
Multi-User Mode with
3 Used for Multi-user mode With Network Support
Networking
4 Undefined Unuse
5 X11 Used for Graphical mode
6 Reboot Reboots the system

13. How many types of targets in rhel7/8 and explain?

 There are 4 types of targets in rhel 7/8


* Multi-user.target –[It’s a multi user mode with network
support]
* Graphical.target -[Its used for Graphical mode]
* Emergency.target -[Its used for Troubleshooting ]
* Reescue.target -[Its used for high level Troubleshooting]
14. Explain Linux Booting Process?

 Steps of Booting Process


* Poweron
* POST - [Power on self test]
* BIOS - [Basic Input & Output Record]
* MBR – [Master Boot Loader]
* Kerenl – [Kernel Executes /etc/systemd]
* Systemd – [System will Executes
/etc/system/system/default.target]
* Target – [Bring state Defined in default target]

15. How many types of permission and which?

 There are 3 types of permission

 Effect on file
* Read (r) = Contents of the file can be readed.
* Write (w) = Contents of the file van be changed.
* Executed (x) = file can be executed as commands.

 Effect on directory
* Read (r) = The directory can be listed.
* Write (w) = To create or delete files.
* Executed (x) = The directory can be accessed.

 There are 2 methods to set permission.

 Symbolic method
* Read = r
* Write = w
* Executed = x
 Numeric method
* No permission = 0
* Executed = 1
* Write = 2
* Read = 4
16. How many types of special permission and which?

 There are 3 types of Special permission


* Set UID – SUID – [Used for User]
* Set GID – SGID – [Used for Group]
* Sticky bit – [Used for Other]

17. What is ACL Permission?


 Access control list (ACL) provides an additional, more flexible
permission mechanism for Linux system, It is designed to assist
with Linux file permission. ACL allows you to give permission for
user and groups. We can set up different permission’s sets for
different user and groups on the same directory or file.\

18. Linux File-system Difference (ext2,ext3,ext4,xfs)?

File system Version Journaling Size Limit FSCK


Ext2 RHEL 4 Not Support Up to 2 TB Slower than Ext3
Ext3 RHEL 5 Supported Up to 2 TB Faster than Ext2
Ext4 RHEL 6 Supported Up to 16 TB Faster than Ext3
Ext5 RHEL 7/8 Supported Up to 500 TB Faster than Ext4

19. How many types of files in Linux?

 There are 3 Types of files in Linux


* Regular file ( - )
* Directory file ( d )
* Special file ( :- )
 Special file has 5 types
* Link
* Block
* Device
* Socket
* Character
20. Hard link and Soft link Difference?
Comparison Hard link Soft link
Parameters
Inode number* Files that are hard linked Files that are soft linked
take the same inode number. take a different inode number.
Directories Hard links are not Soft links can be used for
allowed for directories. linking directories.

File system It cannot be used It can be used


across file systems. across file systems.
Original file’s If the original file is removed, the link If the original file is removed, the link
deletion will still work as it accesses the data will not work as it doesn’t access

Speed Hard links are comparatively faster. Soft links are comparatively slower.

21.What is Firewall? Types of Firewall?

 The firewall service uses a set of rules to control incoming network


traffic and define which traffics is to be blocked and which is to be
allowed to pass through the system.
Firewall is the new user land interface in RHEL 7/8. It replaces the
Iptables interface and connects to the net filter kernel code.

 There are 2 types of firewalls


* Software firewall
* Hardware firewall

22. Which command use to check server load?

 # uptime

23.Which command use to check RAM & Swap?

 # free
24.Which command use to check kernel version?

 # uname -r

25.Which command use to check server process?

 # ps -aux

26.Which command use to OS Version?

 # cat/etc/os-release
 # lsb release -a
Hostnamectl

27.Which command use to kill the process?

 # killall -9 < PID No. > -[ To kill process by PID No. ]


 # killall -9 < Process name > -[ To kill process by there name]

28.Which command use to create a backup?

 # tar -cvf < Path of backup file> < File name >

29.Which command use to login users on server?

 #  ssh <your username@host_ip_address>

30.IMAP & POP3 difference?


Post Office Protocol (POP3) Internet Message Access Protocol (IMAP)
* POP is a simple protocol that only * IMAP is much more advanced and
allows downloading messages from allows you the user to see all the
your Inbox to your local computer. folders on the mail server.
* The POP server listens on port 110, * he IMAP server listens on port 143,
and the POP with SSL secure and the IMAP with SSL secure
(POP3DS) server listens on port 995 (IMAPDS) server listens on port 993.
* In POP3 the mail can only be * Messages can be accessed across
accessed from a single device at a multiple devices
time.
* To read the mail it has to be * The mail content can be read
downloaded on the local system. partially before downloading.
* The user can not organize mails in * The user can organize the emails
the mailbox of the mail server. directly on the mail server.
* The user can not create, delete or * The user can create, delete or
rename email on the mail server. rename email on the mail server.
* A user can not search the content of * A user can search the content of
mail before downloading to the local mail for specific string before
system. downloading.

31.scp & rsync difference?

Scp rsync
Performance over scp is relatively less optimise rsync iscomparatively more
latency and speed optimise and speed

Interruption handling scp command line tool If the above rsync session itself gets
cannot resume aborted interrupted, you can resume it as
downloads from lost network many time as you want by typing
connections the same command. rsync will
automatically restart the transfer
where it left of

Command # scp -r < source> < # rsync -av < source > <
destination> destination>

32.What is LDAP?
 LDAP (Lightweight Directory Access Protocol) is an open and cross
platform protocol used for directory services authentication. LDAP
provides the communication language that applications use to
communicate with other directory services servers. Directory services
store the users, passwords, and computer accounts, and share that
information with other entities on the network.

33.What is NTP?

 NTP stands for Network Time Protocol. It is used to synchronize the time


on your Linux system with a centralized NTP server. A local NTP server
on the network can be synchronized with an external timing source to
keep all the servers in your organization in-sync with an accurate time.

34.What is SMTP/DNS/WEB apache/SSH server?

 SMPT
*  SMTP (Simple Mail Transfer Protocol) is essential if you want to use
email, so we’re going to look at how we can install and configure
mail server along with some other email-related protocols, like
Post Office Protocol (POP3) and Internet Message Access Protocol
(IMAP).
 DNS
* The Domain Name System (DNS) is the phonebook of the Internet.
Humans access information online through domain names, like
nytimes.com or espn.com. Web browsers interact through
Internet Protocol (IP) addresses. DNS translates domain names to
IP address so browsers can load Internet resources.
 WEB apache
* Apache is the most commonly used Web server on Linux systems.
Web servers are used to serve Web pages requested by client
computers. This configuration is termed LAMP (Linux, Apache,
MySQL and Perl/Python/PHP) and forms a powerful and robust
platform for the development and deployment of Web-based
applications.
 SSH
* Secure Shell (SSH) is a program for logging into
remote machine and for executing commands on a
remote machine. It is a replace to telnet protocol and
provides secure encrypted communication between
2 untracted hosts over the network. [PORT NO- 1024-
65536]

35.Root password break steps?

 Steps to break root password


* Restart the machine
* Press spacebar [Within 5 sec]
* Select first line & Press e
* Go to fourth line & Press end key
* Enter – rd.break
* Press ctrl + x [To start]
* mount -o remount,rw /sysroot [press enter]
* chroot /sysroot [press enter]
* passwd
* Enter new password
* Re-Enter new password
* touch /.autorelabel
* exit
* exit

36.ALL Port No. ?


Service Name Port no.
ftp-data 20
ftp 21
ssh 22
TELNET 23
LMTP 24
SMPT 25
DNS 53
DHCP 67
DHCP-CLIENT 68
TFTP 69
http 80
KERBEROS 88
https 443
SFTP 115
SAMBA 139
NTP 123
IMAP 143
IMAP3 220
IMAPS 993
POP2 109
POP3 110
POP3S 995
SQUID 3128
ISCSI 3260
NFS 2049
LDAP 389
LDAPS 636
NIS RANDOM
RLOGIN 513
RDP 3389
VNC 5900/5901
Portmapper 111

You might also like