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.