Basics Interview Questions and Answers for Linux Admin L2

Listen to this Post

Featured Image
✅ 1. What is the difference between a hard link and a soft link?

Answer:

  • Hard Link:
  • Points directly to the inode of a file.
  • Even if the original file is deleted, the data is accessible via the hard link.
  • Cannot span across filesystems.
  • Soft Link (Symbolic Link):
  • Points to the file name/path.
  • If the original file is deleted, the link becomes broken.
  • Can span filesystems and directories.

You Should Know:

 Create a hard link 
ln original.txt hardlink.txt

Create a soft link 
ln -s original.txt softlink.txt

Verify links 
ls -li 

✅ 2. How do you check disk usage in Linux?

Answer:

Use `df` and `du` commands:

  • df -h: Shows disk space usage of file systems.
  • du -sh /path/to/dir: Shows the size of a specific directory.

You Should Know:

 Check disk usage per directory 
du -h --max-depth=1 /

Find largest files 
find / -type f -exec du -h {} + | sort -rh | head -n 10 

✅ 3. How do you check and kill a process using the command line?

Answer:

  • Find the process:
    ps aux | grep process_name 
    top 
    htop 
    
  • Kill the process:
    kill PID  Gracefully 
    kill -9 PID  Forcefully 
    

You Should Know:

 Kill all processes matching a name 
pkill -f "process_name"

Kill processes older than 1 day 
find /proc -maxdepth 1 -user user -type d -mtime +1 -exec basename {} \; | xargs kill 

✅ 4. How do you check which ports are listening on a Linux server?

Answer:

netstat -tuln  Older systems 
ss -tuln  Newer systems 
lsof -i  See which process is using which port 

You Should Know:

 Block a port using iptables 
iptables -A INPUT -p tcp --dport 80 -j DROP

Check open ports on a remote server 
nmap -sT target_ip 

✅ 5. How do you check CPU and memory usage?

Answer:

  • CPU:
    top 
    htop 
    mpstat 
    
  • Memory:
    free -m 
    vmstat 
    

You Should Know:

 Monitor real-time CPU usage 
sar -u 1 3

Check memory leaks 
valgrind --leak-check=yes ./program 

✅ 6. What is a runlevel?

Answer:

  • Defines the system state after boot.
  • Common runlevels:
  • 0: Halt
  • 1: Single-user mode
  • 3: Multi-user, no GUI
  • 5: Multi-user with GUI
  • 6: Reboot

You Should Know:

 Change runlevel (SysV) 
init 3

Check current target (systemd) 
systemctl get-default 

✅ 7. How to schedule a cron job?

Answer:

crontab -e 

Example:

0 2    /path/to/script.sh  Runs daily at 2 AM 

You Should Know:

 List cron jobs 
crontab -l

Backup cron jobs 
crontab -l > cron_backup.txt 

✅ 8. How to check system logs?

Answer:

journalctl  systemd 
tail -f /var/log/syslog 
dmesg  Kernel logs 

You Should Know:

 Filter logs by priority 
journalctl -p err

Monitor failed login attempts 
grep "Failed password" /var/log/auth.log 

✅ 9. How to extend a logical volume?

Answer:

lvextend -L +10G /dev/mapper/vgname-lvname 
resize2fs /dev/mapper/vgname-lvname 

For XFS:

xfs_growfs /mount/point 

You Should Know:

 Create a new LV 
lvcreate -L 20G -n new_lv vgname

Extend a volume group 
vgextend vgname /dev/sdb1 

✅ 10. What is the difference between init and systemd?

Answer:

  • init: Traditional SysV init (serial startup).
  • systemd: Modern init (parallel startup, faster boot).

You Should Know:

 List all services 
systemctl list-units --type=service

Enable a service 
systemctl enable nginx 

✅ 11. How do you change the hostname of a Linux system?

Answer:

hostnamectl set-hostname new_hostname 

You Should Know:

 Verify hostname 
hostnamectl status

Update /etc/hosts 
echo "127.0.0.1 new_hostname" >> /etc/hosts 

✅ 12. How do you add swap space?

Answer:

dd if=/dev/zero of=/swapfile bs=1G count=2 
chmod 600 /swapfile 
mkswap /swapfile 
swapon /swapfile 

You Should Know:

 Make swap permanent 
echo "/swapfile none swap sw 0 0" >> /etc/fstab

Check swap usage 
swapon --show 

✅ 13. How do you check SELinux status?

Answer:

sestatus 

You Should Know:

 Temporarily disable SELinux 
setenforce 0

Change SELinux mode permanently 
sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config 

✅ 14. What is /etc/fstab used for?

Answer:

Defines how partitions and storage devices are mounted at boot.

You Should Know:

 Mount a filesystem manually 
mount -t ext4 /dev/sdb1 /mnt/data

Verify fstab entries 
mount -a 

What Undercode Say

Mastering these Linux admin L2 concepts is crucial for system stability and security. Automation (cron, systemd), monitoring (top, vmstat), and troubleshooting (journalctl, dmesg) are key skills. Always verify commands in a test environment before production.

Expected Output

A well-structured Linux admin guide with practical commands for real-world scenarios.

IT/Security Reporter URL:

Reported By: Archana Chaudhary – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 Telegram