Linux Assignment– 1
Basic Functionalities & Commands
Basic Questions
- Display the current working directory.
- List all files (including hidden ones) in your home directory.
- Create a new directory named ‘linux_practice’.
- Navigate into the ‘linux_practice’ directory.
- Create an empty file named ‘task1.txt’.
- Write ‘Hello Linux’ into ‘task1.txt’ using echo.
- Display the contents of ‘task1.txt’.
- Rename ‘task1.txt’ to ‘task_renamed.txt’.
- Copy ‘task_renamed.txt’ to a new file called ‘task_copy.txt’.
- Delete ‘task_copy.txt’.
- Show the manual page for the ‘ls’ command.
- Display the current date and time.
- Show the list of currently logged-in users.
- Display your username using a command.
- Check disk usage of your home directory.
- Show the last 5 lines of ‘/var/log/syslog’ or ‘/var/log/messages’.
- Count the number of lines in ‘task_renamed.txt’.
- Search for the word ‘Linux’ in ‘task_renamed.txt’.
- Display the first 3 lines of ‘task_renamed.txt’.
- Show the permissions of all files in ‘linux_practice’.
Intermediate Questions
- Create a script that prints your system’s hostname.
- Schedule a cron job to run a script every day at 5 PM.
- Find all ‘.txt’ files in your home directory.
- Compress a directory using tar and gzip.
- Extract a tar.gz archive.
- Change the permissions of a file to read-only for all users.
- Change the owner of a file to another user.
- Display the top 5 processes by memory usage.
- Monitor real-time system performance using ‘top’.
- Redirect the output of a command to a file.
- Append text to an existing file.
- Create a symbolic link to a file.
- Find the IP address of your system.
- Check the status of a service (e.g., ssh).
- Start and stop a service using systemctl.
- List all installed packages on your system.
- Install a package using apt or yum.
- Search for a package using apt or yum.
- Display disk partition information.
- Mount a USB drive manually.
Advanced Questions
- Write a shell script to back up a directory to another location.
- Create a user and set a password using command line.
- Set up SSH key-based authentication.
- Configure a firewall using ufw or iptables.
- Monitor network traffic using tcpdump.
- Automate log rotation for a custom log file.
- Write a script to monitor disk usage and send alert if usage exceeds 90%.
- Set up a basic web server using Apache or Nginx.
- Create and manage a virtual machine using KVM or VirtualBox.
- Write a script to check if a service is running and restart it if not.