Basic Linux Administration Questions
What is Linux?
Answer: Linux is an open-source Unix-like operating system kernel created by Linus Torvalds. It is widely used for its stability, security, and flexibility across various devices and environments.
What are the basic components of Linux?
Answer: The basic components of Linux include the kernel, system libraries, system utilities, and application programs.
Explain the Linux file system hierarchy.
Answer: The Linux file system hierarchy starts with the root directory
/. Common directories include/binfor binaries,/etcfor configuration files,/homefor user directories,/varfor variable files, and/tmpfor temporary files.What is a Linux shell? Answer: A Linux shell is a command-line interpreter that provides a user interface for the Linux operating system. Examples include Bash, Zsh, and Ksh.
How do you check the current kernel version? Answer: Use the
uname -rcommand to check the current kernel version.What is a package manager in Linux? Answer: A package manager is a tool that automates the process of installing, updating, and removing software packages. Examples include
aptfor Debian-based systems andyumfor Red Hat-based systems.How do you update a Linux system? Answer: On Debian-based systems, use
sudo apt updatefollowed bysudo apt upgrade. On Red Hat-based systems, usesudo yum update.What are symbolic links in Linux? Answer: Symbolic links are pointers to files or directories. They are created using the
ln -scommand and allow multiple paths to refer to the same file or directory.Explain the difference between hard links and soft links. Answer: Hard links point directly to the inode of a file, whereas soft links (or symbolic links) point to the file name. Hard links cannot link directories and cannot span file systems, while soft links can.
How do you list files in a directory? Answer: Use the
lscommand to list files in a directory. Options likels -lprovide detailed information, andls -aincludes hidden files.
Intermediate Linux Administration Questions
What is the purpose of the
sudocommand? Answer: Thesudocommand allows a permitted user to execute a command as the superuser or another user, as specified by the security policy.How do you manage services in Linux? Answer: Use
systemctlfor systemd-based systems to start, stop, enable, or disable services. For example,sudo systemctl start <service>.How do you view running processes in Linux? Answer: Use the
ps,top, orhtopcommands to view running processes.What is a cron job? Answer: A cron job is a scheduled task that runs at specified intervals using the
crondaemon. Jobs are defined in the crontab file.How do you edit the crontab file? Answer: Use
crontab -eto edit the crontab file for the current user.What is a Linux daemon? Answer: A daemon is a background process that runs continuously and typically handles system-level tasks.
How do you check disk usage in Linux? Answer: Use the
dfcommand to check disk space usage and theducommand to check directory space usage.What is swap space? Answer: Swap space is a dedicated area on disk used to extend the amount of virtual memory available by swapping out inactive pages from RAM.
How do you add a new user in Linux? Answer: Use the
useraddcommand to add a new user. For example,sudo useradd username.What is the
chowncommand used for? Answer: Thechowncommand is used to change the ownership of files or directories. For example,sudo chown user:group file.
Advanced Linux Administration Questions
Explain the difference between
apt-getandapt. Answer:aptis a newer command-line interface that includes some of the functionalities ofapt-getalong with additional features and better usability.What is the purpose of the
/etc/fstabfile? Answer: The/etc/fstabfile defines how disk partitions, devices, and other file systems are mounted at boot time.How do you mount a filesystem? Answer: Use the
mountcommand. For example,sudo mount /dev/sda1 /mntmounts the/dev/sda1partition to the/mntdirectory.What is the difference between
iptablesandfirewalld? Answer:iptablesis a utility for configuring Linux kernel firewall rules.firewalldis a dynamic firewall management tool with D-Bus interface toiptables.How do you configure network interfaces in Linux? Answer: Network interfaces can be configured using the
/etc/network/interfacesfile on Debian-based systems or the/etc/sysconfig/network-scripts/directory on Red Hat-based systems. NetworkManager can also be used.What is SELinux? Answer: SELinux (Security-Enhanced Linux) is a security architecture for Linux systems that provides access control policies.
How do you manage SELinux policies? Answer: Use commands like
setenforceto change enforcement modes andsemanageto manage policies.What is LVM? Answer: LVM (Logical Volume Manager) is a system for managing logical volumes, or flexible disk space, on Linux systems.
How do you create a new logical volume in LVM? Answer: Use
lvcreate. For example,sudo lvcreate -n lv_name -L 10G vg_namecreates a 10GB logical volume.What is a Linux kernel module? Answer: A kernel module is a piece of code that can be loaded into the kernel to extend its functionality. Modules can be loaded with
modprobeand listed withlsmod.
Expert Linux Administration Questions
What is the difference between
ext4andxfs? Answer:ext4is a widely used file system with good performance and reliability for general use.xfsis designed for high-performance operations and scalability, particularly suitable for large files and high-performance applications.How do you check and repair a filesystem? Answer: Use
fsckto check and repair filesystems. For example,sudo fsck /dev/sda1.What is the purpose of the
journalctlcommand? Answer:journalctlis used to query and display messages from the journal, which is the logging system used bysystemd.How do you manage user groups in Linux? Answer: Use commands like
groupaddto create groups,usermod -aGto add users to groups, andgroupdelto delete groups.What is the
sshcommand used for? Answer: Thesshcommand is used to securely connect to remote machines over the SSH protocol. For example,ssh user@hostname.How do you configure SSH key-based authentication? Answer: Generate a key pair using
ssh-keygen, then copy the public key to the remote machine usingssh-copy-id user@hostnameor manually append it to the~/.ssh/authorized_keysfile on the remote machine.What is the purpose of the
/etc/hostsfile? Answer: The/etc/hostsfile maps hostnames to IP addresses, providing a way to resolve hostnames locally without querying DNS.How do you limit resource usage for users in Linux? Answer: Use
ulimitto set user-level resource limits andcgroupsto control and limit resource usage on a system-wide basis.What is the
rsynccommand used for? Answer:rsyncis a fast and versatile file copying tool used to synchronize files and directories between two locations over a network or locally.Explain the purpose of the
grepcommand. Answer:grepsearches for patterns within files and outputs the matching lines. For example,grep "pattern" file.txt.
Specialized Linux Administration Questions
What is a kernel panic? Answer: A kernel panic is a safety measure taken by an operating system's kernel upon detecting an internal fatal error from which it cannot safely recover.
How do you monitor system performance in Linux? Answer: Use tools like
top,htop,vmstat,iostat,sar, andfreeto monitor various aspects of system performance.What is the purpose of
strace? Answer:straceis a diagnostic tool to monitor and debug the interactions between user-space programs and the kernel by tracing system calls.How do you configure a firewall using
iptables? Answer: Useiptablescommands to define rules. For example,iptables -A INPUT -p tcp --dport 22 -j ACCEPTallows SSH connections.What is NFS, and how do you use it? Answer: NFS (Network File System) allows file systems to be shared across a network. Use
exportfson the server to share directories andmount -t nfson the client to mount them.How do you set up a basic web server using Apache? Answer: Install Apache using a package manager (
sudo apt install apache2), start the service (sudo systemctl start apache2), and place your web files in the/var/www/htmldirectory.What is a runlevel in Linux? Answer: Runlevels are predefined states of the system, each associated with a certain set of services. Modern
systemdsystems use targets instead of runlevels.How do you change the hostname in Linux? Answer: Use the
hostnamectlcommand, such assudo hostnamectl set-hostname newhostname, and update/etc/hostsif necessary.What is the
tarcommand used for? Answer:taris used to archive files into a single file (tarball) and extract files from an archive. For example,tar -cvf archive.tar directory/to create an archive.How do you automate repetitive tasks in Linux? Answer: Use shell scripts to automate repetitive tasks. Combine scripts with cron jobs to schedule them at specific intervals. Tools like Ansible, Puppet, or Chef can also be used for more complex automation.



