NOS 120 Study Guide Ch 7

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which of the following will the split command do on a file when no other options are specified? Select one: a. It will split a file into new files that are 1 kilobyte each. b. It will split a file into new equally sized files that are 1/10th of the original file size. c. It will split a file into new files that are 1 megabyte each. d. It will split a file into new files that are 1,000 lines each.

It will split a file into new equally sized files that are 1/10th of the original file size.

Which of the following files can you add filenames to so that the git add * command will not stage them? Select one: a. .ignore b. .gitnopush c. .gitignore d. .nopush

.gitignore

Which of the following commands will display the exit status of the last command used in the BASH shell? Select one: a. echo $status b. echo $? c. echo $exit d. echo $!

echo $?

Which of the following constructs can be used in a shell script to determine whether two values are equal and if so run another set of commands? Select one: a. if b. when c. comp d. where

if

Which of the following commands will count down from 10 to 1? Select one: a. seq 10 -1 b. seq 10 1 c. seq 10 -1 1 d. seq 10 1 -1

seq 10 -1 1

Using the syntax below, what command will create directories named one, two, and three? ​ echo one two three | _______________ mkdir

xargs

Which of the following is a valid method of running a script named myscript.sh? (Choose two) Select one or more: a. source myscript.sh b. run myscript.sh c. ./myscript.sh d. exec ./myscript.sh

./myscript.sh source myscript.sh

Which of the following characters can be entered at the beginning of a line in a shell script to ensure that line is recognized as a comment rather than try to execute it? Select one: a. > b. % c. # d. $

#

Which of the following would be the results of running the command seq 7? Select one: a. 6 through 0 being displayed one number per line. b. 7 through 1 being displayed one number per line. c. 0 through 6 being displayed one number per line. d. 1 through 7 being displayed one number per line.

1 through 7 being displayed one number per line.

Which of the following represents stderr at the command line when used for redirection? Select one: a. 2 b. 0 c. 1 d. 3

2

Which of the following can be used for comparing values within an if statement? (Choose two.) Select one or more: a. -neq b. -lt c. -grt d. =

= -lt

Which of the following will take output from a command and append it to the end of a file? Select one: a. > b. < c. >> d. <<

>>

Which of the following commands can be used to create a BASH variable named CREATOR with the value of Torvalds? Select one: a. CREATOR = "Torvalds" b. set $CREATOR = "Torvalds" c. CREATOR="Torvalds" d. var CREATOR as "Torvalds"

CREATOR="Torvalds"

Match the file with the order in which the BASH shell environment files are read: /etc/profile, /etc/bashrc, ~/.bashrc, /etc/profile.d/*

Second /etc/profile.d/* Fourth ~/.bashrc Third /etc/bashrc First /etc/profile

Which of the following is the common escape sequence to display a horizontal tab using the echo command? Select one: a. \tab b. ?tab c. %tab d. \t

\t

Levi wants to run 5 commands sequentially, but does not want to create a shell script. He knows that each command is going to take approximately 20 minutes to run individually. However, he would like to go to lunch 15 minutes from now. He knows that he can type all of the commands on the same line and separate them with a certain character to run them sequentially. Which character can he type after each command to have them run one after the next without requiring further input from him? Select one: a. a semicolon b. a colon c. a comma d. a pound sign

a semicolon

Which command can be used to create a new command that will monitor the contents of auth.log as they get added to the file? Select one: a. create showauth='tail -f /var/log/auth.log' b. ln showauth='tail -f /var/log/auth.log' c. new showauth as 'cat -f /var/log/auth.log' d. alias showauth='tail -f /var/log/auth.log'

alias showauth='tail -f /var/log/auth.log'

Which of the following results would be created by the command sequence: echo 'apple banana carrot dog elephant' | while read a b c; do echo result: $c $b $a; done Select one: a. carrot dog elephant apple banana b. carrot dog elephant banana apple c. elephant dog carrot d. apple banana carrot dog elephant

carrot dog elephant banana apple

Which of the following commands will send the output of the cat command to the grep command to be filtered? Select one: a. cat /etc/passwd | grep jsmith b. cat /etc/passwd >> grep jsmith c. cat /etc/passwd @ grep jsmith d. cat /etc/passwd > grep jsmith

cat /etc/passwd | grep jsmith

You have just created a variable named CREATOR. Which of the following commands will display the contents of the variable to standard output? Select one: a. echo $CREATOR b. disp $CREATOR c. print CREATOR d. echo CREATOR

echo $CREATOR

When writing shell scripts and using an if statement to determine whether a set of code should be executed, what is the proper syntax to end the if construct? Answer: ________________________________

fi

Which of the following commands should you use to specify that you want to use Git for version tracking on them? Select one: a. git track b. git new c. git version d. git add

git add

Which command can be used to download an updated copy of the master branch from the original Git repository? Select one: a. git pull master original b. git pull master origin c. git pull origin master d. git pull original master

git pull origin master

Which of the following will look at the /etc/passwd file for any lines containing the word root and display them out to the screen while simultaneously writing the results to a file? Select one: a. cat /etc/passwd | grep root >> ~/root.txt b. grep root /etc/passwd | split ~/root.txt c. cat /etc/passwd | grep root | merge ~/root.txt d. grep root /etc/passwd | tee ~/root.txt

grep root /etc/passwd | tee ~/root.txt

The subdirectory newdir does not currently exist in the current directory that you are in. Which of the following commands will create a new directory named newdir and then change into that directory? (Choose two.) Select one or more: a. mkdir newdir; cd newdir b. mkdir newdir || cd newdir c. mkdir newdir >> cd newdir d. mkdir newdir && cd newdir

mkdir newdir && cd newdir mkdir newdir; cd newdir

Which of the following commands will display the output of a file while also displaying a line number at the left side of each line for the /etc/passwd file? Select one: a. nl /etc/passwd b. ln /etc/passwd c. numbers /etc/passwd d. wc -l /etc/passwd

nl /etc/passwd

Which of the following can be included in a shell script to ask the user to type in a password and then store it in the variable named $password? Select one: a. read -s -p "Please enter the password: " $password b. read -p -s "Please enter the password: " password c. read -s -p "Please enter the password: " password d. read -p "Please enter the password: " $password

read -s -p "Please enter the password: " password

Which of the following commands will display the contents of the /etc/passwd file in alphanumerical order? Select one: a. cat -s /etc/passwd b. sed /etc/passwd c. cat --sort /etc/passwd d. sort /etc/passwd

sort /etc/passwd

An alias has previously been created named showauth. Which of the following commands can be used to get rid of that alias? Select one: a. unalias showauth b. ualias shoauth c. noalias showauth d. alias -d showauth

unalias showauth

How many times will the following loop execute as part of a script: #!/bin/bash COUNTER=0 while [ $COUNTER -lt 7 ] do echo "hello world" done Select one: a. 7 b. 0 c. 1 d. until ctrl-c is used to terminate it

until ctrl-c is used to terminate it

Which of the following commands will count the number of lines in a file named data.csv? Select one: a. lc data.csv b. wc -l data.csv c. lines data.csv d. count -l data.csv

wc -l data.csv


Ensembles d'études connexes

HISTOLOGY: General His. of Alimentary Canal; His. of GI Tract

View Set

Tennessee Health Insurance License Review ExamFX

View Set

ECON Chap. 4: Market Failures; Chap. 6: Elasticity; Chap. 9 Costs of Production.

View Set

constitution and political system- part 3

View Set

Nursing Professional Development Certification Review

View Set

Ch.12 | Domestic Violence and Other Family Health Issues Quiz

View Set

Cook's Exploration of the Pacific

View Set

Alternative AP Literature Cardset with Common Examples

View Set

Washington Heads the New Government

View Set

Science Concepts Applied to Ride

View Set

Chap 8: Government Intervention in International Business

View Set