Answered! Linux Assignment 2 Summer 2017 Dr. Philip Craiger You should immediately save this document as: ..2.txt so my…

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 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.).

Expert Answer

1.find /var/log -name ‘*.*’ -exec grep -l Linux {} ;

Don't use plagiarized sources. Get Your Custom Essay on
Answered! Linux Assignment 2 Summer 2017 Dr. Philip Craiger You should immediately save this document as: ..2.txt so my…
Order Essay

2.find /etc -name ‘*.*’ -exec egrep -i -B2 “^pam” {} ;

3.find /var/log -name ‘*.*’ -exec grep -lw root {} ;

4.tar -cvf my.2015.tar “/home/file?.txt”

5.tar -rf my.2015.tar food.txt

6.find /var/log -type f -empty

7.find /etc -type f -size -140k > ~/smalletcfiles

8.bzip2 “/home/file?.txt”

bzip2 -dc file*.txt.bz2 | bzip2 >my.2015.bz2

9.find /var/log -cmin -60

10.find /var/log -mtime -5

11.tar xvzf /home/mybackup.tgz /home -r ~/myfiles

13.find /var -user YOURUSERNAME — Please replace your username here

14.head -17 bigfile.txt

15 tail -5 bigfile.txt

16.find /tmp -type f -empty -delete

17.find /var/log -type f -empty | ls -l | more

18. # updatedb — Please note that update db needs to be executed as root.

19.find /tmp -type f -size -100k -delete

20.find . -print0 | xargs -0 grep “waffle”

Still stressed from student homework?
Get quality assistance from academic writers!