HW#6 Flashcards

1
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) Run a spell checker on the script to ensure it contains no bugs.

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) Set one or more executable bits using chmod.

A

E) Set one or more executable bits using chmod.

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

ASCII supports _____ unique characters.

A) 128

B) 32

C) 256

D) 64

A

A) 128

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

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

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

B) 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.

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

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

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

A

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

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

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

A) 1

B) 0

C) 10

D) 100

A

B) 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
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) load

C) top

D) cpu

A

C) top

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

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

A) d

B) b

C) a

D) u

A

D) u

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
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) chmod a+x ./my-script

B) su a+x myscript

C) grep a+x ./myscript

D) apt-get a+x ./myscript

A

A) chmod a+x ./my-script

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
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) u

B) uid

C) w

D) whoami

A

C) w

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
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 system administrator (root) account.

B) It’s a guest account.

C) It’s an account with no privileges.

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

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
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 users passwords for that Linux computer.

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

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

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

A

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

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

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

A) backward compatible

B) hierarchal

C) flexible

D) executable

A

D) executable

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

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

A) email

B) awk

C) sed

D) mail

A

D) mail

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

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

A) wipe

B) remove

C) delete

D) release

A

B) remove

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

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

A) True

B) False

A

B) False

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

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

A) True

B) False

A

B) False

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

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

A) True

B) False

A

A) True

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

!/bin/bash

True or false: The following script launches three simultaneous instances of the terminal program.

terminal
terminal
terminal

A) True

B) False

A

B) False

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

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

A) True

B) False

A

A) True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
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) False

20
Q

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

A) True

B) False

A

B) False

21
Q

Using the image below, what does the x character represent?
romanx1025:100::/home/roman:/bin/bash

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

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

C) An account with no password set.

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

A

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

22
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) ps

B) process

C) get pid

A

A) ps

23
Q

What is another name for a bash shell script that you might see?

A) hashpling

B) shellbash

C) bigbash

D) tinybash

A

A) hashpling

24
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 copies the contents of big.cc to big.c, eliminating the old big.c.

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

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

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

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

A

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

25
Q

What is the purpose of conditional expressions in shell scripts?

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

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

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

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

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

A

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

26
Q

Which command would reveal the total RAM statistics about your Linux system?

A) ram

B) free

C) swap

D) mem

A

B) free

27
Q

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

A) help

B) whereami

C) whoami

D) uid

A

C) whoami

28
Q

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

A) /bin/bash

B) echo

C) copy

E) touch

A

B) echo

29
Q

Which file now stores users passwords in the Linux OS?

A) /etc/groups

B) /etc/shadow

C) /etc/passwd

D) /etc/user

A

B) /etc/shadow

30
Q

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

A) Esc-S

B) F3

C) Ctrl+W

D) F6

E) Ctrl+F

A

C) Ctrl+W

D) F6

31
Q

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

A) Fedora

B) Red Hat

C) Linux Mint

D) SUSE Enterprise

E) CentOS

F) Ubuntu

A

A) Fedora

B) Red Hat

D) SUSE Enterprise

E) CentOS

32
Q

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

A) DPKG

B) TAR

C) BASH

D) RPM

A

A) DPKG

D) RPM

33
Q

Which of the following commands will install the GIMP software application on an RPM-based Linux OS?

A) dpkg install gimp

B) yum install gimp

C) apt-get install gimp

D) yummy install gimp

A

B) yum install gimp

34
Q

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

A) #!/bin/sh

B) #!

C) !#/bin/sh

D) !#/bin/bash

A

A) #!/bin/sh

35
Q

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

A) .sh

B) .st

C) .sr

D) .sc

A

A) .sh

36
Q

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

A) /etc/shadow

B) /etc/passwd

C) /etc/users

D) /etc/linux/users

A

B) /etc/passwd

37
Q

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

A) Debian

B) OpenSUSE

C) Linux Mint

D) Ubuntu

A

B) OpenSUSE

38
Q

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

A) |

B) +

C) >

D)&raquo_space;

A

A) |

39
Q

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

A) end

B) eol

C) easc

D) esac

A

D) esac

40
Q

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

A) The path to the user’s GUI desktop environment

B) The user’s account home directory

C) The path to the user’s default text-mode shell

D) A detailed list of every group the user belongs

E) The UID

A

B) The user’s account home directory

C) The path to the user’s default text-mode shell

E) The UID

41
Q

Which of the following would you use the yum command to install or upgrade applications? (choose all that apply)

A) Red Hat

B) Ubuntu

C) Fedora

D) CentOS

A

A) Red Hat

C) Fedora

D) CentOS

42
Q

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

A) !

B)&raquo_space;

C) *

D) @

A

A) !

C) *

43
Q

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

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

B) A LibreOffice word processing document

C) An HTML Web page file

D) An /etc/X11/xorg.conf configuration file

E) A /var/log/messages log file

A

B) A LibreOffice word processing document

44
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) root iptables -L

B) su iptables -L

C) sudo iptables -L

D) admin iptables -L

A

C) sudo iptables -L

45
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/root

D) ?!/bin/sh

A

A) #!/bin/sh