<- Back to Interview Prep

Shell Script Interview Questions

Top 30 medium to hard practical questions for shell scripting interview prep.

Practical Question Set (1 - 30)

  1. Write a script to monitor a directory and automatically move new files to a backup folder.
  2. Write a script to parse a log file and extract all IP addresses.
  3. Write a script to check system load average and send an alert if it exceeds a threshold.
  4. Write a script to implement a simple calculator supporting +, -, *, / operations.
  5. Write a script to find and kill processes consuming more than 80% CPU.
  6. Write a script to implement a countdown timer.
  7. Write a script to generate a report of disk usage per user.
  8. Write a script to check if a given port is open on a remote server.
  9. Write a script to monitor memory usage and log it every 10 minutes.
  10. Write a script to recursively list all files larger than 100 MB.
  11. Write a script to implement a menu-driven program for system administration tasks.
  12. Write a script to validate email addresses from a file.
  13. Write a script to compare two directories and list differences.
  14. Write a script to archive logs daily and delete archives older than 30 days.
  15. Write a script to implement a basic chat system using named pipes.
  16. Write a script to check SSL certificate expiry for a given domain.
  17. Write a script to monitor a process and restart it if it stops.
  18. Write a script to extract failed login attempts from /var/log/auth.log.
  19. Write a script to generate random strong passwords.
  20. Write a script to split a large file into smaller chunks.
  21. Write a script to merge multiple CSV files into one.
  22. Write a script to implement a simple key-value store using a text file.
  23. Write a script to check network connectivity to multiple servers and log results.
  24. Write a script to implement a simple cron-like scheduler.
  25. Write a script to calculate the checksum of files and detect changes.
  26. Write a script to monitor a directory for file changes using inotify.
  27. Write a script to implement a progress bar for long-running tasks.
  28. Write a script to parse JSON data using shell tools.
  29. Write a script to back up MySQL databases automatically.
  30. Write a script to implement a retry mechanism for failed commands.