Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.34 KB | None | 0 0
  1. LINUX EXAM
  2. CHAPTERS 4, 5, 8 NAME______________________________
  3.  
  4.  
  5. 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.
  6.  
  7. 1. Mail your login name to your instructor.
  8. _________________________________________________________________
  9. 2. Make a backup copy of the file HCC2015.
  10. _________________________________________________________________
  11. 3. List all of your files in descending sequence.
  12. _________________________________________________________________
  13. 4. View the first 20 lines of /etc/termcap file.
  14. _________________________________________________________________
  15. 5. Display summary information about the operating system memory, processes, interrupts, etc.
  16. _________________________________________________________________
  17. 6. Replace all instances of the word “Flat” with “Test” in the database file (contains over 2,000,000 records) unix_stuff.
  18. _________________________________________________________________
  19. 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
  20.  
  21. line.
  22. _________________________________________________________________
  23. 8. Show how long the system has been running.
  24. _________________________________________________________________
  25. 9. Your system seems to be running slowly. Monitor memory in megabytes.
  26. _________________________________________________________________
  27. 10. Locate the file hosts within /etc. Send the location to a file named foundit and the error messages to a file named invalid.
  28. _________________________________________________________________
  29.  
  30. 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
  31.  
  32. 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
  33.  
  34. command.
  35. a. cd .. ____________________________
  36. b. cd ../etc ____________________________
  37. c. cd ~ ____________________________
  38. d. cd ./Summer/IST109-M01 ____________________________
  39. e. cd /bin ____________________________
  40. f. cd /home/userid/Projects ____________________________
  41. g. cd Bill ____________________________
  42. h. cd ____________________________
  43.  
  44. 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).
  45. _________________________________________________________________
  46. 12. Find all files owned by root in the /root directory. Using grep filter the output to display only files containing ‘my’.
  47. _________________________________________________________________
  48. 13. Compare to files (roster, sortedroster) to find the difference.
  49. _________________________________________________________________
  50. 14. Create a report/file on disk usage that shows 3 cycles in megabytes.
  51. _________________________________________________________________
  52. 15. Create an archive of the /etc directory naming the file 4-2015backups in a directory named Backup (which does not currently exist).
  53. _________________________________________________________________
  54. 16. Use a command to compare the trees and more_trees files and show the differences in terms of individual lines that differ.
  55. _________________________________________________________________
  56. 17. View all processes running.
  57. _________________________________________________________________
  58. 18. Run the top command in the background and redirect the output to a file named top11-11.
  59. _________________________________________________________________
  60. 19. Set a script file to run in 30 minutes.
  61. _________________________________________________________________
  62. 20. Check the spelling on alma_mater .
  63. _________________________________________________________________
  64. 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.
  65. _________________________________________________________________
  66. 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
  67.  
  68. changes files and institute the changes on Linux1.
  69. _________________________________________________________________
  70. 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.
  71. _________________________________________________________________
  72. 24. Search for the words IBM PC in /etc/termcap.
  73. ________grep “IBM PC” in /etc/termcap________________________
  74. 25. In Windows the command is ipconfig. What is the counterpart in Linux?
  75. _________________________________________________________________
  76. For the next three questions (27, 28, 29), refer to the following:
  77. [2] Stopped sort /etc/passwd
  78. [3] - Stopped vi .kshrc
  79. [4] + Stopped more .login
  80. [5] Running find / -name food –print
  81.  
  82. 26. What command would you use to bring the vi editor to the foreground?
  83. _________________________________________________________________
  84. 27. What is the command you would use to kill the more process?
  85. _________________________________________________________________
  86. 28. What is the command you would use to get this listing?
  87. _________________________________________________________________
  88. 29. Take the output of the w command and change all lowercase letters to capitals.
  89. _________________________________________________________________
  90. 30. Split the november_births into smaller files containing 10 or fewer lines.
  91. _________________________________________________________________
  92. 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.
  93. _________________________________________________________________
  94. 32. Change a database file roster from ASCII to EBCDIC format so that it can be used on a legacy system.
  95. _________________________________________________________________
  96. 33. Before display a file, you should be sure it is a text file and not a binary file. How do you accomplish this?
  97. _________________________________________________________________
  98. 34. You are NOT in vi. Show a file’s line numbers and content.
  99. _________________________________________________________________
  100. 35. Format a file, yourscript, to contain viewable pages, a heading, date, double spaced, and line numbers and send the output to the printer.
  101. _________________________________________________________________
  102. 36. Not in vi. Expand the tab to 8 spaces for the home in your home directory .bashrc.
  103. _________________________________________________________________
  104. 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?
  105. _________________________________________________________________
  106. 38. Display the last 5 lines of the /etc/passwd displaying only the user’s name to the screen and creating a file (bottom).
  107. _________________________________________________________________
  108. 39. Compare two sorted files, line by line showing only lines that are in common to both files.
  109. _________________________________________________________________
  110. 40. Access mbox.
  111. _________________________________________________________________
  112.  
  113. 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.
  114. _________________________________________________________________
  115. 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