Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Assignment
1. You accidentally created a directory named test!. Write the
command to delete this directory.
2. A file named report.txt needs to be readable and writable only
by the owner, but no permissions should be granted to the group or others. Write the command to set this.
3. Ping a server with the domain name vit.ac.in and limit it to 5
packet
4. Display real-time CPU and memory usage for the local host
5. Display all active network connections and their associated ports
for the localhost.
6. You are tasked with creating a backup script for the following requirements:
1. Source Directory: The directory to be backed up is
/home/user/documents. 2. Destination Directory: The backup file should be stored in /backups. 3. Error Handling: 1. If the source directory does not exist, the script should display an error message and exit. 2. If the destination directory does not exist, it should be created automatically.
Tasks
1. Write the shell script to implement the above requirements.
2. Test the script to ensure it works for the following cases:
1. The source directory exists and contains files.
2. The source directory does not exist. 3. The destination directory does not exist initially.