Linux Week 4 Homework
Which of the following entries would you use on the first line of a script you are creating in Linux?
#!/bin/sh
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?
#!/bin/sh (Your Answer)
Complete the following command to redirect both standard output and standard error from the bigprog program to the file out.txt: $ bigprog _____ out.txt
&>
Which two keyboard characters can denote an account with no password?
*, !
Which optional parameter would you use with the Linux grep command in order to do a recursive search?
-E -R -c
What is the filename extension for the bzip2 compression program?
.bz2 .2bz .zb2 Next Mark For Review
Which of the following extensions would you use at the end of the script name?
.sh
Which Linux directory usually holds the system configuration files?
/etc
Which file now stores users passwords in the Linux OS?
/etc/passwd /etc/groups /etc/shadow Next Mark For Review
Which of the following files would you search in order to obtain information about a user in a Linux OS?
/etc/passwd B. /etc/shadow
Which of the following directories is where you would find the new mount point for removable media in the Linux OS?
/media /run
Which of the following directories stores package database information?
/var/lib
If a Linux system has no programs demanding CPU time what number would best represent the load average on that computer?
0
ASCII supports _____ unique characters.
128
Which of the following redirection operators appends a program's standard output to an existing file, without overwriting that file's original contents?
>>
Which wildcard character can be matched for any one symbol in a filename?
?
Which single keyboard character represents any single character except in a new line in a regular expression in Linux?
A . D. #
Which type of file is nano LEAST likely to be useful for examining or editing?
A /var/log/messages log file An HTML Web page file A LibreOffice word processing document An /etc/X11/xorg.conf configuration file Next Mark For Review
If you were a Linux system's 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 C. uid D. u
If you were to type the following in a Linux command line terminal, what type of results might you receive?
An encrypted list of all users passwords for that Linux computer. A list of all user ID numbers for that Linux computer. A list of the users on that Linux computer. Next Mark For Review
Using the image below, what does the x character represent?
An encrypted password stored in the /etc/shadow file. (Your Answer)
What is the effect of the following short script, cp1, if it's called as cp1 big.c.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.
What are two forms of regular expressions used in Linux?
Basic, Extended
Which optional parameter would you use with the Linux sort command to ignore case sensitivity?
C. -f D. -d
Which of the following is NOT considered a Debian based Linux distribution?
Debian OpenSUSE Next Mark For Rev
You want to copy a directory, MyFiles, to a USB flash drive that uses the FAT filesystem. The contents of MyFiles are as follows: 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?
Everything will be fine; the command will work correctly. One file's name will be changed during the copy. One file will be missing on the USB flash drive. The command will fail because it tries to create links. The MyFiles directory will be copied, but none of its files will be copied. Next Mark For Review
Which of the following actions is performed when a file is uncompressed?
Extract
Which keystrokes invoke the pico or nano search function? (choose two)
F6 and Ctrl W
Which file hierarchy structure was created to give a standardization to the Linux filesystem structure?
FHS
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 .
False
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.
False
True or false: Linux stores information on groups in the /etc/groups file.
False
True or false: The following script launches three simultaneous instances of the terminal program. #!/bin/bash terminal terminal terminal
False
True or false: The following script launches three simultaneous instances of the terminal program. #!/bin/bash terminal terminal terminal
False
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.
False
True or false: You can easily damage your Linux installation by mistyping an rm command when you log into your regular account.
False
Using the image below, what does the yellow dot best represent?
Files
How would you remove two lines of text from a file using the Vi text editor?
In command mode, position the cursor on the first line and type 2dd.
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?
Issue three separate mkdir commands: mkdir one, then mkdir one/two, and then mkdir one/two/three.
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?
Issue three separate mkdir commands: mkdir one, then mkdir one/two, and then mkdir one/two/three. (Your Answer)
If you were in a Linux command line terminal and saw a system account with the UID of 0, what would that indicate?
It's the system administrator (root) account.
_____ are collections of programming functions that can be useful to many programs.
Libraries Subdirectories Next Mark For Review
Which command would reveal the total RAM statistics about your Linux system?
Mem
Which of the following consists of supporting files for an application that are installed on a Linux computer?
Package
Which of the following type of user information might you find in the /etc/passwd file? (choose three)
Pick A C and E
Which of the following are the two major Linux package management systems?
RPM, DPKG
Which of the following would you use the yum command to install or upgrade applications? (choose all that apply)
Red Hat, Fedora, CentOS
Which of the following are considered RPM-based Linux distributions? (choose all that apply)
Red Hat, Fedora, CentOS, SUSE Enterprise
Which of the following actions does the find command perform?
Searching a file in a directory
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?
Set one or more executable bits using chmod. Copy the script to the /usr/bin/scripts directory. Run a virus checker on the script to be sure it contains no viruses. Next Mark For Review
What are the two types of FHS files found in the Filesystem Hierarchy Standard?
Standard & Variable
What are the two types of outputs that can result using basic redirection operators in Linux?
Standard Output & Standard Error
files are those that control how the computer operates.
System
Which of the following type of user information might you find in the /etc/passwd file? (choose three)
The UID The user's account home directory The path to the user's default text-mode shell
What is the purpose of conditional expressions in shell scripts?
They display information about the script's computer environment. They enable the script to take different actions in response to variable data. They enable scripts to learn in a manner reminiscent of Pavlovian conditioning. They cause scripts to run only at specified times of day. Next Mark For Review
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.
True
True or false: Many (not all) configuration files use a hash mark (#) to identify comment lines?
True
True or false: The find command enables you to locate files based on their sizes.
True
True or false: The regular expression Linu[&c.circ;x].*lds matches the string, Linux Torvalds.
True
True or false: The regular expression Linu[&c.circ;x].*lds matches the string, Linux Torvalds.True or false: Linux stores information on groups in the /etc/groups file.
True
True or false: Valid looping statements in Bash include for, while, and until.
True
True or false: You can create a symbolic link from one low-level filesystem to another.
True
True or false: You can set a directory's time stamps with the touch command.
True
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
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 It has the same effect as the cp command"copying the contents of big.c to big.cc. It compiles the C program big.c and calls the result big.cc. It copies the contents of big.cc to big.c, eliminating the old big.c. It converts the C program big.c into a C++ program called big.cc. Next Mark For Review
Which character that represents the start of a line in a regular expression?
^
If you wanted to run/execute a script called my-script, what could you type in the Linux terminal shell to accomplish this?
apt-get a+x ./myscript chmod a+x ./my-script su a+x myscript Next Mark For Review
What is another name for a bash shell script that you might see?
bigbash hashpling Next Mark For Review
Which of the following Linux command line tool is used to extract a compressed file?
bzip2 gunzip Next Mark For Review
Which command would you use to display prompts for a user in a shell script?
echo
Which of the following statements would you need to include in a case statement to denote the end of the case statement?
eol esac easc Next Mark For Review
Once a shell script has been written, it must be made _____ in order to run it.
executable
True or false: The following script launches three simultaneous instances of the terminal program. #!/bin/bash terminal terminal terminal
false
Which of the following Linux commands will print lines from the file world.txt that contain matches to changes and changed?
grep change[ds] world.txt
The gzip, bzip2, and xz programs all perform _____ compression, in which the decompressed data exactly matches the original pre-compression data.
lossless
To have a script send an email automatically, which command would you use to do this?
Using the screenshot below, which Linux command line tool would give you the following output?
nw wc grep
What could you type in a Linux command line terminal shell to see a list of all process IDs (PID) on your computer?
ps
To uninstall an application using the apt-get command, you would type apt-get _____.
remove
Using the image below, which Linux command line tool would give you this list in an alphabetic order?
sort
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?
su iptables -L sudo iptables -L Next Mark For Review
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?
sudo iptables -L (Your Answer)
Which of the following Linux command line tools supports both gzip and bzip2 compression?
tar
Which of the following command line tools would be the best to use when compressing more than two files inside a Linux system?
tar
Which of the following syntaxes will you use to extract a file using the tar command?
tar -zvf {.tgz-file}
Which compression file format can be used across multiple operating systems (Linux, Windows, Mac OS)
tar file xz file zip file Next Mark For Review
If you are a Linux system's 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?
top load
Which of the following commands would you type to rename a file called newfile.txt to afile.txt?
touch newfile.txt afile.txt ln newfile.txt afile.txt mv newfile.txt afile.txt Submit my answers
If you are in the Vi text editor command mode, which keystroke would you type to undo a change?
u
Which command would you type if you wanted to display your username from a Linux command line terminal shell?
whoami
Which of the following commands will install the GIMP software application on an RPM-based Linux OS?
yum install gimp
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
|
Which of the following keyboard strokes would you use to connect two or more commands in Linux?
|