Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CSE105

Total questions: 15

Worksheet time: 9mins

Name
Class
Date
1.

Which of the following commands is implemented as an internal command in bash?

a)

cat

b)

echo

c)

tee

d)

sed

2.

What does the pwd command accomplish?

a)

It prints the name of the working directory.

b)

It changes the current working directory.

c)

It prints wide displays on narrow paper.

d)

It parses Web page URLs for display.

3.

What is the surest way to run a program (say, myprog) that’s located in the current working

directory?

a)

Type ./ followed by the program name: ./myprog.

b)

Type the program name alone: myprog.

c)

Type run followed by the program name: run myprog.

d)

Type /. followed by the program name: /.myprog.

4.

You want to store the standard output of the ifconfig command in a text file (file.txt) for

future reference, and you want to wipe out any existing data in the file. How can you do so?

a)

ifconfig < file.txt

b)

ifconfig >> file.txt

c)

ifconfig > file.txt

d)

ifconfig | file.txt

5.

What is the effect of the following command?

$ ./myprog &> input.txt

a)

Standard error to myprog is taken from input.txt.

b)

Standard input to myprog is taken from input.txt.

c)

Standard output and standard error from myprog are written to input.txt.

d)

All of the above.

6.

How many commands can you pipe together at once?

a)

2

b)

3

c)

4

d)

An arbitrary number

7.

A text-mode program, verbose, prints a lot of spurious “error” messages to standard error.

How might you get rid of those messages while still interacting with the program?

a)

verbose | quiet

b)

verbose &> /dev/null

c)

verbose 2> /dev/null

d)

verbose > junk.txt

8.

You want to run an interactive script, gabby, which produces a lot of output in response to the user’s inputs. To facilitate future study of this script, you want display it's output to your screen and copy its output to a file simultaneously. How might you do this?

a)

gabby > gabby-out.txt

b)

gabby | tee gabby-out.txt

c)

gabby < gabby-out.txt

d)

gabby &> gabby-out.txt

9.

How do the > and >> redirection operators differ?

a)

The > operator creates a new file or overwrites an existing one; the >> operator creates

a new file or appends to an existing one.

b)

The > operator creates a new file or overwrites an existing one; the >> operator

appends to an existing file or issues an error message if the specified file doesn’t exist.

c)

The > operator redirects standard output; the >> operator redirects standard error.

d)

The > operator redirects standard output; the >> operator redirects standard input.

10.

What program would you use to display the end of a configuration file?

a)

uniq

b)

cut

c)

tail

d)

wc

11.

Which of the following regular expressions will match the strings dig and dug but not dog?

a)

d.g

b)

d[iu]g

c)

d[i-u]g

d)

di*g

12.

You want to discover the sizes of several dot files in a directory. Which of the following

commands might you use to do this?

a)

ls -la

b)

ls -p

c)

ls -R

d)

ls -d

13.

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? (Select all that apply.)

a)

Add the --parents parameter to the mkdir command.

b)

Issue three separate mkdir commands: mkdir one, then mkdir one/two, and then

mkdir one/two/three.

c)

Type touch /bin/mkdir to be sure the mkdir program file exists.

d)

Type rmdir one to clear away the interfering base of the desired new directory tree.

14.

Which of the following commands would you type to enable world read across access to the

file myfile.txt? (Assume that you’re the owner of myfile.txt.)

a)

chmod 741 myfile.txt

b)

chmod 0640 myfile.txt

c)

chmod u+r myfile.txt

d)

chmod o+r myfile.txt

15.

What can you conclude from the following interaction?

$ which man

/usr/bin/man

a)

The only file called man on the system is in /usr/bin.

b)

The /usr/bin/man program was installed by system package tools.

c)

The /usr/bin/man program will be run by any user who types man.

d)

The first instance of the man program, in path search order, is in /usr/bin.