Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Instructions

1. Homework submission mode is online only. 2. No submission will be accepted after the specified submission date. 3. The uploaded file must only be a Word document (.doc) only. No PDFs etc will be considered. 4. The homework should be the original work done by the student and not a copy of any other student. Copy cases will be given zero mark. 5. Each question is compulsory. There is no choice.

Part A
Q1. Which command will be used to delete a directory containing a file? Q2. The current permissions on a file are rw-r--r--. I want the permissions to be read and execute for the user, read and write for group and none for others. How can it be achieved? Q3. A) Write a shell script to calculate the factorial of the number which is entered by the user as an argument. b) Write a shell script that takes filenames as its parameters. If a file exists it changes the modification date. If no file exists it creates a new one c) Write a shell script to create 5 files and enter text into each from the user. Use for loop. d) Write a shell script to print the names of all the files that contain the word hello or helo. e) Write a shell script that removes unwanted files from a directory and its subdirectories. Q4. What will be the output of the following commands? $ ls - l | sort > file1.txt $ who | sort >>file1.txt Q5. What is the difference in use of ? and + when used with shell and with grep command?

Part B
Q6. A) Suppose there is a directory structure as: /home/user/f1/f2/f3/f4.txt You are currently in /home/user. Write the command to delete f2. b) Suppose there is a directory structure as: /home/user/f1/f2/f3 There is a file named hello.txt in f1. Considering you current directory is /home/user, write a command to move the file hello.txt from its current location to directory f3. Q7. Compare GNOME and KDE. Write key attributes of an open source software. What is the purpose of /bin, /etc, /lib and /dev directories? Q8. Write the output: $ grep -c director emp.txt $grep a*[fgh].l$ *.txt

Q9. Show the difference between the use of $* and $@ with example. Q10. How are Basic Regular Expressions helpful with grep command. Show their use with grep command by giving 10 different examples.

You might also like