Linux + Chapter 7

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

The first line in a script usually starts with which of the following?

#!

What is going to be the content of outputfile after running the following command? ls /etc/hosts /etc/h >output >>output

/etc/hosts

What is going to be the content of outputfile after running the following command? ls /etc/hosts /etc/h >output 2>output

/etc/hosts access /etc/h: No such file or directory

On your terminal try cat /etc/passwd. What does the following command do? cat /etc/passwd | awk -F '/bash/ {print $1, $6}'

Display the name and the home directory for root and regular users (bash users)

On your terminal try cat /etc/passwd. What does the following command do? cat /etc/passwd | awk -F: '/nologin/ {print $1}'

Display the name of the system users, which do not have a login shell (nologin)

Select the test statement that can be used to determine if A is numerically greater than B:

[ A -gt B ]

What is going to be the content of file1 after running the following command? echo AbAdBd | tr "A" "a" >file1

abadBd

What is going to be the content of the output file after running the following command? /etc/hosts /etc/h >output 2>output

bash: /etc/hosts:Permission denied

Assume the following is the output of running the command cat file1 (content of file1) Two households, both alike in dignity. From forth THE fatal loins of THEse two foes Which, but their children's end, nought could remove, Do with THEir death bury THEir parents' strife. Which of the following command replacing "THE" with "the"?

cat file1 | sed 2,4s/THE/the/g

Assume the following is the output of running the command cat file1 (content of file1) Two households, both alike in dignity. From forth THE fatal loins of THEse two foes Which, but their children's end, nought could remove, Do with THEir death bury THEir parents' strife. Which of the following command removing the lines which contain a "THE"?

cat file1 | sed remove THE

The default BASH shell prompt is set by an environment variable. What command can be used to view this variable?

echo $PS1

In an if construct, what statements are optional?

elif else

Which filter command can be used to search and replace a certain string of text?

sed

The environment variables that are set by default and their current values can be viewed with what command?

set

What two BASH environment variables represent the current working directory, and the absolute pathname of the current shell, respectively?

shell pwd

Which command can be used to transform or change characters received from Standard Input?

tr

You can use the sed command to remove unwanted lines of text. True or False?

true

Select the two commands below that will provide the number of lines in a file, and the number of characters in a file, respectively:​

wc -l wc -c

Which metacharacter is used to pipe the results of one command to another?

|

What environment file is always executed immediately after login for all users on the system, and sets most environment variables, such as HOME and PATH?

/etc/profile

Select the escape sequence that is used for a form feed:

/f

What number represents the stderr file descriptor?

2

The standard output and standard error from a terminal screen within the BASH shell can be redirected to a file on the filesystem using what shell metacharacter, followed by the absolute or relative pathname of the file?

>

Which metacharacter is used to append the results of one command at the end of a file?

>

Which metacharacters are sent the results of a command to a file and override the original contents of a file?

> 1> 2>

Which metacharacters are used to send the results of a command to a file?

> 1> 2>

The ability to extract, manipulate, and format text using pattern action statements belongs to which command below?

awk

Which of the following can display the number of comment lines in the following script, assume the name of the script is script1 #Go to home directory #cd #Create a blank file called xfile touch xfile ls -l

cat script1 | grep '#' | wc -l

What character is used to delimit most Linux configuration files?

colon

A list of all exported environment and user-defined variables in a shell can be viewed with what command?

env

What term is used to describe text that is input by a user typing on a keyboard and is used for command execution?

stdin

Any command that can be executed on the command line can also be placed inside any environment file. True or False?

true


Kaugnay na mga set ng pag-aaral

Driver's Ed Final Test Questions

View Set

Ch 29 periop practice questions - the point

View Set

Developing Helping Skills - Chapters 9 & 10

View Set

Ap psychology exam - Questions (Unit 8)

View Set

Med Surg Quiz 5 -- Ch. 65, 66, 67, 69

View Set

Ch 19: Nursing Management of Pregnancy at Risk

View Set