HW#6 Flashcards
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.
E) Set one or more executable bits using chmod.
ASCII supports _____ unique characters.
A) 128
B) 32
C) 256
D) 64
A) 128
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.
C) In command mode, position the cursor on the first line and type 2dd.
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
B) 0
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
C) top
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
D) u
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) chmod a+x ./my-script
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
C) w
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) It’s the system administrator (root) account.
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.
C) A list of the users on that Linux computer.
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
D) executable
To have a script send an email automatically, which command would you use to do this?
A) email
B) awk
C) sed
D) mail
D) mail
To uninstall an application using the apt-get command, you would type apt-get _____.
A) wipe
B) remove
C) delete
D) release
B) remove
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
B) False
True or false: Linux stores information on groups in the /etc/groups file.
A) True
B) False
B) False
True or false: Many (not all) configuration files use a hash mark (#) to identify comment lines?
A) True
B) False
A) True
!/bin/bash
True or false: The following script launches three simultaneous instances of the terminal program.
terminal
terminal
terminal
A) True
B) False
B) False
True or false: Valid looping statements in Bash include for, while, and until.
A) True
B) False
A) True
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
B) False
True or false: Unicode is useful for encoding most European languages but not Asian languages.
A) True
B) False
B) False
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.
B) An encrypted password stored in the /etc/shadow file.
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) ps
What is another name for a bash shell script that you might see?
A) hashpling
B) shellbash
C) bigbash
D) tinybash
A) hashpling
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) It copies the contents of big.cc to big.c, eliminating the old big.c.
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) They enable the script to take different actions in response to variable data.
Which command would reveal the total RAM statistics about your Linux system?
A) ram
B) free
C) swap
D) mem
B) free
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
C) whoami
Which command would you use to display prompts for a user in a shell script?
A) /bin/bash
B) echo
C) copy
E) touch
B) echo
Which file now stores users passwords in the Linux OS?
A) /etc/groups
B) /etc/shadow
C) /etc/passwd
D) /etc/user
B) /etc/shadow
Which keystrokes invoke the pico or nano search function? (choose two)
A) Esc-S
B) F3
C) Ctrl+W
D) F6
E) Ctrl+F
C) Ctrl+W
D) F6
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) Fedora
B) Red Hat
D) SUSE Enterprise
E) CentOS
Which of the following are the two major Linux package management systems?
A) DPKG
B) TAR
C) BASH
D) RPM
A) DPKG
D) RPM
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
B) yum install gimp
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) #!/bin/sh
Which of the following extensions would you use at the end of the script name?
A) .sh
B) .st
C) .sr
D) .sc
A) .sh
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
B) /etc/passwd
Which of the following is NOT considered a Debian based Linux distribution?
A) Debian
B) OpenSUSE
C) Linux Mint
D) Ubuntu
B) OpenSUSE
Which of the following keyboard strokes would you use to connect two or more commands in Linux?
A) |
B) +
C) >
D)»_space;
A) |
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
D) esac
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
B) The user’s account home directory
C) The path to the user’s default text-mode shell
E) The UID
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) Red Hat
C) Fedora
D) CentOS
Which two keyboard characters can denote an account with no password?
A) !
B)»_space;
C) *
D) @
A) !
C) *
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
B) A LibreOffice word processing document
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
C) sudo iptables -L
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) #!/bin/sh