Linux?

Avatar utente

Topic Author
beatrice
co-admin
co-admin
Connesso: No
Messaggi: 81
Iscritto il: lun mar 23, 2020 10:58 pm

Linux?

Messaggio da beatrice »

Q.1) What’s Linux?
Linux is a Unix-based open source multitasking and multiuser computer operating system. It was created by Linus Torvalds and released on September 17, 1991.

It supports different hardware manufactured by Intel, HP, IBM, Cisco, Dell, Lenovo and Supermicro.

Q.2) What’s UNIX?
UNIX is a multitasking and multiuser proprietary computer operating system developed by Bell Labs Research Center and released in November 1971. It was later converted into different commercial versions.

Q.3) What’s Kernel?
Kernel is heart of the operating system. It is the main component of the Linux operating system (OS), and is the core interface between the computer’s hardware and its processes.

It manages resources between the hardware and processes by controlling them.

Q.4) What’s Shell or Bash?
Shell is a command-line interpreter that provides the interface between the user and the operating system.

Bash refers to the Bourne Again shell, which is the default shell used in Linux, but you can use other shells if you needed.

Q.5) What’s BIOS
BIOS refers to a Basic Input/Output System, is a firmware (Power-On Self-Test (POST)) used to perform hardware initialization during the boot process.

This became a legacy boot because the BIOS did not evolve and improve over time. Also, it has more serious limitations.

Q.6) What’s UEFI Boot?
UEFI stands for Universal Extended Firmware Interface, which replaces traditional BIOS in systems due to lack of improvement and limitations on it.

It uses the GUID Partition Table (GPT) and maintains a list of valid boot volumes called EFI Service Partitions.

During the POST process, the UEFI firmware scans all bootable storage devices attached to the system to find an EFI service partition to boot.

Q.7) What’s MBR?
MBR stands for Master Boot Record, which contains 512 bytes and details are below. Normally, the MBR detects a bootable device and loads the GRUB/GRUB2 boot loader into memory.

This contains three portions:

1st 446 bytes: Primary boot loader information
Next 64 bytes: Partition table information
Last 2 bytes: It perform mbr validation check
Q.8) What’s Bootloader?
The bootloader loads the “vmlinuz” kernel image file into memory and extracts the contents of the initrd/initramfs image file into a temporary, memory-based file system (tmpfs).

LILO: LILO stands for Linux Loader, is a boot loader for Linux and the default boot loader for most Linux distributions for years before GRUB was introduced.
GRUB: GRUB stands for GRand Unified Bootloader, is a boot loader that allows users to choose different operating systems when you have more than one OS on your computer. Additionally, it allows you to select a different kernel to boot the system.
GRUB2: GRUB2 stands for “GRand Unified Bootloader, Version 2”. GRUB1 is now considered legacy and has been replaced with GRUB2 in most modern distributions, mainly designed to provide flexibility and performance to today’s operating systems.
Q.9) What’s initrd?
initrd stands for Initial RAM Disk. This is an initial or temporary root file system that is loaded before the actual root file system is available.

For Initrd, a “ramdev” block device was created. This is a RAM based block device that uses memory instead of disks. It contains the image of a file system, so the driver must be compiled into the kernel to enable it.

Q.10) What’s initramfs?
initramfs stands for Initial RAM file system used on modern Linux operating systems. This is an initial or temporary root file system that is mounted before the actual root file system is available.

For initramfs, this is directly linked to “tmpfs”. tmpfs does not require a driver, it is always in the kernel, so no additional drivers and devices are needed.

Q.11) What is Runlevel in Linux?
A runlevel is one of the mode that a Unix-based operating system runs in.

The “/etc/inittab” file contains the default runlevel information for the SysVinit system, which is used to boot the Linux system into the specific runlevel.

Once the specified runlevel is identified, it starts all other processes and applications in the background according to the run level.

There are 7 different run levels in the Linux system for different purposes (run level 0-6). The details are given below.

Run Level Short Description
0, halt Halt System (To shut down the system)
1, S, single Single user mode
2 Basic multi user mode without NFS
3 Full Multi User with Network (text based)
4 Experimental (No User or Unused)
5 Multi user mode with Graphical User Interface
6, reboot To Reboot a System
Q.12) What are Target Units in Linux?
Systemd has a concept of targets, which serves a purpose like runlevels, but operates slightly differently. Each target is named instead of numbers and is intended to serve a specific purpose.

The “/etc/systemd/system/default.target” file contains the default target information for the systemd system, which is used to boot the system into the corresponding target.

Once the specified target is identified, it starts all other processes and applications in the background according to the target.

Below is the available target for Linux (there are seven targets from zero to six). The details are given below.

Target Units Short Description
runlevel0.target, poweroff.target, systemctl halt Halt System (Shut down and power off)
runlevel1.target, rescue.target Single User Mode
runlevel[234].target, multi-user.target Full Multi User with Network (text based)
runlevel5.target, graphical.target Multi user mode with Graphical User Interface
runlevel6.target, reboot.target, systemctl reboot Shut down and reboot the system
Q.13) What is Linux System Manager and How to Identify it?
System Manager is the first process started by the kernel during system boot.

It holds the process ID (PID) of 1. It will continue to run in the background until the system is shut down.

Below are three system administrators that are widely used in Linux.

System V (Sys V): System V (Sys V) is one of the first and traditional init system for Unix like operating system.
Upstart: Upstart is an event-based replacement for the /sbin/init daemon.
systemd: systemd is a new init system and system manager that has been adapted by most Linux distributions instead traditional SysVinit systems.
You can easily identify the system manager by running ps command on your system.

# ps -p1 | grep "init\|upstart\|systemd"
    1 ?        00:18:09 systemd

Q.14) What is a Command-line Interface (CLI) in Linux?
CLI stands for Command Line Interface. This is a text-based interface, called Linux Terminal, that allows the user to type in any Linux commands that need to be executed by the operating system.

CLI is very powerful and easy for NIX guys because most Linux server operating systems only runs with CLI.

Q.15) What is a Graphical User Interface (GUI) in Linux?
GUI refers to the graphical user interface. It’s like the Windows operating system, which comes with a graphical user interface where you can easily search and open any applications you need.

Linux operating systems offer a wide range of desktop environments (DE) such as GNOME, Cinnamon, KDE, XFCE, and Deepin.

Q.16) What’s Swap Space?
Swap space on Linux is used when the amount of physical memory (RAM) is filled. When the physical RAM is full, the inactive pages in the memory are moved to the swap space.

This enables the computer to run the application continuously, but is not considered a replacement for high RAM.

Swap space is located on hard drives, so it does not process a request like RAM.

You can identify the current swap space utility on Linux using the free command.

free -m

Navigate to the following articles to create swap space on Linux.

Q.17) What is FileSystem in Linux?
FS is short for file system, which is used to organize files on the system. On the other hand, the file system controls how data is stored and retrieved from disk.

Each file system has two control modules, one containing the file system information and the other containing the inode information.

Inode (metadata) contains information about individual files and directories (file name, file types, permissions, owner name, group name, size, timestamps, elimination time, hard link and soft link, location, etc.)

The inode number is also called the index number, which contains the above parameters.

Linux supports multiple file system types such as ext, ext2, ext3, ext4, hpfs, iso9660, JFS, minix, msdos, ncpfs nfs, ntfs, proc, Reiserfs, smb, sysv, umsdos, vfat, XFS, xiafs,.

Q.18) What is the Linux File system Hierarchy Standard (FHS)
File System Hierarchy Standard (FHS) Defines the structure of file systems on the Linux operating system.

Everything in Linux is a file, you can modify it whenever needed, but make sure you are making the right changes.

If you make a mistake, this can lead to other problems as well, if you make changes to the configuration file, take a backup, and it allows you to replace it if something goes wrong.

The root directory “/” is the primary directory of the entire Linux file system hierarchy, containing all other directories and files. Make a note / and the /root is different.

Immagine

Q.19) What’s Single User Mode?
Single user mode, also referred to as maintenance mode, allows a super user to recover/repair the system from problems that cannot be resolved in a multi-user environment or system boots, but does not function properly or you cannot log in to it.

It uses runlevel 1 in the SysVinit system whereas runlevel1.target or rescue.target in systemd system.

It only enable few services and minimal functionality to repair the system. This method is most useful if you want to run fsck to fix corrupted file systems or reset a forgotten root password or change the “/etc/fstab” file.

Q.20) What is a Process in Linux?
A process is a running instance of a program. The init or systemd is always the first process in the system and the ancestor of all other processes.

Q.21) What is a Process ID (PID) in Linux?
PID refers to a process ID, commonly used by most operating system kernel, such as Linux, Unix, MacOS, and Windows.

This is a unique ID that is automatically assigned to each process when it is created.

The default maximum value of PIDs is 32,768 on 32-bit systems, but can be set to any value up to 222 (approximately 4 million) on 64-bit systems.

Q.22) What is Parent Process (PPID) in Linux?
A parent process is a process that has created one or more child processes. Each child process is given a Parent Process ID (PPID), and the parent process kills the child when it completes the process.

Q.23) What is an Inode in Linux?
Inode is an index node or index number, is a data structure on a Linux file system that stores information about a file and directory.

File systems typically have two parts: metadata and real data.

Each file contains an inode that contains metadata about the file. Each file in the file system has a unique inode number. It is guaranteed that inode numbers are unique to a file system only.

Inode stores the following information about a file.

Size of the file
Device ID
User ID (UID)
Group ID (GID)
Information about permissions (read, write, execute, etc)
File access privileges (owner, group and others)
Time stamps information such as file access, file modification, file deletion and inode number change.
Information about soft links and hard links
Location of the file on the file system
Q.24) Purpose of /tmp Partition
The “/tmp” directory is a directory used to hold temporary files (or session files) when the application is running.

This is particularly useful in many user environments, where unprivileged users will have access to read/write data to /tmp.

It is linked to a special file system called tmpfs. This is a virtual file system and the operating system automatically loads the /tmp mount point when the system boots.

Temporary files are automatically deleted by the application when they are finished.

The /tmp directory is cleaned by default during system startup or reboot.

If you want to clean up the contents of the /tmp directory on Linux, go to the following articles.

Q.25) What is a Daemon in Linux?
The daemon is a program on a Unix-like operating system that runs in the background and has no interaction with the user.

For example, the daemon that handles the Apache web server functionality is httpd.

Question : 1) Which one is showing only hidden files ?
a) ls -l
b) ls -lh
c) ls -al
d) l. -lh

Answer : l. -lh
All the above commands listing files and folder and (ls -al) command showing all files included hidden files but (l. -lh) command showing only hidden files.

Question : 2) Which one is the correct syntax for Reverse RSYNC command ?
a) rsync -[Options] [Destination-Location] [Source-Location]
b) rsync -[Options] [Source-Location] [Destination-Location]
c) rsync .[Options] [Destination-Location] [Source-Location]
d) rsync [Options] [Source-Location] [Destination-Location]

Answer : rsync -[Options] [Destination-Location] [Source-Location]
Normally rsync command is used to sync the backup from local server to remote server but unfortunately you haven’t do that. That time the reverse rsync command is used to fetch the data from local server to remote server.

Question : 3) Which command is used to open the website in terminal ?
a) links
b) elinks
c) Both
d) Only elinks

Answer : Both
We can open the website in linux terminal using the above command but make sure the packages should be installed on your server.

Question : 4) Which command is used to open Postscript/pdf file in linux ?
a) gv
b) od
c) xdvi
d) xxd

Answer : gv
The gv command used to open the pdf file in terminal.

Question : 5) By default how many day’s systat config file keep the sa log files?
a) 5
b) 7
c) 12
d) 9

Question : 6) Where is the sa log file location on RHEL/CentOS/Fedora ?
a) /var/log/sysstat/
b) /var/log/sa
c) Both
d) Only /var/log/sysstat/

Answer : /var/log/sa

Question : 7) How to check service status in linux ?
a) service service-name status
b) /etc/init.d/service-name status
c) Both
d) Only /etc/init.d/service-name status

Answer : Both
The above both command is used to check the daemon stauts in linux.

Question : 8) Which command is clearly shows the open port and binded daemon details ?
a) netstat -vatn
b) netstat -vaun
c) netstat –listen
d) netstat -tulpn

Answer : netstat -tulpn
All the above command is used to check the open port in linux server but “option d” is clearly shows the exact results what we needed.

Question : 9) What is the use of Toggle SSH Session via SSH Escape Character ?
a) Open multiple terminal in single windows
b) One terminal to another terminal without entering password
c) One terminal to another terminal without logged out
d) b & c

Answer : b & c
If i use Toggle SSH session, we need to enter the password one time after that we can jump one terminal to another and return back previous terminal.

Question : 10) Where is mysql history file located ?
Answer : By default, the backup history file was stored or located under root directory. Now, i’m going to show the details here.

Output :
root@2daygeek [~]# find / -name ".mysql_history"
/root/.mysql_history

Question : 1) Which Command is used to create/add new user account in Linux ?
a) useradd [Option] [User Name]
b) adduser [Option] [User Name]
c) Both
d) Only – useradd [Option] [User Name]

Answer : Both, useradd is a system command to create new users in system & adduser is a perl script which uses useradd command in back-end to create the user account. This will differ based on linux distribution.

Question : 2) How many types of files available in Linux ?
a) 3
b) 5
c) 7
d) 8

Answer : 7 ,For more information about file types.

Question : 3) How many color of linux files is available ?
a) 3
b) 5
c) 7
d) 8

Answer : 7 ,For more information about color coding.

Question : 4) How many fields available in /etc/shadow file ?
a) 3
b) 5
c) 7
d) 8

Answer : 8 ,For more information about /etc/shadow file.

Question : 5) How many fields available in /etc/passwd file ?
a) 3
b) 5
c) 7
d) 8

Answer : 7 ,For more information about /etc/passwd file.

Question : 6) What is the root UID ?
a) 0
b) 1
c) 3
d) 5

Answer : 0 is Reserved UID for root.

Question : 7) How many UID Reserved for system users ?
a) 50 (0-49)
b) 49 (1-49)
c) 99 (1-99)
d) 100 (0-99)

Answer : 99 (1-99) is Reserved UID for system users.

Question : 8) How many UID Reserved for system accounts/groups ?
a) 50 (0-49)
b) 100 (0-99)
c) 499 (500-999)
d) 900 (100-999)

Answer : 900 (100-999) is Reserved UID for system accounts/groups.

Question : 9) How many sub fields available at password field in /etc/shadow file ?
a) 0
b) 1
c) 3
d) 5

Answer : 3

Question : 10) What kind of hashs used at password field in /etc/shadow file ?
a) hash_algorithm
b) hash_salt
c) hash_data
d) above all
e) a & b
f) b & c

Answer : above all Above three algorithm is used in password field.

Question : 1) Choose the Linux system booting process ?
a) BIOS,GRUB,MBR,Kernel,Init,Runlevel
b) MBR,BIOS,GRUB,Kernel,Init,Runlevel
c) BIOS,MBR,GRUB,Kernel,Init,Runlevel
d) GRUB,BIOS,Kernel,MBR,Init,Runlevel

Answer : c BIOS,MBR,GRUB,Kernel,Init,Runlevel

Question : 2) Which run-level is for production environment ?
a) 1
b) 2
c) 3
d) 5

Answer : 3 ,3 – Full multiuser mode.

Question : 3) How many run levels available in Linux ?
a) 0-6
b) 0-4
c) 0-5
d) 0-7

Answer : 0-6 ,
0 – halt
1 – Single user mode
2 – Multiuser, without NFS
3 – Full multiuser mode
4 – unused
5 – X11
6 – reboot

Question : 4) How to check default gateway ?
a) netstat -rn
b) route -n
c) a & b
d) Only b

Answer : a & b ,Both command used to check default gateway in Linux.

Output :
magesh@magesh-desktop:~/shell-script$ route -n
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
0.0.0.0        192.168.0.1    0.0.0.0        UG    0      0        0 eth0
192.168.0.0    0.0.0.0        255.255.255.0  U    1      0        0 eth0

magesh@magesh-desktop:~/shell-script$ netstat -rn
Kernel IP routing table
Destination    Gateway        Genmask        Flags  MSS Window  irtt Iface
0.0.0.0        192.168.0.1    0.0.0.0        UG        0 0          0 eth0
192.168.0.0    0.0.0.0        255.255.255.0  U        0 0          0 eth0
Question : 5) How to check number of CPU’s on your system ?
a) lscpu
b) top then press 1
c) a & b
d) a

Answer : a & b ,For more information about Hardware information & Top command.

Question : 6) How to check number of hard disk on your system ?
a) fdisk -l
b) fsck
c) e2fsck
d) fstab

Answer : fdisk -l It’s clearly shows how many physical hard disk available on your system.

Question : 7) Which one is count concurrent apache connection ?
a) ps -A | grep httpd | wc -l
b) ps -ef | grep http | wc -l
c) ps aux | grep httpd | wc -l
d) netstat -nt | grep :80 | wc -l

Answer : netstat -nt | grep :80 | wc -l , For more information about netstat command

Question : 8) How to check MySQL activity ?
a) watch -n 1 mysqladmin processlist
b) mysqladmin -u root -p processlist
c) watch -n1 mysqladmin proc stat
d) a,b & c

Answer : a, b & c We can check the MySQl activity using above three commands, For more details MySQL admin command & MySQL Monitoring command

Question : 9) How to check whether you are using LVM or normal partition ?
a) fdisk -l
b) lvdisplay
c) lvs
d) lvscan

Answer : a,b,c & d Above four commands used to check whether we are using LVM or normal partition but how we can check using fdisk -l, In fdisk -l output shows your partition id is 8e, Its LVM partition.

Question : 10) How you check server load on particular timing ?
a) top
b) sar -u
c) sar -u ALL
d) sar -P ALL

Answer : sar -u It clearly shows current date CPU load, For more details about SAR.