Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LINUX EXAM
- CHAPTERS 4, 5, 8 NAME______________________________
- Answer all questions as completely as possible. If giving a command, give the complete path, with proper spacing, options and punctuation. Place all answers on this form. Each question is worth two (2) points.
- 1. Mail your login name to your instructor.
- _________________________________________________________________
- 2. Make a backup copy of the file HCC2015.
- _________________________________________________________________
- 3. List all of your files in descending sequence.
- _________________________________________________________________
- 4. View the first 20 lines of /etc/termcap file.
- _________________________________________________________________
- 5. Display summary information about the operating system memory, processes, interrupts, etc.
- _________________________________________________________________
- 6. Replace all instances of the word “Flat” with “Test” in the database file (contains over 2,000,000 records) unix_stuff.
- _________________________________________________________________
- 7. Sort the file /etc/passwd using the fourth field (group ID) as the primary sort, and the third field (user ID), as the secondary sort and send the output to sortedpasswd and display at the same time on the monitor on one command
- line.
- _________________________________________________________________
- 8. Show how long the system has been running.
- _________________________________________________________________
- 9. Your system seems to be running slowly. Monitor memory in megabytes.
- _________________________________________________________________
- 10. Locate the file hosts within /etc. Send the location to a file named foundit and the error messages to a file named invalid.
- _________________________________________________________________
- From your home directory, what directory will you be in? This is not a command—be specific by stating the entire path (absolute or relative—be sure I know where you are starting from and where you will end) by naming the starting and
- ending directories/file. You are to assume that the files exist. Stating that the command is incorrect because the file/directory does not exist is not the correct answer. You may assume that you are in the location from the previous
- command.
- a. cd .. ____________________________
- b. cd ../etc ____________________________
- c. cd ~ ____________________________
- d. cd ./Summer/IST109-M01 ____________________________
- e. cd /bin ____________________________
- f. cd /home/userid/Projects ____________________________
- g. cd Bill ____________________________
- h. cd ____________________________
- 11. Using /etc/passwd , take the 4, 3 and 5 field to create a new file userinfo that is sorted is a primary sort on field 3 (group id) and a secondary sort on field 4 (user id).
- _________________________________________________________________
- 12. Find all files owned by root in the /root directory. Using grep filter the output to display only files containing ‘my’.
- _________________________________________________________________
- 13. Compare to files (roster, sortedroster) to find the difference.
- _________________________________________________________________
- 14. Create a report/file on disk usage that shows 3 cycles in megabytes.
- _________________________________________________________________
- 15. Create an archive of the /etc directory naming the file 4-2015backups in a directory named Backup (which does not currently exist).
- _________________________________________________________________
- 16. Use a command to compare the trees and more_trees files and show the differences in terms of individual lines that differ.
- _________________________________________________________________
- 17. View all processes running.
- _________________________________________________________________
- 18. Run the top command in the background and redirect the output to a file named top11-11.
- _________________________________________________________________
- 19. Set a script file to run in 30 minutes.
- _________________________________________________________________
- 20. Check the spelling on alma_mater .
- _________________________________________________________________
- 21. When you combined the files Linux1 and Linux2, you notice there are a lot of duplicate lines that are not necessarily one after the other. Remove the duplicates.
- _________________________________________________________________
- 22. You have a file named changes that contains all the changes you want to run on the file Linux1. For example, you want to change all lines containing IST to CSC, all 2013 to 2014, etc. Display the command that will read the
- changes files and institute the changes on Linux1.
- _________________________________________________________________
- 23. You have two files (file1 contains userid, name, course; file2 contains userid, major, grade). Create one file that contains the userid, name, course and grade.
- _________________________________________________________________
- 24. Search for the words IBM PC in /etc/termcap.
- ________grep “IBM PC” in /etc/termcap________________________
- 25. In Windows the command is ipconfig. What is the counterpart in Linux?
- _________________________________________________________________
- For the next three questions (27, 28, 29), refer to the following:
- [2] Stopped sort /etc/passwd
- [3] - Stopped vi .kshrc
- [4] + Stopped more .login
- [5] Running find / -name food –print
- 26. What command would you use to bring the vi editor to the foreground?
- _________________________________________________________________
- 27. What is the command you would use to kill the more process?
- _________________________________________________________________
- 28. What is the command you would use to get this listing?
- _________________________________________________________________
- 29. Take the output of the w command and change all lowercase letters to capitals.
- _________________________________________________________________
- 30. Split the november_births into smaller files containing 10 or fewer lines.
- _________________________________________________________________
- 31. Create a file named mywork that contains a listing of home directory and all its subdirectories with inode numbers for each file and directories and executable files identified in revered order sorted on the file name.
- _________________________________________________________________
- 32. Change a database file roster from ASCII to EBCDIC format so that it can be used on a legacy system.
- _________________________________________________________________
- 33. Before display a file, you should be sure it is a text file and not a binary file. How do you accomplish this?
- _________________________________________________________________
- 34. You are NOT in vi. Show a file’s line numbers and content.
- _________________________________________________________________
- 35. Format a file, yourscript, to contain viewable pages, a heading, date, double spaced, and line numbers and send the output to the printer.
- _________________________________________________________________
- 36. Not in vi. Expand the tab to 8 spaces for the home in your home directory .bashrc.
- _________________________________________________________________
- 37. Not a command: what happens to a process that is a child when you kill the parent? How can you find the parent/child process id?
- _________________________________________________________________
- 38. Display the last 5 lines of the /etc/passwd displaying only the user’s name to the screen and creating a file (bottom).
- _________________________________________________________________
- 39. Compare two sorted files, line by line showing only lines that are in common to both files.
- _________________________________________________________________
- 40. Access mbox.
- _________________________________________________________________
- 41. Search though every file in your home directory for the name Douglas Horton regardless of case (capital or lowercase) and show the number of matches.
- _________________________________________________________________
- 42. You got into your boss’ email and read several emails. After realizing this was not a smart move, how can you cover your tracks? _________________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement