What is wrong with the following command string: ls /etc/hosts >listofhostfile ?

Chapter 7 Review1.Because Standard Error and Standard Output represent the results of a command andStandard Input represents the input required for a command, only Standard Error andStandard Output can be redirected to/from a file. True or False?

What is wrong with the following command string: ls /etc/hosts >listofhostfile ?

2.Before a user-defined variable can be used by processes that run in subshells, thatvariable must be ___

3.The alias command can be used to make a shortcut to a single command. True or False?

What is wrong with the following command string: ls /etc/hosts >listofhostfile ?

4.Which of the following files is always executed immediately after any user logs in to aLinux system and receives a BASH shell?

5.Which command could you use to see a list of all environment and user-defined shellvariables as well as their current values?

6.Every if construct begins with if and must be terminated with ___.

Newly uploaded documents

13.You have redirected stderr to a file called Errors. You view the contents of this file afterward andnotice that there are six error messages. After repeating the procedure, you notice that there areonly two error messages in this file. Why?a.After you open the file and view the contents, the contents are lost.b.The system generated different stdout.c.You did not append the stderr to the Errorfile and as a result, it was overwritten when thecommand was run a second time.d.You must specify a new file each and every time you redirect as the system creates thespecified file by default.Answer: c

14.The sed and awk commands are filter commands commonly used to format data within a pipe.

We have textbook solutions for you!

What is wrong with the following command string: ls /etc/hosts >listofhostfile ?

The document you are viewing contains questions related to this textbook.

Linux+ and LPIC-1 Guide to Linux Certification

Eckert

Expert Verified

15.What is wrong with the following command string: ls /etc/hosts>listofhostfile?

16.Which of the following is not necessarily generated by every command on the system? (Choose allthat apply.)

17.Which construct can be used in a shell script to read stdinand place it in a variable?a.readb.sumc.verifyd.testAnswer: a

18.A for construct is a loop construct that processes a specified list of objects.As a result, it is

19.What does >> accomplish when entered on the command line after a command?

20.Consider the following shell script:echo -e “What is your favorite color?--> \c”read REPLYif [ “$REPLY” = “red”–o“$REPLY” = “blue” ]thenecho “The answer is red or blue.”elseecho “The answer is not red nor blue.”fiWhat would be displayed if a user executes this program and answered Blue when prompted?

Project 8-1Step 1: Not available.Step 2: Not available.Step 3: Yes as the out put of the ls command is shown for the first two files and Standard Error is generatedas the third file does not exist.Step 4: No Standard Ouput has been redirected, but Standard Error generated by the lack of the sample3file still is displayed to the default location as it has not been redirected.Step 5: The contents are the redirected output of the ls command previously displayed to the screen in Step3.

Which command could you use to see a list of all environment and user defined shell variables as well as their current values?

We can see a list of all of our environmental variables by using the env or printenv commands. In their default state, they should function exactly the same: printenv.

Which command can be used to see processes running in the background?

Any time the system is running, processes are also running. You can use the ps command to find out which processes are running and display information about those processes. The ps command has several flags that enable you to specify which processes to list and what information to display about each process.

What two commands will display the first or last respectively 10 lines of a file when using default options?

To display the first or last ten lines of a file, use head or tail , respectively.

What is the character used to separate elements on the Linux command line?

The SPACE and TAB characters separate tokens (elements) on the command line and are collectively known as whitespace or blanks.