CIS330 Linux Chapter 7 Working with the BASH Shell

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

filter

A __________________________ command is any command that can take standard input and transform it to standard output.

pipe

A __________________________ is a string of commands connected by the "|" metacharacters. The shell then sends the stdout on the left to the stdin on the right.

This would simply send the stdout to the goodoutput file. The stderr is still displayed on the screen because it was not redirected to a file.

A command may be in the form of the following: ls /etc/hosts /etc/h 1>goodoutput Explain what this command is doing.

This would simply send the stderr to the badoutput file. The stdout is still displayed on the screen because it was not redirected to a file.

A command may be in the form of the following: ls /etc/hosts /etc/h 2>badoutput Explain what this command is doing.

Both stdout and stderr are displayed on the terminal screen by default.

Both stdout and stderr are displayed on the terminal screen by default.

file descriptors

Command input and output are represented by labels known as

Stdin is represented by the number 0. Stdout is represented by the number 1. Stderr is represented by the number 2.

Every file descriptor is represented by a number. State the file descriptors and their represented numbers.

beginning

Filter commands must be at the __________________________ of a pipe.

ls /etc/hosts /etc/h >goodoutput 2>&1

If the user redirects the Standard Output and Standard Error to the same file without any loss of data, special notation must be used. The following command can be used:

tr l L </etc/hosts

It does not modify the /etc/hosts file. It merely translates all of the "l"'s to "L"'s and displays the output on the screen.

tr l L </etc/hosts >newhosts

It does the same thing as the previous command which is translates all of the "l"'s to "L"'s. However, it does not display the output on the screen but rather saves the output to a file named newhosts.

It is best to redirect the content of Standard Output and Standard Error to two separate files.

It is best to redirect the content of Standard Output and Standard Error to two separate files.

Piping is commonly used to reduce the amount of information displayed on the terminal screen from commands that display too much information.

Piping is commonly used to reduce the amount of information displayed on the terminal screen from commands that display too much information.

Redirection only occurs from a command to a file and vice versa.

Redirection only occurs from a command to a file and vice versa.

Some commands on the Linux system only accept files when they are passed by the shell through Standard Input. Therefore to redirect stdin of a file, the user must use the "<" shell metacharacter.

Some commands on the Linux system only accept files when they are passed by the shell through Standard Input. Therefore to redirect stdin of a file, the user must use the "<" shell metacharacter.

The BASH shell can be used to redirect stdout and stderr from the terminal screen to a file on the filesystem using the ">" shell metacharacter followed by the absolute or relative pathname of the file.

The BASH shell can be used to redirect stdout and stderr from the terminal screen to a file on the filesystem using the ">" shell metacharacter followed by the absolute or relative pathname of the file.

The BASH shell clears the contents of the goodoutput file if it exists and creates the file if it does not exist.

The BASH shell clears the contents of the goodoutput file if it exists and creates the file if it does not exist.

The BASH shell is responsible for providing a user interface and interpreting commands entered on the command line. In addition, the BASH shell can manipulate command input and output, provided the user specifies certain shell metacharacters on the command line alongside the command.

The BASH shell is responsible for providing a user interface and interpreting commands entered on the command line. In addition, the BASH shell can manipulate command input and output, provided the user specifies certain shell metacharacters on the command line alongside the command.

The Bash shell clears a file that already exists before performing the redirection.

The Bash shell clears a file that already exists before performing the redirection.

tr

The __________________________ command can be used to replace characters in a file sent via Standard Input.

The ls and mount commands are not filter commands because they do not accept Standard Input from other commands.

The ls and mount commands are not filter commands because they do not accept Standard Input from other commands.

The order of redirection on the command line does not matter.

The order of redirection on the command line does not matter.

s /etc/hosts /etc/h >goodoutput 2>badoutput

The user can redirect both Standard Output and Standard Error to separate files at the same time, as shown in the following output,

The user can redirect stdout and stderr to separate files.

The user can redirect stdout and stderr to separate files.

The user can send the Standard Output of one command to another command as Standard Input. To do this, the user must use the pipe | shell metacharacter and specify commands on either side. The space before and after the | symbol is optional.

The user can send the Standard Output of one command to another command as Standard Input. To do this, the user must use the pipe | shell metacharacter and specify commands on either side. The space before and after the | symbol is optional.

The user can use more than one pipe | metacharacter on the command line to pass information from one command to another over a series of commands.

The user can use more than one pipe | metacharacter on the command line to pass information from one command to another over a series of commands.

The user should use separate filenames for stdout and stderr.

The user should use separate filenames for stdout and stderr.

mount | grep /dev/sda

This command executes the mount command and displays only those lines in the output dealing with the /dev/sda directory.

ls -l /etc | less

This command sends the output of the ls command to the input of the less command.

cat prologue | tr a A | sort | pr -d | less

This command takes the prologue file and translates the "a"'s to "A"'s and then sorts the lines in alphabetical order. In addition, it displays the file on the terminal double spaced and allows the user to view the results page-by-page.

Standard input (stdin) Standard output (stdout) Standard error (stderr)

Three file descriptors are available to each command that can be manipulated by the BASH shell. Name them.

date >>dateoutput

To prevent the file from being cleared by the BASH shell and append output to the existing output, you can specify two ">" metacharacters alongside the file descriptor. The following is an example:

Standard error (stderr)

is a file descriptor that refers to any error messages generated by the command.

Standard input (stdin)

is a file descriptor that refers to the information processed by the command during execution, and is often takes the form of user input typed on the keyboard.

Standard output (stdout)

is a file descriptor that refers to the normal output of a command.

Redirecting the Standard Output to a file for later use is more common than redirecting the Standard Error to a file, the BASH shell assumes Standard Output in the absence of a numeric file descriptor, i.e.,

ls /etc/hosts /etc/h >goodoutput


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

lesson 5: structure of sentences?

View Set

Business Law Chapter 12 Study Guide

View Set