HW#4 Flashcards

1
Q

What is the purpose of conditional expressions in shell scripts?

A) They prevent scripts from executing if license conditions aren’t met.

B) They display information about the script’s computer environment.

C) They enable the script to take different actions in response to variable data.

D) They enable scripts to learn in a manner reminiscent of Pavlovian conditioning.

E) They cause scripts to run only at specified times of the day.

A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which command would you type if you wanted to display your username from a Linux command line terminal shell?

A) he|p

B) uid

C) whereami

D) whoami

A

D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which Linux directory usually holds the system
configuration files?

A) /etc

B) /boot

C) /usr

D) /home

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which file now stores user’s passwords in the Linux OS?

A) /etc/groups

B) /etc/passwd

C) /etc/shadow

D) /etc/user

A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of the following Linux command-line tools supports both gzip and bzip2 compression?

A) tar

B) zcat

C) archive

D) zip

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

____ files are those that control how the computer operates.

A) System

B) Boot

C) Shutdown

D) Archive

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are two forms of regular expressions used in Linux?

A) Basic

B) Extended

C) Hexadecimal

D) Alphanumeric

A

A and B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

To have a script send an email automatically, which command would you use to do this?

A) mail

B) sed

C) awk

D) email

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

_____ are collections of programming functions that can be useful to many programs.

A) Libraries

B) Tarballs

C) Files

D) Subdirectories

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

You work as a Network Administrator for a company, and they have a Linux based network. You have created a script named if.cgi. You want to provide the following permissions on it:

rwsr-sr–

A) chmod 6754

B) chmod 2754

C) chmod 4754

D) chmod 7754

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which wildcard character can be matched for any one symbol in a filename?

A) ?

B) *

C) /

D) +

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following would you use yum command to install or upgrade applications?

A) Red hat

B) Fedora

C) Unbutu

D) CentOS

A

A, B, and D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True or false: Many (not all) configuration files use a hash mark (#) to identify comment lines?

A) True

B) False

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which two keyboard characters can denote an account with no password?

A) @

B) *

C)&raquo_space;

D) !

A

B and D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which of the following redirection operators appends a program’s standard output to an existing file, without overwriting that file’s original contents?

A)&raquo_space;

B) |

C) 2>

D) &>

E) >

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which of the following directories is where you would find the new mount point for removable media in the Linux OS?

A) /media

B) /mount

C) /run

D) /root

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is the filename extension for the bzip2 compression program?

A) .bz2

B) .bz

C) .2bz

D) .zb2

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Which of the following type of user information might you find in the /etc/passwd file? (Choose three)

A) The UID

B) A detailed list of every group the user belongs

C) The users account home directory

D) The path to the users GUI desktop environment

E) The path to the users’ default text-mode shell

A

A, C, and E

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

True or false: To compress files archived with the zip command, you must use an external compression program such as gzip or bzip2 in a pipeline with zip.

A) True

B) False

A

B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

True or false: The regular expression Linu[&c.circ;x].*lds matches the string. Linux Torvalds.

A) True

B) False

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

A ____is when the standard output from one program is redirected as the standard input to a second program.

A) Pipe

B) Stem

C) Tunnel

D) Tube

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Which optional parameter would you use with the Linux sort command to ignore case sensitivity?

A) -f

B) -o

C) -i

D) -d

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

If you are in the Vi text editor command mode, which keystroke would you type to undo a change?

A) b

B) u

C) d

D) a

A

B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

If you wanted to run/execute a script called my-script. what could you type in the Linux terminal shell to accomplish this?

A) grep a+x ./myscript

B) apt-get a+x ./myscript

C) chmod a+x ./my-script

D) su a+x myscript

A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Which of the following are the two major Linux package management systems?

A) RPM

B) BASH

C) DPKG

D) TAR

A

A and C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Which of the following syntaxes will you use to extract a file using the tar command?

A) tar-zvf {.tgz-file}

B) tar-zxvf {.tgz-file}

C) tar-cvff {.tgz-file}

D) tar-zwvf {.tgz-file}

A

B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Which of the following files would you search in order to obtain information about a user in a Linux OS?

A) /etc/passwd

B) /etc/shadow

C) /etc/users

D) /etc/linux/users

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

True or false: You can easily damage your Linux installation by mistyping an rm command when you log into your regular account.

A)True

B) False

A

B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Which of the following actions is performed when a file is uncompressed?

A) Extract

B) Execute

C) Remove

D) Archive

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Which Linux command line tool would give you the following output?

mycc@mycc-ubuntu:-$ cd Documents
mycc(dmycc -ubuntu : ~/Document* $ ____ text .file
1 2 12 text.file
mycc@mycc-ubuntu:-/Documents$ []

A) wc

B) apt-get

C) nw

D) greP

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q
What is the effect of the following short script, cp1, if it’s called as cp1 big.c.big.cc?
#!/bin/bash
cp $2 $1

A) It has the same effect as the cp command”copying the contents of big.c to big.cc.

B) It compiles the C program big.c and calls the result big.cc.

C) It copies the contents of big.cc to big.c, eliminating the old big.c.

D) It converts the C program big.c into a C++ program called big.cc.

E) The script’s first line is invalid, so it won’t work.

A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

Which of the following statements would you need to include in a case statement to denote the end of the case statement?

A) eol

B) esac

C) end

D) ease

A

B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

You want to run the following command inside your Linux terminal: iptables -L but know you will need to have root access to do so. If you are logged in under a basic user account, which command could you add to give you root access for just this command?

A) su iptables -L

B) root iptables-L

C) sudo iptables-L

D) admin iptables-L

A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

Which keystrokes invoke the pico or nano search function? (Choose two)

A) F3

B) F6

C) Esc-S

D) Ctrl + F

E) Ctrl + W

A

B and E

35
Q

If you were to type the following in a Linux command line terminal, what type of results might you receive? cat /etc/passwd

A) An encrypted list of all user’s passwords for that Linux computer.

B) An un-encrypted list of all user passwords for that Linux computer.

C) A list of all user ID numbers for that Linux computer.

D) A list of the users on that Linux computer.

A

D

36
Q

Which Linux command-line tool would give you this list in alphabetic order?

mycc®mycc-ubuntu:~/Documents$ cat animals.txt
rabbit
monkey
dog
cat
bird
snake
giraffe
mycc®mycc-ubuntu:~/Documents$ \_\_\_\_ animals.txt
bird
cat
dog
giraffe
monkey
snake
mycc®mycc-ubuntu:~/Documents$

A) sort

B) cut

C) ftnd

D) wc

A

A

37
Q

True or false: A user types myscript laser.txt to run a script called myscript. Within myscript. the SO variable holds the value laser.txt.

A) True

B) False

A

B

38
Q
True or false: The following script launches three simultaneous instances of the terminal program.
#!/bin/bash
terminal
terminal
terminal

A) True

B) False

A

B

39
Q

How would you remove two lines of text from a file using the Vi text editor?

A) In command mode, position the cursor on the first line and type 2dd.

B) In command mode, position the cursor on the last line and type 2yy.

C) In insert mode, position the cursor at the start of the first line, hold down the Shift key while pressing the Down arrow key twice, and press the Delete key on the keyboard.

D) In insert mode, position the cursor at the start of the first line and press Ctrl+K twice.

E) Select the text with the mouse and then select File » Delete from the menu.

A

A

40
Q

What could you type in a Linux command line terminal shell to see a list of all process IDs (PID) on your computer?

A) process

B) ps

C) get paid

D) get rid

A

B

41
Q

Which single keyboard character represents any single character except in a new line in a regular expression in Linux?

A) .

B) !

C) $

D) #

A

A

42
Q

Which of the following Linux command-line tool is used to extract a compressed file?

A) gunzip

B) gzip

C) bzip2

D) ext

A

A

43
Q

What are the two types of outputs that can result in using basic redirection operators in Linux?

A) Standard output

B) Standard error

C) uniform output

D) uniform error

A

A and B

44
Q

Once a shell script has been written, it must be made ____ in order to run it.

A) hierarchal

B) executable

C) backwards compatiable

D) flexible

A

B

45
Q

To uninstall an application using the apt-get command, you would type apt-get _____.

A) delete

B) wipe

C) remove

D) release

A

C

46
Q

Complete the following command to redirect both standard output and standard error from the bigprog program to the file out.txt:
$ bigprog____out.txt

A) &>

B) |

C) ~

D)&raquo_space;

A

A

47
Q

True or false: The find command enables you to locate files based on their sizes.

A) True

B) False

A

A

48
Q

Which of the following command-line tools would be the best to use when compressing more than two files inside a Linux system?

A) tar

B) gunzip

C) gzip

D) bzip2

A

A

49
Q

True or False? You’ve typed rmdir junk to delete the junk directory, but this command has failed because junk contains word processing files. To do the job. you type rm -r junk.

A) True

B) False

A

A

50
Q

You’ve written a simple shell script that does nothing but launch programs. In order to ensure that the script works with most user shells, what should its first line read?

A) ?!/bin/sh

B) #!/bin/ls

C) #!/bin/sh

D) #!/bin/sh/root

A

C

51
Q

Which character represents the start of a line in a regular expression?

A) ^

B) |

C) %

D) &

A

A

52
Q

True or false: Many (not all) configuration files use a hash mark (#) to identify comment lines?

A) True

B) False

A

A

53
Q

You want to copy a directory, MyFiles, to a USB flash drive that uses the FAT filesystem. The contents of MyFiles are as follows:

$ Is -I MyFiles/
total 276
-rw-r-r– 1 jen users 129840 Nov 8 15:13 contract.odt
-rw-r-r– 1 rod users 42667 Nov 8 15:12 outline.pdf
-rw-r-r– 1 sam users 105979 Nov 8 15:12 Outline.PDF

The USB flash drive is mounted at /media/usb. and so you type cp -a MyFiles//media/usb. What problem will occur when you attempt to copy these files?

A) One file will be missing on the USB flash drive.

B) Everything will be fine; the command will work correctly.

C) One file’s name will be changed during the copy.

D) The command will fail because it tries to create links.

E) The MyFiles directory will be copied, but none of its files will be copied.

A

A

54
Q

If you were in a Linux command line terminal and saw a system account with the UID of 0, what would that indicate?

A) It’s the first user account created by the OS.

B) It’s the system administrator (root) account.

C) It’s an account with no privileges.

D) It’s a guest account.

A

B

55
Q

Using the image below, what does the x character represent?

roman x l025:100::/home/roman:/bin/bash

A) An un-encrypted password stored in the/etc/shadow file.

B) An encrypted password stored in the /etc/passwd file.

C) An encrypted password stored in the /etc/shadow file.

D) An account with no password set.

A

C

56
Q

True or false: You can set a directory’s timestamps with the touch command.

A) True

B) False

A

A

57
Q

True or false: Valid looping statements in Bash include for. while, and until.

A) True

B) False

A

A

58
Q

Which command would you use to display prompts for a user in a shell script?

A) touch

B) copy

C) /bin/bash

D) echo

A

D

59
Q

True or false: Unicode is useful for encoding most European languages but not Asian languages.

A) True

B) False

A

B

60
Q

True or false: GUI text editors for ASCII are superior to text-mode ASCII text editors because the GUI editors support underlining, italics, and multiple fonts.

A) True

B) False

A

B

61
Q

If you were doing a regular expression inside a Linux command line, which special character on the keyboard would give you two possible matches using the example below:

car____truck

A) |

B) \

C) /

D) []

A

A

62
Q

ASCII supports___unique characters.

A) 32

B) 64

C) 128

D) 256

A

C

63
Q

If you are a Linux system administrator and wanted to locate any programs that are consuming large amounts of the CPU or memory, what command-line tool would help assist you with this?

A) pid

B) top

C) load

D) cpu

A

B

64
Q

True or false: Linux stores information on groups in the /etc/groups file.

A) True

B) False

A

B

65
Q

Which of the following directories stores package database information?

A) /var/lib

B) /usr/Iib

C) /etc/lib

D) /tmp/lib

A

A

66
Q

Which of the following extensions would you use at the end of the script name?

A) .st

B) .sh

C) .sc

D) .sr

A

B

67
Q

True or false: You can create a symbolic link from one low-level filesystem to another.

A) True

B) False

A

A

68
Q

Which compression file format can be used across multiple operating systems (Linux, Windows. Mac OS)

A) zip file

B) tar file

C) xzfile

D) pdf file

A

A

69
Q

You type mkdir one/two/three and receive an error message that reads, in part, No such file or directory. What can you do to overcome this problem?

A) Issue three separate mkdir commands: mkdir one. then mkdir one/two. and then mkdir one/two/three.

B) Type rmdir one to clear away the interfering base of the desired new directory tree.

C) Type rm -r one to clear away the entire interfering directory tree.

D) Type touch /bin/mkdir to be sure the mkdir program file exists.

A

A

70
Q

Which of the following are considered RPM-based Linux distributions? (choose all that apply)

A) Red Hat

B) Fedora

C) Ubuntu

D) Linux Mint

E) CentOS

F) SUSE Enterprise

A

A, B, E, and F

71
Q

If you were a Linux system administrator and wanted to see who is currently logged into the computer and what programs they are currently running, you can type the command.

A) w

B) whoami

C) uid

D) u

A

A

72
Q

Which single keyboard character represents any single character except in a new line in a regular expression in Linux?

A) .

B) !

C) $

D) #

A

A

73
Q

Which of the following entries would you use on the first line of a script you are creating in Linux?

A) #!

B) #!/bin/sh

C) !#/bin/bash

D) !#/bin/sh

A

B

74
Q

Which of the following keyboard strokes would you use to connect two or more commands in Linux?

A) >

B)&raquo_space;

C) |

D) +

A

C

75
Q

If a Linux system has no programs demanding CPU time what number would best represent the load average on that computer?

A) 0

B) 1

C) 10

D) 100

A

A

76
Q

Which type of file is nano LEAST likely to be useful for examining or editing?

A) A /var/log/messages log file

B) An HTML Web page file

C) An e-mail message saved from an e-mail client

D) A LibreOffice word processing document

E) An /etc/Xll/xorg.conf configuration file

A

D

77
Q

After using a text editor to create a shell script, what step should you take before trying to use the script by typing its name?

A) Set one or more executable bits using chmod.

B) Copy the script to the /usr/bin/scripts directory.

C) Compile the script by typing bash scriptname, where scriptname is the script’s name.

D) Run a virus checker on the script to be sure it contains no viruses.

E) Run a spelI checker on the script to ensure it contains no bugs.

A

A

78
Q

Which of the following is NOT considered a Debian based Linux distribution?

A) Debian

B) Ubuntu

C) Linux Mint

D) OpenSUSE

A

D

79
Q

Which optional parameter would you use with the Linux tar command to extract files from an archive?

A) -x

B) -d

C) -A

D) -c

A

A

80
Q

Which of the following Linux commands will print lines from the file world.txt that contain matches to changes and changed?

A) grep change[ds] world.txt

B) tar change[d-s] world.txt

C) find “change’d|s”’ world.txt

D) cat world.txt changes changed

E) find change[&c.circ;ds] world.txt

A

A

81
Q

Which file hierarchy structure was created to give a standardization to the Linux filesystem structure?

A) FHS

B) SMB

C) SMS

D) NTFS

A

A

82
Q

Which of the following actions does the find command perform?

A) Searching a file in a directory

B) Changing text in a file

C) Listing all hidden files and directories

D) Matching a pattern in a file

A

A

83
Q

What are the two types of FHS files found in the Filesystem Hierarchy Standard?

A) Standard

B) Variable

C) Synchronous

D) Asynchronous

A

A and B