Linux and Bash for Data Engineering Week2

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 90% Latest Submission Grade 90% To pass 80% or higher Go to next item 1. Question 1 Explain the purpose of the ~/.bashrc file. 1 / 1 point It is a Bash shell script that runs whenever Bash is started interactively. It is a Bash login shell that only runs at the start of a new login shell. It is a Bash logout shell that only runs when a shell exits. Correct You got it! This script is used to configure your shell environment for interactive use. 2. Question 2 What is the purpose of the ~/.zshrc file? 1 / 1 point It is a ZSH shell script that runs whenever Bash is started interactively. It is a ZSH login shell that only runs at the start of a new login shell. It is a ZSH logout shell that only runs when a shell exits. Correct You got it! This script is used to configure your shell environment for interactive use. 3. Question 3 What shell example creates a shell variable to the current shell only. 1 / 1 point echo $FRUIT FRUIT="cherry" export FRUIT="cherry" Correct You got it! Setting a variable makes the 4. Question 4 What would be the output of this command? FRUIT="Cherries"; echo $FRUIT are tasty 1 / 1 point echo Cherries are tasty Cherries are tasty $FRUIT are tasty Correct You got it! The shell variable value prints out as part of the echo command. 5. Question 5
When you run the command alias from a terminal what will you see? 1 / 1 point It will display the help menu for a command. It will print the name of the shell currently in use. You will see output like the following: alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' alias l.='ls -d .* --color=auto' alias ll='ls -l --color=auto' alias ls='ls --color=auto' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' Correct You got it! The output of the alias command shows the currently set aliases for the shell environment. 6. Question 6 What is a good example of what appears in standard out? 0 / 1 point The content of a file. It is always blank. Errors from the improper execution of a shell command. Incorrect Not quite. Errors get sent to stderr. 7. Question 7 What is the output of this command? ls fakefile.txt &>/dev/null 1 / 1 point There is no output. It will display the following error. ls: cannot access fakefile: No such file or directory It will create the file since it doesn't exist. Correct You got it! 8. Question 8 What would the following command do? ls fakefile 2>error.txt 1 / 1 point Write stdout to error.txt It deletes the output of stderr Write stderr to error.txt Correct You got it! The error from this command would write out to error.txt . Here is what would happen if you used the less command to read it. less error.txt ls: cannot access fakefile: No such file or directory
9. Question 9 What would this command do? for i in {1..10}; do echo $RANDOM >> rando.txt; done 1 / 1 point It throws away the output of standard out. It appends 10 random numbers to a file. It overwrites a file with a new random number 10 times. Correct You got it! The >> operator appends the output to a file. For every execution of a command using this operator, it will append new content to the file. 10. Question 10 What is happening in the following shell command? sort -r < /etc/passwd 1 / 1 point The /etc/password file is overwritten with a sorted version The sort command is appending to the /etc/password file. The /etc/password file is reverse sorted. Correct You got it! The sort command can accept input redirection and this command reverse sorts the content of the file.
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