Linux Assignment– 2

Shell Scripting

Basic Questions

  1. Create a script to print ‘Hello, World!’.
  2. Write a script to display the current date and time.
  3. Create a script to list files in the current directory.
  4. Write a script to check if a file exists.
  5. Create a script to read user input and display it.
  6. Write a script to add two numbers provided by the user.
  7. Create a script to display system information.
  8. Write a script to count the number of lines in a file.
  9. Create a script to display the contents of a file.
  10. Write a script to rename a file.
  11. Create a script to delete a file.
  12. Write a script to create a backup of a file.
  13. Create a script to display the current user.
  14. Write a script to check if a directory exists.
  15. Create a script to create a new directory.
  16. Write a script to copy a file to another location.
  17. Create a script to move a file to another location.
  18. Write a script to display disk usage.
  19. Create a script to display memory usage.
  20. Write a script to display the IP address of the system.

Intermediate Questions

  1. Write a script to find the largest of three numbers.
  2. Create a script to check if a number is even or odd.
  3. Write a script to print numbers from 1 to 10 using a loop.
  4. Create a script to calculate factorial of a number.
  5. Write a script to check if a string is a palindrome.
  6. Create a script to reverse a string.
  7. Write a script to count the number of words in a file.
  8. Create a script to find all ‘.txt’ files in a directory.
  9. Write a script to monitor CPU usage.
  10. Create a script to monitor memory usage.
  11. Write a script to send an email notification.
  12. Create a script to archive log files older than 7 days.
  13. Write a script to automate software installation.
  14. Create a script to check internet connectivity.
  15. Write a script to display currently running processes.
  16. Create a script to kill a process by name.
  17. Write a script to schedule a task using cron.
  18. Create a script to log system uptime.
  19. Write a script to extract lines containing a specific word from a file.
  20. Create a script to compare two files.

Advanced Questions

  1. Write a script to monitor disk usage and send alert if usage exceeds 90%.
  2. Create a script to automate backup of a directory with timestamp.
  3. Write a script to parse and analyze a log file.
  4. Create a script to set up a basic firewall configuration.
  5. Write a script to manage user accounts (add/delete).
  6. Create a script to automate system updates.
  7. Write a script to check service status and restart if not running.
  8. Create a script to generate a system health report.
  9. Write a script to sync files between two directories.
  10. Create a script to monitor network traffic and log suspicious activity.