CPT 247: UNIX/Linux Midterm
____ changes to the parent directory. A) ls -a B) cd C) -X D) ".."
".."
The information shown in the terminal will be sorted by extension with this option ____. A) -X B) ls -a C) cd D) rm
-X
The ____ option of the paste command is used to specify a different separator as a delimiter. A) -t B) -o C) -d D) -s
-d
When performing a copy of files to some directory, which of the following prevents overwriting? A) -u B) -i C) -o D) -b
-i
The ____ option of the diff command is used to display the differences side-by-side in columns. A) -s B) -c C) -n D) -y
-y
You are curious about the error and system logs kept by your OS. In what main directory under the root (/) would you most likely find these logs. A) /var B) /sbin C) /tmp D) /sys
/var
Fedora, Red Hat Enterprise Linux, SUSE, and Knoppix, recognize up to ____ characters in your user name. A) 8 B) 16 C) 32 D) 64
32
To append output to an existing file, you use _____. A) > B) >> C) < D) <<
>>
Which best describes the definition of subdirectory? A) The main or parent directory B) A directory under a higher or parent directory C) A section of the hard disk D) A special character that can stand for any other character
A directory under a higher or parent directory.
To delete a word or consecutive characters, use this key combination ____. A) Alt + a B) Alt + d C) Alt + b D) Alt + c
Alt + d
To move the cursor to the position just before the first character of the next word, use this key combination ____. A) Alt + d B) Alt + b C) Alt + l D) Alt + u
Alt + l
Linux uses the freeware ____ shell as its default command interpreter. A) Bash B) Bourne C) C D) Korn
Bash
____ are bit patterns that are transformed into an infinite variety of images. A) Bitmap B) bit C) byte D) insert mode
Bitmap
In the Linux Bash shell, the ____ key combination moves the cursor to the beginning of the command line. A) Ctrl + b B) Alt + d C) Alt + l D) Ctrl + a
Ctrl + a
To move the cursor to the beginning of the command line, use this key combination ____. A) Ctrl + f B) Ctrl + d C) Ctrl + b D) Ctrl + a
Ctrl + a
To move the cursor to the previous letter, use this key combination ____. A) Ctrl + b B) Ctrl + d C) Ctrl + a D) Ctrl + f
Ctrl + b
To log out of UNIX/Linux (Bourne, Korn, or Bash Shells) you can enter exit on the command line or press ____. A) Ctrl + l B) Ctrl + g C) Ctrl + x D) Ctrl + d
Ctrl + d
Which of the following commands enables you to use online help in Emacs? A) Ctrl + ? B) Ctrl + h C) ? D) Ctrl + q
Ctrl + h
To delete the content of the command line from the current cursor position to the end of the command line, use this key combination ____. A) Ctrl + k B) Ctrl + u C) Ctrl + p D) Ctrl + n
Ctrl + k
To delete a character, use this key ____. A) space B) Del C) backspace D) enter
Del
"man" is the term used only in Emacs as a useful help tool. A) True B) False
False
A macro describes the characteristic of editors, such as vi, which make them able to work in different modes. A) True B) False
False
Shell scripts run more quickly than compiled programs. A) True B) False
False
The "pwd" command allows a programmer to set file permissions on the command line. A) True B) False
False
The command rmdir can be used to delete a directory that is not empty. A) True B) False
False
The process of connecting a file system to the directory tree structure, making that directory accessible is called a utility. A) True B) False
False
You have been working on a long vi text file and now you've got to rush off to a meeting. How can you quickly save your work and exit the vi editor? (choose all that apply). A) From command mode, enter :wq B) From command mode, enter :ZZ C) From command mode, enter :bye D) From command mode, enter :x
From command mode, enter :ZZ or :bye
You're editing a document using vi and you are near the end of a page. You want to quickly go back to the top of the page to check something you said. Which of the following command-line commands enables you to quickly go to the top of the page. A) :top B) T C) Go1 D) H
H
_____ makes it possible to reconstruct files or roll back recent changes with minimal to no damage to files and data. A) ufs B) Journaling C) mount D) superblock
Journaling
Bash is a freeware derivative of the Bourne and ____ shells. A) Korn B) C C) csh D) tsh
Korn
You've used Emacs to write advertising copy about a new software product your company has developed. Now you find out that the name of the product has been changed slightly. What command can you use to track down all references to the old name so you an locate them? A) Type #locate B) Type :find C) Press Alt + f D) Press Ctrl + s
Press Ctrl + s
:wq serves the purpose of writing changes to disk and exiting vi. A) True B) False
True
A program is considered "compiled" when it is translated to machine-readable language. A) True B) False
True
Hidden files are the files that the operating system uses to keep configuration information, among other purposes. Conventionally, their name begins with a dot (.) A) True B) False
True
Journaling is a process for keeping chronological records of data or transactions so that if a system crashes without warning, the data can be reconstructed. A) True B) False
True
Most shells keep a list of your recently used commands and allow you to recall a command without retyping it. A) True B) False
True
On older UNIX/Linux systems, and executable permission that either causes a program to stay resident in memory or ensures that only root or the owner can delete or rename a file on a new system is called a sticky bit. A) True B) False
True
Text editors are word processors used to create and edit documents without formatting features. A) True B) False
True
The pipe operator can connect several commands on the same command line. A) True B) False
True
You can complete a project using awk that you cannot complete using a combination of paste, cut, sort, and join. A) True B) False
True
You can use the vi editor to create script files. A) True B) False
True
Which if of the following best describes the Unicode Bit pattern? A) They are really just the same as ASCII characters B) Describes how a single code can be used for typing command line instances C) Supports up to 53,656 characters D) Was developed to offer more characters for a broader range of languages
Was developed to offer more characters for a broader range of languages.
____ displays the name of the working directory without any other path information. A) ufs B) mount C) /W D) \W
\W
To append new lines in sed, you must use the ____ command. A) a\ B) -a C) \a D) >a
a\
____ is a number composed of one of two numbers, 0 and 1. A) bitmap B) bit C) byte D) ex mode
bit
____ is a binary term composed of either 0's and/ or 1's. A) byte B) bit C) bitmap D) insert mode
byte
You can use the ____ command to show the system calendar. A) clndr B) syscal C) cal D) calendar * Options: -j = julian date -s = Sunday as first day of week -m = Monday as first day of week -y = show all months of current year
cal
The ____ statement simplifies the selection of a match when you have a list of choices. A) if B) switch C) case D) while
case
You can use the ____ command to display multiple files. A) dis B) dog C) show D) cat
cat
____ changes your directory. A) ".." B) rm C) cd D) ls -a
cd
Use this command ____ to set file permissions. A) cmod B) cdmod C) cwmod D) chmod
chmod
____ this command assigns read and execute to owner; no permission to group; and read permission to other. A) chmod 755 data B) chmod 642 data C) chmod 777 data D) chmod 504 data
chmod 504 data
____ this command assigns read and write to owner; read to group; and write to other. A) chmod 642 data B) chmod 777 data C) chmod 504 data D) chmod 755 data
chmod 642 data
____ this command assigns read, write, and execute to owner; execute to group; and execute to others. A) chmod 755 data B) chmod 777 data C) chmod 642 data D) chmod 711 data
chmod 711 data
____ gives the owner read, write, and execute permissions. A) chmod 155 B) chmod 551 C) chmod 577 D) chmod 755
chmod 755
____ this command assigns read, write and execute to owner; read and execute to group; and read and execute to other. A) chmod 642 data B) chmod 504 data C) chmod 777 data D) chmod 755 data
chmod 755 data
____ this command assigns read, write, and execute to owner, group, and other. A) chmod 755 data B) chmod 504 data C) chmod 642 data D) chmod 777 data
chmod 777 data
You can use the ____ command to clear the terminal screen, display, or terminal window. A) wipe B) erase C) clear D) swipe
clear
The ____ command locates identical lines within two identically sorted files. A) diff B) sed C) uniq D) comm
comm
Use this command ____ to copy files from one directory to another. A) cp B) copy C) cpy D) cpfl *Options -b = makes a backup destination file if the copy will overwrite a file -i = provides a warning when you are about to overwrite a file -u = specifies to only overwrite if the file you are copying is newer than the one you are overwriting.
cp
The command > accountsfile ____. A) deletes de file accountsfile B) is not valid in UNIX/Linux systems C) displays the contents of the file accountsfile on the screen D) creates an empty file called accountsfile
creates an empty file called accountsfile.
To reference a variable, you use a dollar sign ($) in front of it or enclose it in ____. A) square brackets ([ ]) B) curly brackets ({ }) C) double quotes (" ") D) angle brackets (< >)
curly brackets ({ })
File Type and File Permissions drwxr-xr-x *r = read permission w = write permission x = execute permission - = no permission
d = file type rwx = owner permissions r-x = group permissions r-x (2nd set) = other's permissions
You can use the ____ command to show the system date and time. A) date B) dt C) dat D) datetime * -u option displays the time in Greenwich Mean Time (GMT)
date
Use this command ____ to show lines that differ between two files and is commonly used to determine the minimal set of changes. *Options -b = ignores blanks that repeat -B = does not compare for blank lines -i = ignores case -c = shows lines surrounding the line that differs -y = display the differences side-by-side in columns
diff
____ employs an extended set of commands initially used in an early UNIX editor called ex. A) bit B) ex mode C) insert mode D) byte
ex mode
By default, each page in the output of pr has a ____ -line header, which, by default, contains the current file's name, its last modification date, the current page, and a trailer consisting of blank lines. A) three B) four C) five D) six
five
Wildcard characters are also known as ____ characters. A) bogus B) filler C) glob D) search
glob
Use this command ____ to search for a specified pattern in a file, such as a particular word or phrase. *Option -i = ignores case -l = lists only file names -c = counts the number of lines instead of showing them -r = searches through files under all subdirectories -n = includes the line found -v = displays only lines that don't contain the search pattern
grep
____ is a feature of a modal editor that lets users input text. A) bit B) bitmap C) ex mode D) insert mode
insert mode
A sorting ____ is a field position within each line. A) index B) key C) column D) position
key
Which command serves the purpose of displaying directory contents? A) chmod B) mkdir C) mount D) ls
ls
____ displays contents and includes hidden files. A) -X B) ls -a C) cd D) ".."
ls -a
You can use the ____ command to show info from the online documentation. A) women B) men C) woman D) man
man
Use this command ____ to create a new directory. A) mk dir B) mkndir C) rmdir D) mkdir
mkdir
____ is a process for connecting a file system to the directory tree. A) ufs B) \W C) superblock D) mount
mount
You can change your password, if necessary, by using the ____ command, but you must know your current password to change it. A) pwd B) chpwd C) passwd D) password
passwd
The ____ redirects the output of one command to the input of another command. A) output redirection operator (>) B) input redirection operator (<) C) pipe operator (|) D) tilde (~)
pipe operator (|)
You use the ____ character in script files to mark comments. A) tilde (~) B) dollar ($) C) pipe (|) D) pound (#)
pound (#)
Use this command ____ to determine your current working directory. A) swd B) cwd C) owd D) pwd
pwd
In UNIX/Linux, text files and binary files are considered to be ____ files. A) executable B) document C) regular D) dynamic
regular
Use this command ____ to delete files you do not need. A) rem B) del C) remove D) rm *Options -i = causes the OS to prompt to make certain you want to delete the file before it is actually deleted.
rm
When you no longer need a file, you can delete it using the ____ command. A) rm B) remove C) dl D) delete
rm
Which of the following commands allows you to remove a file. A) ls B) cd C) cp D) rm
rm
____ removes a file. A) -X B) ls -a C) cd D) rm
rm
Use this command ____ to remove/ delete a directory. A) delete B) deldir C) rmdir D) removedir *Options -v display message verifying directory has been removed *have to move or delete files within a directory before deleting the directory.
rmdir
When you no longer need a directory, you can use command ____ to remove it. A) xtree B) rmdir C) dldir D) deltree
rmdir
You can type more than one command on the command line by separating commands with a ____. A) vertical bar (|) B) colon (:) C) semicolon (;) D) dash (-)
semicolon (;)
When you create a shell script to run in Bash, you can immediately run the script by typing ____ and then the name of the script. A) run B) sh C) start D) exec
sh
If you execute ____, the contents of file1 are sorted and the results are stored in file2. A) sort file1 -o file2 B) sort file1 -d file2 C) sort file1 > file2 D) sort file1 file2
sort file1 > file2
System administrators and programmers refer to standard output as ____. A) sout B) stout C) stdout D) standardout
stdout
____ provides information about the layout on a specific partition. A) superblock B) mount C) ufs D) \W
superblock
If a source file contains ____ errors, it cannot be converted into an executable file. A) syntax B) debugging C) compilation D) logic
syntax
A _____ is used to refer to the user's home directory. A) dot (.) B) dollar sign ($) C) forward slash (/) D) tilde (~)
tilde (~)
Use this command ____ to create empty files. *Options -a = updates the access time only -m = updates the last time the file was modified -c = prevents the command from creating the file, if it does not already exist
touch
_____ is the original hierarchical system that is expandable and supports a large amount of storage. A) Journaling B) ufs C) superblock D) mount
ufs
Use this command ____ to duplicate lines from a file. *Options -u = outputs only the lines of the sources file that are not duplicated -d = outputs one copy of each line that has a duplicate, and does not show unique lines -i = ignores case -c = starts each line by showing the number of each instance
uniq
Use this command ____ to count the number of lines, words, and bytes or characters in text files. *Options -c = shows byte count -l = shows line count -w = shows word count
wc
You can use the ____ command to show only the name and brief description of a command. A) whatis B) what is C) thatis D) that is
whatis
You can use the ____ command to show a listing of those logged in to the operating system. A) you B) who C) them D) me *Options: who am i = info about your own session whoami = see what account you are using -H = show column headings -u show idle time for each user -q = quick list and total users logged in -b = verify when the system was last booted
who