Interview Question & Answer — Linux-1
❓What is the boot process in Linux?
The Linux boot process is divided into six high-level stages:
- BIOS — Basic Input/Output System executes MBR
- MBR — Master Boot Record execute GRUB
- GRUB — Grand Unified Bootloader executes Kernel
- Kernel — Kernel executes /sbin/init
- Init — Init executes runlevel programs
- Runlevel — Runlevel programs are executed from /etc/rc.d/rc*.d/
buymeacoffee ☕ 👈 Click the link
❓How can you create a zero-size file in Linux?
Shell command $ touch filename results in a zero-byte file filename.
❓What are 𝘀𝗼𝗳𝘁 𝗹𝗶𝗻𝗸𝘀 and 𝗵𝗮𝗿𝗱 𝗹𝗶𝗻𝗸𝘀 in Linux? How do you create them? What are the differences between these two types of links?
A “soft link” takes more, as it has an inode, and file contents (the path to the target file) it also has the name in the directory.
Softlink 👈
A “hardlink” only exists in the name in a directory- and specifies the inode number of the file.
Hardlink 👈
ln [original filename] [link name] --> Hard link create
ln -s [original filename] [link name] --> Soft link create
Hardlink : Filename => Inode <= My hard link
Softlink : inode <===file name <==soft link
❓What is the first line typically written in a shell script? What is its meaning? What happens if this line is omitted, and how do you run the script in such a case?
It is the first line of the script that would dictate which program to use. The first line starts with the sequence of two characters #! that is called “shebang”. This is followed by the program that tells the operating system which interpreter to use to parse the rest of the file.
#!
just happens to be human readable, but that is not required.
❓How can you run a shell script in the background in Linux?
& Symbol
Another method to run a process in the background is by appending the ampersand symbol & to the command you execute.
script.sh &
command &
❓What is a 𝗰𝗿𝗼𝗻𝘁𝗮𝗯 in Linux? Explain how it works and how to configure and schedule a job using crontab.
Crontab, which is short for cron table, is a file containing the schedule of various cron entries that should be run at specified times.
Another way of describing crontab is as a utility that enables tasks to run automatically at regular intervals in the background by the cron daemon.
Crontab → Scheduling tasks to be executed sometime in the future.
Refer Crontab link
- Write a Script (Optional) This section explains how to create an example script.
- Create or Edit Crontab File. Open the crontab configuration file for the current user by entering the following command: crontab -e.
- Create the Cron Job.
- Output (Optional).
- Save.
- Check Active Cron Jobs.
❓How do you allow ports in Linux?
sudo ufw allow 53/tcp
❓How do you troubleshoot a remote server that is experiencing issues?
- Check if the Remote Desktop service is running on the server.
- Check if the server’s firewall is blocking Remote Desktop connections.
- Check if the server is configured to allow Remote Desktop connections.
- Check if the server’s network settings are correct.