Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with these linux questions 9. What command would I run if I want to

ID: 3850015 • Letter: I

Question

 I need help with these linux questions  9. What command would I run if I want to archive and compress all of the documents in ~/Desktop/backups/2015 to a file called '~/backups.bz2'?  Remember you are in ~. (5 pts)   10. Below, create a simple shell script (something I could copy directly from your assignment into a text file and run) that would delete all files with the name "Fred.*" under /var/log whose whose size is less than 1MB.  (5 pts)   11. I just created the following shell script in the file "runme.sh":  #!/bin/sh find / -type f -name *.tmp -size +10k  -size -20k -exec rm {} ;  I save the file, and then attempt to run it. “ received the error bash: ./runme.sh: Permission denied.  Show me the command that solves the problem. (5 pts)   12. Create a command that will search for files under /etc that contain the keyword "PAM", and return a COUNT of the number of files. That's all I want to see, a number. (User the man pages: 5 pts)   13.  Create a command that will identify files under /usr/sbin that are greater than 1 kilobyte and less than 1MB. (5 pts)   14. Create a command that will run the script runme.sh one hour from now. (5 pts)   15. I've run 24 commands in the background from a terminal.  Some of these I know will take some time to complete. How would I find out what commands have not completed yet?  (5 pts)   16. What command could I run to determine whether the ssh daemon is listening? (There are a couple of correct answers here.) How would you check this? Hopefully you've installed OpenSSH (shown in the videos). Then identify the command, it should show that ssh/port 22 as "listening.' (5 pts)   17.  I have a directory called "~/MyFiles." It's owned by user 'pc' and group 'pc.' Change the ownership so that it is now owned user 'super' and group "secret".  (5 points)  18.  Create a crontab entry that would run the file /etc/clear.sh every day at 3AM.  19. Create a crontab entry that would run the file /etc/clear.sh every Wednesday at 5:01PM.  20.  Create a command that will find all files under / that end in the extension *.txt, and whose contents contain either the word "new" or "old" or "borrowed" or "blue".  (Look at egrep, watch the video!). CHECK YOUR WORK! (5 points). 

Explanation / Answer

9. Command to archive a file is tar

Command:

tar -cvzf backups.bz2 Desktop/backups/2015

10. Shell script to remove all files with string "Fred" under /var/log floder.

#!/bin/bash

cd /var/log

rm Fred.*

11. Just rerun the command with sudo. This will prompt you for the password and after entering your password you can achieve your desired result.

Eg: sudo /runme.sh

12. In order to achieve your desired output you have to use a pipe. First command output will be sent as input to second command.

grep -irm 1 "PAM" | wc -l