Linux Assignment– 1

Basic Functionalities & Commands

Basic Questions

  1. Display the current working directory.
  2. List all files (including hidden ones) in your home directory.
  3. Create a new directory named ‘linux_practice’.
  4. Navigate into the ‘linux_practice’ directory.
  5. Create an empty file named ‘task1.txt’.
  6. Write ‘Hello Linux’ into ‘task1.txt’ using echo.
  7. Display the contents of ‘task1.txt’.
  8. Rename ‘task1.txt’ to ‘task_renamed.txt’.
  9. Copy ‘task_renamed.txt’ to a new file called ‘task_copy.txt’.
  10. Delete ‘task_copy.txt’.
  11. Show the manual page for the ‘ls’ command.
  12. Display the current date and time.
  13. Show the list of currently logged-in users.
  14. Display your username using a command.
  15. Check disk usage of your home directory.
  16. Show the last 5 lines of ‘/var/log/syslog’ or ‘/var/log/messages’.
  17. Count the number of lines in ‘task_renamed.txt’.
  18. Search for the word ‘Linux’ in ‘task_renamed.txt’.
  19. Display the first 3 lines of ‘task_renamed.txt’.
  20. Show the permissions of all files in ‘linux_practice’.

Intermediate Questions

  1. Create a script that prints your system’s hostname.
  2. Schedule a cron job to run a script every day at 5 PM.
  3. Find all ‘.txt’ files in your home directory.
  4. Compress a directory using tar and gzip.
  5. Extract a tar.gz archive.
  6. Change the permissions of a file to read-only for all users.
  7. Change the owner of a file to another user.
  8. Display the top 5 processes by memory usage.
  9. Monitor real-time system performance using ‘top’.
  10. Redirect the output of a command to a file.
  11. Append text to an existing file.
  12. Create a symbolic link to a file.
  13. Find the IP address of your system.
  14. Check the status of a service (e.g., ssh).
  15. Start and stop a service using systemctl.
  16. List all installed packages on your system.
  17. Install a package using apt or yum.
  18. Search for a package using apt or yum.
  19. Display disk partition information.
  20. Mount a USB drive manually.

Advanced Questions

  1. Write a shell script to back up a directory to another location.
  2. Create a user and set a password using command line.
  3. Set up SSH key-based authentication.
  4. Configure a firewall using ufw or iptables.
  5. Monitor network traffic using tcpdump.
  6. Automate log rotation for a custom log file.
  7. Write a script to monitor disk usage and send alert if usage exceeds 90%.
  8. Set up a basic web server using Apache or Nginx.
  9. Create and manage a virtual machine using KVM or VirtualBox.
  10. Write a script to check if a service is running and restart it if not.