Useful Linux Interview Questions

Listen to this Post

Linux is a critical skill for system administrators, DevOps engineers, and cybersecurity professionals. Below are some essential Linux interview questions along with practical commands and scenarios to help you prepare.

Basic Linux Commands You Should Know:

1. Check System Information

uname -a 
cat /etc/os-release 

– Displays kernel version and OS details.

2. List Files with Detailed Info

ls -la 

– Shows hidden files, permissions, and ownership.

3. Find Files by Name

find / -name "filename" 

– Searches the entire filesystem for a file.

4. Check Disk Usage

df -h 
du -sh * 

– `df` shows disk space, `du` checks directory sizes.

5. View Running Processes

top 
ps aux | grep "process_name" 

– Monitors system processes in real-time.

6. Network Configuration

ifconfig 
ip a 
netstat -tuln 

– Checks IP, network interfaces, and listening ports.

7. File Permissions

chmod 755 file.sh 
chown user:group file.txt 

– Modifies file access and ownership.

8. Compress and Extract Files

tar -czvf archive.tar.gz /folder 
tar -xzvf archive.tar.gz 

– Creates and extracts `.tar.gz` files.

9. Search Inside Files

grep "pattern" file.txt 
grep -r "error" /var/log 

– Finds text patterns in files.

10. Schedule Tasks with Cron

crontab -e 
*/5 * * * * /path/to/script.sh 

– Sets up automated script execution.

Advanced Linux Questions:

  • How do you troubleshoot a slow Linux server?
    uptime # Check load average 
    free -h # Memory usage 
    iostat # Disk I/O stats 
    dmesg | tail # Check kernel logs 
    

  • Explain Linux Runlevels.

    systemctl get-default 
    systemctl set-default multi-user.target 
    

  • How to secure SSH?

    nano /etc/ssh/sshd_config</p></li>
    </ul>
    
    <h1>Disable root login & change port</h1>
    
    <p>PermitRootLogin no 
    Port 2222 
    
    • What is a Linux kernel module?
      lsmod # List loaded modules 
      modinfo ext4 # Get module details 
      

    What Undercode Say:

    Mastering Linux commands is essential for system administration and cybersecurity. Practice these commands in a lab environment, automate tasks with scripts, and understand logs for troubleshooting. Always verify permissions, monitor system resources, and harden services like SSH.

    Expected Output:

    $ uname -a 
    Linux server 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux 
    

    Keep learning and exploring Linux for better system control and security! 🚀

    References:

    Reported By: Anil Kumar – Hackers Feeds
    Extra Hub: Undercode MoN
    Basic Verification: Pass ✅

    Join Our Cyber World:

    💬 Whatsapp | 💬 TelegramFeatured Image