ITN 171 Exam 2 (Chapters 4-6)

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

When you no longer need a file, you can delete it using the ____ command. rm remove dl delete

rm

When you no longer need a directory, you can use command ____ to remove it. xtree rmdir dldir deltree

rmdir

____ is NOT a selection command. comm diff grep sed

sed

With no options, ____ displays the current listing of Bash environment and shell script variables. let set sh export

set

When you create a shell script to run in Bash, you can immediately run the script by typing ____ and then the name of the script. run sh start exec

sh

You can use the ____________________ command to sort a file's contents alphabetically or numerically.

sort

If you execute ____, the contents of file1 are sorted and the results are stored in file2. sort file1 -o file2 sort file1 -d file2 sort file1 > file2 sort file1 > file2 sort file1 file2

sort file1 > file2

A program's high-level language statements are stored in a file called the ____ file. shell script program source

source

System administrators and programmers refer to standard input as ____. sin stint stdin standardin

stdin

System administrators and programmers refer to standard output as ____. sout stout stdout standardout

stdout

The paste command normally sends its output to ____. stdout null stderr the file indicated as an argument

stdout

A ____ is a name consisting of letters, numbers, or characters and is used to reference the contents of a variable. comment symbolic name label tag

symbolic name

If a source file contains ____ errors, it cannot be converted into an executable file. syntax debugging compilation logic

syntax

You can use the ____ command to create empty files. touch create make null

touch

The ____ command enables you to initialize the terminal display or terminal window, to place text and prompts in desired locations, and to respond to what the user selects from the menu. put tput clear tclear

tput

What is tr used for?

translates and deletes character by character

The ____ command is useful when you want your shell program to automatically remove any temporary files that are created when the shell script runs. set export tput trap

trap

The ____ command removes duplicate lines from a file. grep dup uniq diff

uniq

____ is a selection command. uniq awk sort sed

uniq

The ____ statement continues to loop and execute commands or statements as long as a given condition or set of conditions is true. for while esac case

while

Match each item with a statement below. 1. environment variable that identifies the path name for user's home directory 2. environment variable that holds the path name of the program for the type of shell you are using 3. environment variable that contains the absolute path to the Bash shell, such as /bin/bash 4. environment variable that holds the primary shell prompt 5. environment variable that contains the file name containing commands to initialize the shell 6. environment variable that holds the list of path names for directories searched for executable commands 7. bitwise negation operator 8. logical negation operator 9. matches exactly one character, except for the backslash and period HOME SHELL BASH PS1 ENV PATH ~ ! ?

1. HOME 2. SHELL 3. BASH 4. PS1 5. ENV 6. PATH 7. ~ 8. ! 9. ?

option of the mv command that overwrites a destination file with the same name, if the source file is newer than the one in the destination paste -i > (gt;) -t -u -d -r -c -name

-u

The ____ option of the grep command displays only lines that do not contain the search pattern. -v -n -o -r

-v

The ____ option of the diff command is used to display the differences side-by-side in columns. -s -c -n -y

-y

One way to run a shell script is to make it executable by using the x permission and then typing ____ prior to the script name when you run the script itself. ./ /. . ..

./

To run the myscript shell script located in the current directory, you should enter: ____. start myscript /.myscript run myscript ./myscript

./myscript

1. compares sorted files and shows differences 2. selects lines or rows 3. counts characters, words, or lines in a file 4. selects columns (fields) 5. compares and selects differences in two files 6. formats and prints 7. edits data streams 8. sorts and merges multiple files 9. translates and deletes character by character Choose from: comm cut diff grep pr sed sort tr wc

1. comm 2. grep 3. wc 4. cut 5. diff 6. pr 7. sed 8. sort 9. tr

You can use the ____ operator to redirect commands or program error messages from the screen to a file. 1> 2> 3> 4>

2>

By default, pr formats the specified files into single-column pages of ____ lines. 22 33 55 66

66

can be used with cat to combine the contents of two files paste -i > (gt;) -t -u -d -r -c -name

> (gt;)

A high-level language is a computer language that uses English-like expressions. True False

True

Moving and renaming a file are essentially the same operation. True False

True

The Bash shell offers improved features over the older Bourne and Korn shells and is fully backward compatible with the Bourne shell. True False

True

The pipe operator can connect several commands on the same command line. True False

True

UNIX/Linux store data, such as letters, product records, or vendor reports, in flat ASCII files. True False

True

You can complete a project using awk that you cannot complete using a combination of paste, cut, sort, and join. True False

True

You can use the less command with a directory to view its contents one screen at a time, such as less /sbin. True False

True

You can use the vi editor to create script files. True False

True

You should omit spaces when you assign a variable without using single or double quotation marks around its value. True False

True

To append new lines in sed, you must use the ____ command a\ -a \a >a

a\

The ____ command is used to look for patterns in files. awk find pattern search

awk

The ____ statement simplifies the selection of a match when you have a list of choices. if switch case while

case

Logic structures supported by shell scripts include: sequential logic, decision logic, looping logic, and ____________________ logic.

case?

____ gives the owner read, write, and execute permissions. chmod 155 chmod 551 chmod 577 chmod 755

chmod 755

The ____ command locates identical lines within two identically sorted files. diff sed uniq comm

comm

The ____ reads the lines of code that the programmer wrote in the source file and converts them to the appropriate machine-language instructions. compiler linker assembler interpreter

compiler

Logic structures are also called ____ structures. decision sequential control programming

control

The command > accountsfile ____. deletes de file accountsfile is not valid in UNIX/Linux systems displays the contents of the file accountsfile on the screen creates an empty file called accountsfile

creates an empty file called accountsfile

To reference a variable, you use a dollar sign ($) in front of it or enclose it in ____. square brackets ([ ]) curly brackets ({ }) double quotes (“ ”) angle brackets (< >)

curly brackets ({ })

When you assign a value to a variable, you might want to evaluate it by displaying its contents via a(n) ____ operator. definition echo evaluating print

evaluating

By default, each page in the output of pr has a ____-line header, which, by default, contains the current file's name, its last modification date, the current page, and a trailer consisting of blank lines. three four five six

five

Wildcard characters are also known as ____ characters. bogus filler glob search

glob

You use the ____ command to search for a specified pattern in a file, such as a particular word or phrase. find grep sed diff

grep

The UNIX/Linux shell acts as a(n) ____ when reading script files. compiler interpreter assembler linker

interpreter

A sorting ____ is a field position within each line. index key column position

key

The join command is used to associate information in two different files on the basis of a common field or ____ in those files. index link column key

key

To redirect the list of the files in a directory to a file called homedir.list, you enter ____. ls < homedir.list ls > homedir.list homedir.list < ls homedir.list > ls

ls > homedir.list

To move a file, you use the ____ command along with the source file name and destination name. rm rename mv move

mv

combines files side by side paste -i > (gt;) -t -u -d -r -c -name

paste

The ____ redirects the output of one command to the input of another command. output redirection operator (&gt;) input redirection operator (&lt;) pipe operator (|) tilde (~)

pipe operator (|)

You use the ____ character in script files to mark comments. tilde (~) dollar ($) pipe (|) pound (#)

pound (#)

The ____ command prints a listing of environment and configuration variables. printenv printvar printf bash

printenv

The ____ function within the awk command is used to format output. out outln print printf

printf

Character special files are used by input/output devices for communicating one character at a time, providing what is called ____ data. raw binary ASCII block

raw

In UNIX/Linux, text files and binary files are considered to be ____ files. executable document regular dynamic

regular

The ____ option of the uniq command instructs it to generate as output only the lines of the source file that are not duplicated successively. -d -s -o -u

-u

when deleting a directory with rm, this option is used to recursively delete its files and subdirectories paste -i > (gt;) -t -u -d -r -c -name

-r

The cp ____ option creates a symbolic link or name at the destination rather than a physical file. -s -y -l -n

-s

option of the sort command used to indicate that a specific character separates the fields paste -i > (gt;) -t -u -d -r -c -name

-t

When using the printf function, ____ indicates that the output is to appear in decimal digits. %i -i %d -d

%d

The ____ option of the diff command does not compare for blank lines. -b -B -c -C

-B

The ____ option of the diff command ignores blanks that repeat. -b -B -c -C

-b

The ____ option of the diff command shows lines surrounding the line that differs. -d -D -c -C

-c

this option prevents the touch command from creating a file, if it does not already exist paste -i > (gt;) -t -u -d -r -c -name

-c

The ____ option of the paste command is used to specify a different separator as a delimiter. -t -o -d -s

-d

option of the cut command used to indicate that a specific character separates the fields paste -i > (gt;) -t -u -d -r -c -name

-d

option of the cp command that provides a warning before an existing file with the same name is overwritten paste -i > (gt;) -t -u -d -r -c -name

-i

The ____ option of the find command displays files that have been changed within the last n minutes. -min n -cmin n -nmin n -mmin n

-mmin n

The ____ option of the find command displays files that have been changed within the last n days. -cdays n -ctime n -mdays n -mtime n

-mtime n

is an option of the find command paste -i > (gt;) -t -u -d -r -c -name

-name

When you use find, it is useful to note that some UNIX versions require the ____ option after the file name to display the names of files. -display -print -show -names

-print

____ is a full-featured programming language. Sed Awk Emacs Grep

Awk

The ____ shell, when compared to the other shells, has a more powerful programming interface. Bourne Bash C Korn

Bash

____ variables are used to store information about the setup of the operating system, and after they are set up, you typically do not change them. Global Environment Configuration Shell

Configuration

A popular use of pr is to convert lowercase characters to uppercase characters. True False

False

Shell scripts can automatically access variables created and assigned on the command line. True False

False

Shell scripts run more quickly than compiled programs. True False

False

The command rmdir can be used to delete a directory that is not empty. True False

False

When using wc, you cannot specify all three options (-l, -w and -c) in the command line at the same time. True False

False

When you are moving files, using the -o option with the mv command can be a good idea so that you don't unexpectedly overwrite a destination file with the same name. True False

False

When you use cat to combine two files into a third file, the first line of the output contains the first line of the first file followed by the first line of the second file. True False

False

When you use the paste command, by default, the pasted results appear in columns separated by commas. True False

False

You can use the < operator to redirect a command's output from the screen to a file. True False

False

You use the chexec command to indicate that a (shell script) file can be executed. True False

False

You can use the ____________________ command to associate lines in two files on the basis of a common field in both files.

Join?

Bash is a freeware derivative of the Bourne and ____ shells. Korn C csh tsh

Korn

____ operators compare the relationship between two values or arguments. Evaluation Comparison Logical Relational

Relational

____ variables are those you create at the command line or in a shell script. Global Environment Configuration Shell

Shell


Ensembles d'études connexes

sociocultural approach - stereotypes

View Set

HIST 1301-History to 1877- Unit 1 EXAM

View Set

Microbiology - Exam 2 + 3 + 4 Study Guide

View Set

Bk 1 - Chp 1.1 - Plato's Demiurge

View Set

LETRS Units 5 - 8 Pre & Post Test

View Set

Chapter 8: Digital Devices and Media

View Set