QuiztudyPREMIUM
Google IT Automation with Python Professional Certificate • STUDY MODE
INTERACTING WITH THE COMMAND LINE
QUESTION 1 OF 9
Which of the following commands will redirect errors in a script to a file? You nailed it! The "2>" sign will redirect errors to a file.
A
user@ubuntu:~$ ./calculator.py < error_file.txtB
user@ubuntu:~$ ./calculator.py 2> error_file.txtCorrect AnswerC
user@ubuntu:~$ ./calculator.py > error_file.txtD
user@ubuntu:~$ ./calculator.py >> error_file.txtQUESTION 2 OF 9
When running a kill command in a terminal, what type of signal is being sent to the process? You got it! The kill command sends a SIGTERM signal to a processor ID (PID) to terminate.
A
SIGTERMCorrect AnswerB
SIGSTOPC
SIGINTD
PIDQUESTION 3 OF 9
What is required in order to read from standard input using Python? Right on! Using sys.stdin, we can read from standard input in Python.
A
echo file.txtB
cat file.txtC
The file descriptor of the STDIN streamD
Stdin file object from sys moduleCorrect AnswerQUESTION 4 OF 9
_____ are tokens delivered to running processes to indicate a desired action. Nice job! Using signals, we can tell a program that we want it to pause or terminate, or many other possible commands.
A
SignalsCorrect AnswerB
MethodsC
FunctionsD
CommandsQUESTION 5 OF 9
In Linux, what command is used to display the contents of a directory? Nice job! The ls command lists the file contents of a directory.
A
rmdirB
cpC
pwdD
ls (CORRECT¬)QUESTION 6 OF 9
Which of the following Linux commands will create an empty file? Right on! The touch command will create an empty file.
A
touchCorrect AnswerB
pwdC
mkdirD
cdQUESTION 7 OF 9
How do you append the output of a command to a .txt file? Great work! A double greater than sign will append a command output to a file.
A
user@ubuntu:~$ ./calculator.py > result.txtB
user@ubuntu:~$ ./calculator.py >> result.txtCorrect AnswerC
user@ubuntu:~$ ./calculator.py < result.txtD
user@ubuntu:~$ print("This will append")QUESTION 8 OF 9
Which of the following is the correct way of using pipes? Woohoo! The contents of the txt file are passed on to be placed in their own line and sorted in alphabetical order on the display.
A
user@ubuntu:~$ cat sample.txt ./process.pyB
user@ubuntu:~$ cat sample.txt || ./process.pyC
user@ubuntu:~$ tr ' ' '\n) | sort | cat sample.txtD
user@ubuntu:~$ cat sample.txt | tr ' ' '\n) | sortCorrect AnswerQUESTION 9 OF 9
What can you type in the terminal to stop the traceroute command from running cleanly? Right on! This sends a SIGINT signal to the program to stop processing cleanly.
A
Ctrl-CB
SIGINTCorrect AnswerC
Ctrl-ZD
SIGSTOPReady to test your recall?
Which of the following commands will redirect errors in a script to a file? You nailed it! The "2>" sign will redirect errors to a file.
A
user@ubuntu:~$ ./calculator.py < error_file.txt
B
user@ubuntu:~$ ./calculator.py 2> error_file.txt
C
user@ubuntu:~$ ./calculator.py > error_file.txt
D
user@ubuntu:~$ ./calculator.py >> error_file.txt
How confident are you in this answer?