UNIX Final Flashcards
UNIX was designed as a multi-user, multi-tasking operating system. T/F?
True
Which of the following is not a UNIX based operating system?
Question options:
BSD
SunOS
SVR4
MVS
MVS
A 10Mb and 100Mb connection both transmit individual bits at the same speed, but the 100Mb connection has more _______ than the 10Mb connection.
bandwidth
Which of the following is not a Linux based operating system?
Question options:
Ubuntu
WNT
SuSE
RedHat
WNT
Which of the following commands can be used to change the permissions of a file?
Question options:
chmod
chown
ps -ef
ls -l
chmod
UNIX was created by researchers in AT&T’s Bell Laboratories after they had worked on a project called Multics.
Question options:
True
False
True
The original term ‘computer’ referred to people, not machines.
Question options:
True
False
True
Which of the following is not a valid filename?
Question options:
pV_test
zero/one
test.txt
How many times?
zero/one
When I want to make a new directory I would issue the _____ command.
mkdir
The first process, PID 1, is always the process called ____.
init
Which of the following will NOT display the contents of a file?
Question options:
cat
file
more
less
file
Fill in the blank so that the following command appends (does not overwrite) to an existing file:
$ps aux ___ test.txt
> >
An option to prevent accidental overwrites of existing file is to set an environment variable using ‘set -o’. Type the name of the variable:
noclobber
Which of the following files is the special file that will not retain anything written to it, also known as ‘the bit bucket’?
Question options:
/dev/null
/dev/2
/dev/tty
/bin/sh
/dev/null
Output is sent to standard out - stdout, errors are sent to standard error - stderr.
Question options:
True
False
True
The ed editor is a line editor than can be exited by typing the letter q.
Question options:
True
False
True
Which of the following is not a valid mode for vi?
Question options:
command
insert
extended
binary
binary
The arrow keys can be used in vi to move about in the file. The arrow keys are duplicated by what other keys: ______
hjkl
The vi command, ____, will write the changes and quit the editor.
:wq
The ‘i’ command in vi will _____ text in a file.
insert
Which of the following commands cannot be used to display output?
Question options:
less
cat
tail
cd
cd
Which of the following commands will redirect errors of a find command to the ‘bit bucket’ - null file?
Question options:
find / -name test -print > /dev/null
find / -name test -print»_space; /dev/null
find / -name test -print > /dev/null/test
find / -name test -print 2> /dev/null
find / -name test -print 2> /dev/null
The editor, ed, was developed before computer displays and mice were readily avaialble.
Question options:
True
False
True
UTF-8 can be considered an extension of what other character code set?
Question options:
EBCDIC
FORTRAN
ASCII
ISO 9000
ASCII
Searching for a single digit in grep can be done by placing the range of numbers in square brackets. The following selects any number zero through nine - [0-9]. What is the appropriate POSIX construction for [0-9]?
Question options:
[[:digit:]]
[[digit]]
[:digit:]
[digit]
[[:digit:]]
The command grep stands for Globally search for Regular Expression and Print.
Question options:
True
False
True
Which of the following will look for an E or e at the beginning of a line?
Question options:
‘[Ee]’
’[^Ee]’
’^[Ee]’
‘[Ee]$’
’^[Ee]’
The following will find any sting of three digits preceded by and followed by a space in the file text;
grep ‘ [0-9]{3} ‘ text
Question options:
True
False
True
To invert the order of sort which of the following options is used?
Question options:
- z
- i
- r
- o
-r
The cut command option to specify a colon separating fields would be the following:
-d :
Question options:
True
False
True
The bash shell us the ‘Bourne again shell’.
Question options:
True
False
True
There are a number of shell scripts that perform interactive shell setup and load user environment variables. Which of the following is not one of them?
Question options:
~/.bash_profile
~/.profile
/etc/profile
/dev/tty
/dev/tty
The set options for the bash shell can also be accomplished with the shopt command.
Question options:
True
False
True
If the user updates their .profile and wants to ‘source’ their updates, which of the following commands would they use?
Question options:
$ set -o ~/.profile
$ . ~/.profile
$ export PROFILE=~/.profile
$ . ~/.profile
Using shopt, the -o option sets the variable, the +o option unsets it.
Question options:
True
False
False
A user has aliased the ps command to be the passwd command. To ensure that the ps command in your shell executes as the real ps command, and not the user’s aliased passwd command, you can use which of the following in your script?
Question options:
command ps
enable ps
ps -ef
command ps
Which of the following commands runs a pwd, then an ls -l, then a df -k, and sends the output of all three commands to a file called daily_out?
Question options:
(pwd;ls -l;df -k) > daily_out
pwd+ls -l+df -k > daily_out
(pwd|ls -l|df -k)»_space; daily_out
pwd|ls -l|df -k > daily_out
(pwd;ls -l;df -k) > daily_out
The command used to set m as the alias of the command less in bash is:
alias m=less
Question options:
True
False
True
To make a variable available to child processes, the following command is issued in bash:
$ _____ VAR=variable
export
The logical ‘and’ and ‘or’ concepts can be used with commands in bash, the and operator executes the second command if the first suceeds, the or executes the second command if the first fails. Which of the following are the character representations for the logical ‘and’ and ‘or’ in bash?
Question options:
\and\ \or\
&& ||
== !=
++ –
&& ||
The sed command, by default, overwrites the file it reads.
Question options:
True
False
False
The sed command can use almost any delimiter for separating fields. Which of the following is the default delimiter? (Only one correct answer.)
Question options:
` - special single quote
/ - slash
- the pipe symbol
/ - slash
Which of the following sed command restrictions will delete lines 5 through the last line of the file?
Question options:
1,5d
5,$d
1-4k5-$d
5,$d
The sed command supports metacharaters for searching the lines of text sed reads.
Question options:
True
False
True
What text string does the ‘&’ represent in the following command:
sed -n ‘s/north/&/gp’ some_file
north
When sed finds the first occurence of Allan on a line what will it replace Allan with given the following sed command:
sed -n ‘s/(Al)lan/\1fred/p’ some_file
Alfred
The -e option in sed allows multiple edits to occur on a line.
Question options:
True
False
True
The awk command views the input stream as a collection of records which can be subdivided into fields.
Question options:
True
False
False
Which of the following options will allow sed to invoke a sed script from the command line?
Question options:
- s
- i
- v
- f
-f
Which of the following commands will write lines processed by sed into a file based on the pattern match?
Question options:
sed -n ‘s/north/west/gp’ some_file
sed -n ‘/Bill/r no_bill/’ some_file
sed -n ‘/Susan/w myfile’ some_file
sed -n ‘s/(Mar)got/\1ch/gp’ some_file
sed -n ‘/Susan/w myfile’ some_file
The following awk if statement will print numbers from 1 to 10 except for number 5, T or F.
BEGIN{
x=1; while (x
True
What does the following awk segment define?
Address[$4]
Question options:
break
mathmatical expression
array
continuation statement
Array
What permission do shell scripts require in order for a user other than the owning user or a member of the owning user’s group to use/run them?
Question options:
write permission for other
read permissions for other
execute permission for other
execute permission for other
Shell scripts consist of of commands, programming constructs, and comments.
Question options:
True
False
True
What does the read command do?
Question options:
Read takes the output array of a specified field in a file that becomes input into an array used by the shell.
Read will list a series of variables that the user must read before the script can proceed.
Read will take a line from stdin and assign it to a specified variable.
Read defines the variables used by the scripting language.
Read will take a line from stdin and assign it to a specified variable.
Shell scripts can do complex floating point computations without resorting to the use of other tools.
Question options:
True
False
False
There is more than one way to declare an integer value in a shell script. Pick the appropriate methods.
Question options:
let NUM=6
declare -i NUM;NUM=6
NUM[6]
declare -i NUM;NUM=6
Which of the following test expressions is formatted correctly? (Pick one only)
Question options:
{ 0 -eq 0 }
[ 0 -eq 0 ]
[0 -eq 0]
{0 -eq 0}
[ 0 -eq 0 ]
True or false, arguments taken into the script from the command line are called positional parameters.
Question options:
True
False
True
The awk programming language allows some flexibility in looping. Select which looping controls awk allows from the following list.
Question options:
for loop
break and continue statements
while loop
for loop
break and continue statements
while loop
UNIX/Linux has a utility that allows for job scheduling. What is it known as?
Question options:
chmod
chown
cd
crontab
crontab
The null command is represented by a colon, :
Question options:
True
False
True
Which of the following are true of the case statement?
Question options:
must occur at the beginning of any shell
uses ‘case’ and ‘esac’ to define the boundaries of the case statement
can be used as an alternative to if commands
uses two semi-colons, ;; , to mark the end of actions
uses ‘case’ and ‘esac’ to define the boundaries of the case statement
can be used as an alternative to if commands
uses two semi-colons, ;; , to mark the end of actions
The for loop is used for processing a finite number of items.
Question options:
True
False
True
The while loop cannot, by definition, process infintely.
Question options:
True
False
False
The until loop continues until a break condition is met.
Question options:
True
False
True
Select can be used to do which of the following? (One right choice)
Question options:
test output created by an if statement
format text output
create menus
create menus
The while loop breaks when what of the following occurs? (One answer only)
Question options:
user enters correct response
exit code is zero
the loop reaches 10 iterations
exit code is not zero
exit code is not zero
The until loop breaks out of the loop when the exit status is zero.
Question options:
True
False
True
Which of the following statements is true of break and continue? (One correct answer)
Question options:
break will only break out of a continue statement
break forces an exit from the loop, continue returns control to the top of the loop
break and continue do the same thing
break forces an exit from the loop, continue returns control to the top of the loop