chapter 4-6 quiz

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

the programs that we have used so far in class produce output of some kind. this output often consists of what types: (choose all that are correct)

-status and error messages that tell us how the program is getting along -the programs results, that is, the data the program is designed to produce

in keeping with the unix theme of "everything is a file," programs such as ls actually send: (choose all that are correct)

-status messages to a file called stderr -results to a file called stdout

choose all of the following that are true statements

-symbolic links were created to overcome the limitations of hard links -unlike a symbolic link, when we list a directory containing a hard link we will see no special indication of the link - when a hard link is deleted, the link is removed but the contents of the file itself continue to exist

choose all of the following that are true statemens, w.r.t. the commands used on our vbitbus.tcc.edu system

-the "copy" command copies files or directories -the "mkdir" command is used to create directories**** -the "move" command performs both file moving and file renaming, depending on how it is used. in either case, the original filename always still exists after the operation -the "remove" command is used to remove (delete) files and directories

choose all of the true statements, given the following command example: [vbitbus.tcc.edu@linuxbox ~]$ ls -l /bin/usr > output.txt 2>&1

-the command redirects file descriptor 2 (standard error) to file descriptor 1 (standard output) using the notation 2>&1 -the command redirects standard output to file ls-output.txt -the command shows how to capture all output of a command to a single file, by redirecting both standard output and standard error at the same time

choose all of the following that are true statements

-the file streams standard input, output and error, are referenced internally by the shell as file descriptors 0,1, and 2 respectively -to redirect standard error we must refer to its file descriptor -redirecting standard error lacks the ease of a dedicated redirection operator

choose all of the following that are not true statements

-the programs results, that is, the data the program is designed to produce, tells us how the program is getting along -many programs take input from a facility called standard input (stdin) which is, by default, attached to the keyboard

choose all of the following that are not true statements

-the shell provides for redirecting files using the file descriptor number -redirect standard error by placing the file descriptor "2" immediately before the redirection operator to perform the redirection of standard error to the file specified

choose all of the following that are true statements

-using the pipe operator | (vertical bar), the standard output of one command can be piped into the standard input of another -in the absence of filename arguments, the cat command copies standard input to standard output, so we see our line of text repeated -the capacity of commands to read data from standard input and send to standard output is utilized by a shell feature called pipeline -the cat command accepts standard input, in addition to filename arguments

choose all of the following that are true statements

-using wildcards makes it possible to construct sophisticated selection criteria for filenames -wildcards can be used with any command that accepts filenames as arguments -wildcards are especially valuable not only because they are used so frequently on the command line, but because they are also supported by some graphical file managers

choose all of the following that are true statements

-with i/o redirection, we can connect multiple commands together into powerful command pipelines -with i/o redirections, we can redirect the input and output of commands to and from files

choose all of the true statements, given the following command example: [vbitbus.tcc.edu@linuxbox ~]$ ls -l /bin/usr > ls -output.txt 2>&1

***PARTIAL -the redirection of standard error must always occur after redirecting standard output or it doesnt work -there is second, more streamlined method of combing the redirections, that uses use the single notation &> to redirect both standard output and standard error TRY (along with) -the order of the redirections is not significant (F) -the redirection of standard output must always occur before redirecting standard error or it doesnt work(F)

choose the correct wild card selections and associated patterns

-*: all files -*.txt: any file ending with ".txt" -log*.txt: any file beginning with "log" followed by any characters and ending with ".txt" -data???: any file beginning with "data" followed by exactly three characters -[yXd]*: any file beginning with "y" "X" "d" -BACKUP.[0-9][0-9][0-9]: any file beginning with "BACKUP" followed by exactly three numerals -errorLog.[0-9][0-9]: any file beginning with "errorLog" followed by exactly 2 numerals -[[:upper:]]: any file beginning with an uppercase letter -[![:digit:]]*: [![:digit:]]* any file not beginning with a numeral -*[[:lower:]123]: any file ending with a lowercase or the numerals 1,2, or 3

match the wildcards with their meaning

-*: matches any characters -?: matches any single character -[characters]: matches any character that is a member of the set characters -[!characters]: matches any character that is not a member of the set characters -[[:class:]]: matches any character that is a member of the specified class -[:alnum:]: matches any alphanumeric character -[:alpha:]: matches any alphabetic character -[:digit:]: matches any numeral -[:lower:]-matches any lowercase letter -[:upper:]- matches any uppercase letter

choose all of the following that are true statements

-I/O redirection allows us to redefine where standard output goes -simply using the redirection operator with no command preceding it will truncate an existing file or create a new, empty file -most well-written Unix programs send the error messages to standard error -we can append redirected output to a file instead of overwriting the file, by using the >> redirection operator

choose all of the following that are true statements

-a hard link is indistinguishable from the file itself -a hard link may not reference a directory -a hard link cannot reference a file that is not on the same disk partition as the link itself - a hard link cannot reference a file outside its own file system

match the command with the best description

-cat: concentrate files -sort: sort lines of text -uniq: report or omit repeated lines -grep: print lines matching a pattern -wc: print newline, word, and byte counts for each file -head: output the first part of the file -tail: output the last part of the file -tee: read from standard input and write to standard output and files - show: not a valid command -last: show listing of last logged in user

match the commands with the tasks performed. no partial credit. take your time. use your book

-cp: copy files and directories -mv: move/rename files and directories -mkdir: create directories -rm: remove files and directories -ln: create hard and symbolic links -pwd: print name of current working directory -cd: change directory -ls: list directory contents -file: determine file type -less: view file contents

choose all of the true statements, given the following command example: [vbitbus.tcc.edu@linux ~]$ ls -l /bin/usr 2> /dev/null

-demonstrates suppressing error messages from a command**** -demonstrates copying a list from the user2 directory to the null directory -demonstrates redirecting standard input to null -the command does not work

choose all of the following that are true statements

-i/o redirection allows us to change where output goes -programs take input from a facility called standard input (stdin), which is, by default, attached to the keyboard - i/o redirection allows us to change where input comes from

choose all of the following that correctly complete the phrase: the bit bucket ... a special file called "/dev/null" this file is

-is an ancient and universal unix concept that has appeared in many parts of unix culture -a system device which can be used to suppress error messages from a command -a system device which accepts input and does nothing with it -a special file called "/dev/null"

match the command examples with the results

-mv file1 file2 dir1: move file1 and file2 into directory dir1. dir1 must already exist -mv file1 file2 dir1: move file1 and file2 into directory 2 into dir1. dir1 must already exist -mv file1 file2: move file1 to file2. if file2 exists, it is overwritten with the contents of file1. if file2 does not exist, it is created. in either case, file1 ceases to exist -cp dir1/* dir2: using a wildcard, all the files in dir1 are copied into dir2, dir2 must already exist -cp file1 file2 dir1: copy file1 and file2 into directory dir1. dir1 must already exist -cp file1 file2: copy file1 to file2. if file2 exists, it is overwritten with the contents of file1. if file2 does not exist it is created -mkdir dir1 dir2 dir3: creates three directories named "dir1" "dir2" and "dir3" -rm -r file1 dir1: delete file1 and dir1 and its contents -rm -rf file1 dir1: delete file1 and dir1 and its contents, except that if either file1 or dir1 do not exist, rm will continue silently -ln -s item link: create a symbolic link where "item" is either a file or a directory

choose all of the true statements given the following command example: [vbitbus.tcc.edu@linuxbox ~]$ ls -l /bin/usr &>> ls-output.txt

WRONG **** -demonstrates how the single notation &> can be used to redirect both standard output and standard error to the specified file TRY -the command does not work

with a file manager, we can drag and drop a file from one directory to another, cut and paste files, delete files and so on. so why use these old command line programs?

for power and flexibility

choose all of the following that are not true statements

hard links have no important limitations

according to our text, I/O redirection may be the coolest feature of the command line

true

the redirection of standard error must always occur after redirecting standard output or it doesnt work

true

choose all of the following that are true statements

using the >> operator will result in the output being appended to the file. if the file does not already exist, it is created just as though the > operator had been used


संबंधित स्टडी सेट्स

pass point health promotion and maintenance

View Set

EMT Chap 20: immunologic emergencies

View Set