Sunteți pe pagina 1din 3

Note: Create a directory called experiment1 and copy all the files under 'for OS students' from 'ftp://10.0.0.

84' and then start working.(use the command wget r ftp://10.0.0.84 /for%20OS%20students). Always give the same filenames that is specified in the question. No marks would be awarded if different file names were given. If anybody is seen discussing, no marks would be given for both the students, and they would be sent out of the lab 1. Create files like oldstu.txt, newstu.txt, oldlab.txt, newlab.pdf. Create hidden files called stu and oldfiles.Search for files having the pattern "stu" and "old" in the current directory. (1+1+2) 2. Sort the file marks.txt based on the third column. (1.5) 3. Make a file maks_numbered.txt using the file marks.txt. The new file should like (2) 1:89 92 85 2:98 47 67 3:67 82 76 4:78 97 60 5:67 68 69

4. List all the files recursively in a directory. (2) 5. Display the tenth line of the file 'wonderland.txt'. (2) 6. Create a subdirectory called 'second batch' inside the current working directory. Go inside the 'second batch' directory and create files called a.txt, b.txt, c.pdf, d.mp3. Try to open the all the files you had created. What is the result? Explain (3) 7. Create files m.txt, n.txt, k.txt inside 'wednesday' sub-directory created inside the 'second batch' directory, and write some contents into the files. Copy all the files from 'second batch' subdirectory to

'wednesday' subdirectory using the interactive mode, by having the working directory as the second batch (3) 8. Create another subdirectory 'computer' inside 'second batch' and create files called m.txt, n.txt, k.txt and write some contents into each file. Move all files from 'wednesday' subdirectory to 'computer' using the interactive mode, by remaining in the 'computer' directory itself.

9. Count the number of lines, words and Characters in the 'wonderland.txt' file (1) 10. Create a file below, called "stu_marks.txt" using marks1.txt and students.txt (2+2) Roll No Name M1 M2 M3 0 Anbu 67 56 78 1 Anne 67 82 76 2 Raul 78 97 60 3 Sven 67 68 69 4 Dilbert 98 47 67 5 Hussain 89 92 85 7 Anil 90 89 78 Retrieve only the names that are in the row numbers 3 and 4

11. Display all the lines which do not contain the word "Programming" in items.txt using only the 'grep' command. (1) 12. Display the count of the number of lines having the word "Programming" in the file items.txt using only the 'grep' command. (1) 13. Print only the word "Programming" if it appears in a particular line in items.txt with only the 'grep' command. (2)

14.

Add the following lines to the marks1.txt file 8:78:90:100 9:100:56:89

Display only the lines with the delimiter space, using only the 'cut' command. (2) 15. Execute the command "grep -i "\<U" items.txt" and interpret the result. (1)

16. Change the permission of the file 'i.txt', so that all the users can execute it (2) 17. Display the files in the experiment1 directory according to their size (ascending order), using only the ls command (2) 18. List all those files whose filename has only one character or number as its name (example: filenames like 3.txt, g.txt, h.txt ) (2) 19. Sort the file marks1.txt in the descending order based on the third mark value(2) 20. Remove all the \n characters in the file students.txt using an appropriate command. The one who uses the shortest command will be given more marks. (2)

S-ar putea să vă placă și