Question
Linux Assignment 2 Summer 2017 Dr. Philip Craiger You should immediately save this document as: ..2.txt so my assignment would be named: philip.craiger.2.txt You should
Linux Assignment 2 Summer 2017 Dr. Philip Craiger You should immediately save this document as: ..2.txt so my assignment would be named: philip.craiger.2.txt You should answer all of the questions for this assignment by typing the answers in the spaces provided below the question. DO NOT USE A WORD PROCESSOR. Use a text editor (that way I don't get two assignments name first.last.1.txt.doc (which is NOT a text file!). --You will start off with a 75 should you NOT follow these directions.-- --You will upload your file to the Dropbox.-- -- Late assignments uploaded to the Late Dropbox will receive a 25 point penalty -- Below are questions related to the command line use of Linux. You can use the videos, man pages, and notes to answer these questions. Remember that Linux is CASE SENSITIVE. Rm and rm are NOT the same command. I will count off totally for a question if you do not take this into account. For each command give me the ENTIRE COMMAND SEQUENCE. If I ask you 'What command would I use to move the file one.txt to the parent directory and rename it to two.txt?", the answer is NOT 'mv'. That is only part of the command. I want the entire command sequence. **** All of these questions can be answered by viewing the videos, notes, and the man pages. You will do well if you have worked in Linux and copied the commands I've run while watching the videos ********* Are you still reading? Good. Because some commands (find & grep) I've asked you about will need 'sudo' to run in directories that are owned by root. Hint. There are 100 possible points. Each question is worth 5 points. UNLESS OTHERWISE SPECIFIED, ASSUME YOUR CURRENT WORKING DIRECTORY IS ~. Big hint for this assignment (although if you've watched the lectures and followed along this should be easy: -- If you are searching for a file that contains a particular KEYWORD use grep. -- If you are trying to find a file by name, size, date, owner, etc., then use find. 1. Search ALL files below the /var/log directory -- and all subdirectories below -- whose contents contains the keyword "Linux" (specific case). 2. Search files in /etc and all subdirectories -- that contain the word 'pam' (case insensitive) at the BEGINNING of a line. Provide two lines of context BEFORE each keyword found. (Make sure you watch the egrep video for this question). 3. Search files in the /var/log directory whose contents contains the word 'root' (case sensitive). Whole word only, meaning 'root' matches but 'rootfs' doesn't. 4. Create a tar file named 'my.2015.tar' that would include all the files in your home directory with the name and extension "file?.txt". (that is, file1.txt, file2.txt, etc. would match. File1.doc, file11.txt, etc. would not) 5. I want to append the file food.txt to the tar archive from Question 4 above. What command would I use? (hint: man pages) 6. Find all empty files under /var/log. 7. Find all files under /etc whose size is smaller than 140 kilobytes. Output your results to text file called ~/smalletcfiles. 8. I want to compress the file in Question 4 above using the bzip2 compression algorithm. What command would I use? 9. Find all files under /var/log whose CHANGED time was MORE than one hour ago. 10. Find all files under /var/log whose MODIFIED time was less than 5 days ago. 11. I have a file called 'mybackup.tgz' in my home directory. I want to uncompress and unarchive the files in it. What command would I use? . 12. I have a directory called ~/myfiles that contains a bunch of files. I want to zip up the directory and name it myfiles.zip. What command would do this? (Read the man pages) 13. Find all files under the current directory which belong to whatever YOUR username is. 14. I have a large file named bigfile.txt. I want to view the first 17 lines of the file. What command would I use? 15. Same as file as Question 14, but I want to view the last 5 lines. 16. Find all empty files under the directory /tmp, and delete them. (Remember your current directory is ~). 17. Find all empty files under /etc, and print out a long directory listing for each file, make sure to only show one screen at a time. 18. What command would I run to update the database of file names used by the locate command? 19. Find all files under the /tmp directory whose size is greater than 100 kilobytes. Use -exec and an appropriate command to delete these files. 20. Find all files under the current directory that contain the keyword 'waffle', ignoring case (so waffle, WAFFLE, Waffle, wafflE, etc.).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started