ITSC 1358 – UNIX System Administration Unix Introduction ~ Lab Practicum #2 _____________________ Date: _____________________ Name: Prof. Michael P. Harris (v2011.07.21) Questions 1. Which of the following are NOT valid UNIX/Linux filenames? WHY? (be specific!) a. firstfile.txt b. FIRSTFILE.TXT c. first file d. first/file e. first!file 2. Create a file year2012 that will contain a calendar from Jan – Dec for the year 2012. 3. Change the permissions for your file year2012 so that anyone can copy the file to their home directory without giving them the option of changing the file. 4. What UNIX command would you type to view the contents of your file year2012 ? 5. How would you list all files in a directory beginning with the letters g, h, and p ? 6. How would you list all files whose filenames begin with the letter g, have any three characters following the g, and then end with ‘tly.txt’ (without the quotes)? 7. Which of the following filenames are matched by the pattern: [A-G]*ing.?txt ? a. Gagging.test b. Bing.xt c. Aging.ntxt d. Ing.ext e. Going.txt 8. What will be contained in the file thisfile after the following UNIX command? cat /etc/passwd > thisfile LAB Practicum #2 ITSC 1358 Unix System Administration 9. What UNIX command will do a sort on your home directory by the size of the files? 10. What UNIX command would you use to verify that the contents of /etc/passwd and the file thisfile are exactly the same? 11. Using redirection from a file, display the contents of /etc/passwd on the screen. 12. Using cat, redirect from /etc/group to thisfile. Then display thisfile. 13. What UNIX command will show how many words are in the system’s /etc/passwd file? 14. Display the last five entries of your system’s /etc/passwd file. 15. Sort the last five entries of your system’s /etc/passwd file in reverse order. 16. What are three different vi commands to exit and save your work? (Be specific) 17. What series of UNIX and vi commands will; enter vi opening the file thisfile, go to the 5th line, add your name at the end, and then exit discarding your changes? 18. How do you turn on line numbering in vi ? 19. Show the history of commands you have typed during this session. How would you repeat the 3rd command listed, without retyping the command itself? (Bash, Korn or Bourne shell) 20. Find every occurrence of the word ‘user’ in the /etc/passwd file. Page 2 of 3 LAB Practicum #2 ITSC 1358 Unix System Administration 21. Compress (GNU) the file thisfile. What is the difference in bytes between the two files? 22. Now uncompress (GNU) the file thisfile. 23. Compress and archive/backup the file thisfile to your home directory -all in one step, to the archive file thatfile. 24. Create an alias named newprompt that performs the following three tasks. Where would this alias go if you wanted to make newprompt permanent? 1. Clear the screen 2. Change the prompt to the current date followed by the $ 3. Print the current directory 25. From your UNIX home directory, create two new directories; Fruits and Vegetables. Under the Fruits directory create two files; Apples and Pears. Under the Vegetables directory create two files; Tomatoes and Peas. Since tomatoes are a fruit, move the Tomatoes file under the Fruits directory. Page 3 of 3