Linux and Bash for Data Engineering Week4

docx

School

Grand Rapids Community College *

*We aren’t endorsed by this school

Course

MISC

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

3

Uploaded by ConstableWildcatMaster401

Report
Congratulations! You passed! Grade received 80% Latest Submission Grade 80% To pass 80% or higher Go to next item 1. Question 1 What would this command do? locate -i .ZSHRC 0 / 1 point Find only occurrences of . ZSHRC Find occurrences of both .ZSHRC and .zshrc Find only occurrences of .zshrc Incorrect Not quite. The -i flag performs a case insensitive search. 2. Question 2 Which of these two time commands will be faster? time sudo find / -name .zshrc time locate .zshrc /etc/skel/.zshrc 1 / 1 point The second time command using locate . The first command. They are both the same speed to execute. Correct You got it! The second time will be as much as 10x faster because locate uses metadata search. 3. Question 3 Which command moves files? 1 / 1 point mv touch cp Correct You got it! The mv command moves files and directories. 4. Question 4 The following output describes how a UNIX file permission gets set. How would you apply this to a file called foo.txt ? Name Owner Group Other access r w x r w x r w x binary 4 2 1 4 2 1 4 2 1 enabled 1 1 1 1 0 1 1 0 0 result 4 2 1 4 0 1 400 total 7 5 4 1 / 1 point chmod 754 foo.txt chmod -R 777 * chown root:root Correct
You got it! The chmod command applies these permissions. 5. Question 5 What would this command do? zip -r archives/foo.zip foo 1 / 1 point Nothing It creates a zip archive of the foo directory in the location archives/foo.zip It unzips archives/foo.zip Correct You got it! The zip command takes the path to archive to as the first argument and the folder to archive as the second argument. 6. Question 6 What does this command do? tar -zcvf archives/foo.tgz foo 1 / 1 point It creates an uncompressed archive. It creates an archive of the foo directory. Nothing. Correct You got it! This command creates a tar archive compressed with the gzip algorithm. 7. Question 7 Why would be the command to reverse sort the file foo.txt ? 1 / 1 point less -r foo.txt sort -r < foo.txt rev < foo.txt Correct You got it! The sort command uses both input redirection and the -r flag to reverse sort a file. 8. Question 8 What is a straightforward way to count the unique lines in a file called fruit ? 1 / 1 point uniq -c fruit.txt sort fruit.txt | uniq -c sort fruit.txt Correct You got it! The sort command is necessary because uniq only counts adjacent unique lines so it must be combined with sort . 9. Question 9 What is the output of the following regex command?
echo 41-444-5599 | grep ' ([0−9]{3}) [0−9]{3}([0−9]{3}) [0−9]{3} [ -]\?[0-9]\{3\} [ -]\?[0-9]\{4\}' 0 / 1 point 415-444-5599 41-444-5599 Nothing. Incorrect Not quite. There is no output because the regex did not find a valid phone number to match on. 10. Question 10 What would this command's output be? echo"MIXED"| sed 's/MIXED/NEGATIVE/' 1 / 1 point POSITIVE MIXED NEGATIVE Correct You got it! The sed expression swapped the MIXED for NEGATIVE in the line.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help