logo

Crowdly

Question 5 (10 Marks) Write the Shell Commands for each of the following and s...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Question 5 (10 Marks)

Write the Shell Commands for each of the following and show its output. {Hint: You can use Apropos command to search the manual page descriptions (man pages) for a given keyword, helping you find commands when you do not remember their exact names but know a related word or functionality}

1.       Write the command to display your current working directory.

2.       Change to your home directory using a single command.

3.       List all files and folders, including hidden ones, in the current directory.

4.       Move up one directory level from your current location.

5.       Go directly to the /etc directory from your current location.

6.       Create a new directory named practice_folder.

7.       Make an empty file called notes.txt inside practice_folder.

8.       Copy notes.txt to a file named notes_backup.txt in the same folder.

9.       Rename notes_backup.txt to notes_archive.txt.

10.   Delete the file notes_archive.txt.

 

Question 6. (10 Marks)

Write a bash script that asks the user for a starting and ending integer.

§  Use a loop (for or while) to traverse numbers in the range.

§  For each number, use a conditional statement (if) to check whether it is even.

Sum all even numbers (arithmetic with variables), and print the result at the end.

More questions like this

Want instant access to all verified answers on moovit.vit.ac.in?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!