Power of Command Line Pt1

Power of Command Line Pt1

Assessment

Flashcard

Instructional Technology

Professional Development

Hard

Created by

Quizizz Content

FREE Resource

Student preview

quiz-placeholder

28 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What is the proper command to use to compress the file filename.txt into the zip archive called myfile.zip?

Back

zip myfile.zip filename.txt

Answer explanation

The syntax for zipping a file into a zip archive is "zip myfile.zip filename.txt".

2.

FLASHCARD QUESTION

Front

What statement is used to get input from the terminal when a shell script is being run?

Back

read

Answer explanation

The read command is used to get input from the terminal when using a shell script.

3.

FLASHCARD QUESTION

Front

Consider the following script:
#!/bin/bash
ip=`route -n | grep UG | tr -s “ “ | cut -f 2 -d “ “`
echo “Checking to see if $ip is up..."
ping -c 5 $ip
What does the script output?

Back

Checking to see if ipaddress is up...

Answer explanation

The line in the script that starts with the echo command will cause the string, "Checking to see if $ip is up…" will be executed. When this is executed, the value of $ip will be replaced with the result of the command in the second line (which contains route).

4.

FLASHCARD QUESTION

Front

Which option can be used with tail to print the last 10 lines of a file and then keep printing any new lines that may be added continuously? Options: -n, -f, -x, -a

Back

-f

Answer explanation

The -f option is used to "follow" the contents of the file. This lets tail print the last 10 lines of a file (usually a log file) and continue to print out new lines to the screen as they are added to the file.

5.

FLASHCARD QUESTION

Front

Which command is used to make a shell variable known to subsequently executed programs?

Back

export

Answer explanation

The command export is used to make a shell variable known to subsequently executed programs. Essentially, the export command creates a globally accessible variable when it is run.

6.

FLASHCARD QUESTION

Front

What option can be used with cat to display line numbers with the text of a file to the screen? Options: #, -x, -n, -1

Back

-n

Answer explanation

The -n option will show the line numbers next to a file's contents when displayed to the screen. For example, "cat -n song.txt" will display the contents of the song.txt file with line numbers down the left column of the display.

7.

FLASHCARD QUESTION

Front

What is one of the most basic features of a shell script? Options: The ability to compile programs, The ability to run commands, The ability to ask for user input, The ability to display command output information

Back

The ability to run commands

Answer explanation

A shell script is a computer program designed to be run by the shell. Typical operations performed by shell scripts include file manipulation and command execution. The most basic scripts run commands in serial order and do not provide any output back to the screen or seek input from a user.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?