Core Linux Concepts & Commands

How do you check the running processes and system resource usage?
Use top or htop for a dynamic view. ps aux for a snapshot.

How to find a file and search for text inside a file?
Find a file: find / -name "filename". Search text: grep "text" filename.

Explain the difference between kill and kill -9.
kill sends a TERM signal (graceful termination). kill -9 sends a KILL signal (forceful, immediate termination).

What is the purpose of the sudo command?
It allows a permitted user to execute a command as the superuser or another user, as defined by the security policy.

How do you check disk space and inode usage?
df -h for disk space. df -i for inode usage.

User & Permission Management

Where are user passwords stored, and what do the fields mean?
In /etc/shadow. Fields: username:encrypted password:last password change:min days:max days:warn days:inactive:expiry.

How to change file permissions and ownership?
Permissions: chmod 755 filename. Ownership: chown user:group filename.

What is the difference between su and sudo -i?
su switches to the root user, requiring the root password. sudo -i starts a root shell using your own user's sudo privileges.

Networking & Services

How to check listening ports and network connections?
ss -tuln or netstat -tuln.

How to start, stop, and check the status of a service?
systemctl start servicename, systemctl stop servicename, systemctl status servicename.

How to make a service start automatically at boot?
systemctl enable servicename.

What is the difference between a firewall and SELinux?
A firewall (e.g., firewalld, iptables) controls network access. SELinux controls what programs and users are allowed to do on the system (mandatory access control).

File Systems & Storage

How to check the size of a directory?
du -sh /path/to/directory.

What is LVM and why is it used?
Logical Volume Management. It allows flexible disk management, letting you resize, create, and manage storage volumes easily.

How to add a new disk to a Linux system?
Physically attach, fdisk/parted to partition, create a filesystem with mkfs, and mount it with mount. Add to /etc/fstab for permanence.

Troubleshooting & Performance

A server is running slow. What are the first commands you run?
top (check CPU/RAM), iostat (check disk I/O), vmstat (check system performance), df -h (check disk space).

How to view kernel and system logs?
Use journalctl (systemd) or check /var/log/messages and /var/log/syslog.

A user cannot delete a file, even with sudo rm. What could be the issue?
The file likely has the "immutable" attribute set. Check with lsattr and remove it with chattr -i filename.

Scripting & Automation

What is a shebang line (#!)?
The first line in a script (e.g., #!/bin/bash) that tells the system which interpreter to use to execute the script.

How to schedule a script to run daily at 2 AM?
Use a cron job: 0 2 * * * /path/to/script.sh in the crontab.

Advanced Concepts

Explain the Linux boot process from power-on to login prompt.
BIOS/UEFI > Bootloader (GRUB) > Kernel Initialization > systemd (PID 1) > Target Units > Login Prompt.

What is the difference between a hard link and a soft link?
A hard link is a direct pointer to the file's inode. A soft link (symlink) is a pointer to the file's path. Deleting the original file breaks a soft link but not a hard link.

How to see the routing table?
ip route or route -n.