Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

GAME: Shell Expansion

Total questions: 30

Worksheet time: 20mins

Name
Class
Date
1.

1. Display the matching file; File55 in the system using the ls command? (two answers)

a)

ls File*

b)

ls f*55

c)

ls F*55

d)

ls file*

2.

Which command do we use to check the current language in the system?

a)

$LANG

b)

echo $LANG

c)

$MYLANG

d)

locale -a

3.

List the matching file FileAB5; in the system using ls command.

a)

ls File???

b)

ls File [A5] [AB] [B5]

c)

ls [a-z]ile???

d)

ls File[a-z][a-z][0-9]

e)

All of the above

4.

Create multiple files using the command touch.

a)

touch file{1..3}.txt

b)

touch file{a..c}.txt

c)

touch file{a,b}{1,2}.txt

d)

touch file{a{1,2},b,c}.txt

e)

all of the above

5.

When separating two commands on the same line use _____ ,both commands will be executed sequentially with the shell waiting for each command to finish before starting the next one.

a)

A. an ampersand

b)

B. a semicolon

c)

C. a double ampersand

d)

D. a colon

6.

The second command is executed only when the first command fails when you use:

a)

A. | Single vertical bar

b)

B. || double vertical bar

c)

C. & single ampersand

d)

D. && double ampersand

7.

How would you escape special characters to get the following output:

I love my control characters “ # & \ ‘

a)

A. A forward slash /

b)

B. Double quotes “ “

c)

C. A backslash \

d)

D. Single quotes ‘ ‘

8.

Why would the following command NOT be excecuted?

[student@serverX ~]$ # rm myfile.txt && echo It worked! || echo It failed!

a)

A. It has a wrong syntax

b)

B. Double vertical bar should not be in this command

c)

C. The pound sign in the front makes the shell ignore this command

d)

D. rm should always be used with an –r option

9.

What is a return code of a “command not found” error?

a)

A. 0

b)

B. 1

c)

C. 126

d)

D. 127

10.

How can I delete single line from history?

a)

A. history -c

b)

B. Ctrl +L

c)

C. fc -l

d)

D. history -d

11.

If you want to run a command from the history list, what command do use to get it

a)

A. sudo

b)

B. !!

c)

C. !n

d)

D. tree

12.

You want to open another terminal window to access the full history list from first terminal window, what option will allow you do this in the first terminal window before you open the second window?

a)

A. history -a

b)

B. history -c

c)

C. history -w

d)

D. history -t

13.

True or False

The number of commands to remember in the command history default value is 7500.

a)

True

b)

False

14.

How many arguments are in this line (not counting the command itself).

​

touch '/etc/cron/cron.allow' 'abc123.txt' "abc456.txt"

a)

5

b)

4

c)

3

d)

2

e)

1

15.

What command do we use to get the location of cat command?

a)

find cat

b)

ls cat

c)

which cat

d)

where cat

e)

bash cat

16.

List all current aliases.

a)

ls

b)

ls -la

c)

alias

d)

type

e)

cat alias

17.

How to turn on and turn off debug mode?

(display everything that normally happens in the background)

a)

set-C ; set+C

b)

set+x ; set-x

c)

set-x ; set+x

d)

setgid ; setuid

e)

set-u ; set+u

18.

alias dog=tac | What command should we use to remove created alias?

a)

rm -rf

b)

rm alias

c)

unalias

d)

set+a

e)

alias c=’clear’

19.

What command helps to you get a specific range in history?

a)

A. ls history

b)

B. history -5

c)

C. fc -l

d)

D. history -s

20.

Which of the following commands will help to list the contents of the directory?


[root@ServerX ~/test42]# touch file{1..3}.txt

a)

echo *

b)

ls *

c)

ls -l *

d)

ll *

e)

all of the above

21.

What is a SHELL VARIABLE?

a)

A. A hard, protective outer layer usually created by an animal that lives in the sea.

b)

B. A special variable that is set by the shell and is required by the shell in order to function correctly.

c)

C. An Energy Company

d)

D. Any variable which has a dollar sign ($) in front of it

22.

A $HOME variable contains:

a)

A. User’s home address and ZIP

b)

B. User’ executable path

c)

C. User’s home directory location

d)

D. None of the above

23.

For a specific user, you can set or change environmental variables in:

a)

A .bashrc in /usr/bin

b)

B .bashrc in user’s home directory

c)

C .bash_profile or .bashrc in the user’s home directory

d)

D .birthday_bash

24.

> echo $PS1 command shows:

a)

A. Local Playstation Console IP address

b)

B. Local PS/2 Mouse Driver Vendor name

c)

C. Local bash shell prompt settings

d)

D. None of the above

25.

Any string can become a variable name. Is it true?

a)

A. No, only upper case letters are allowed in a variable name.

b)

B. Yes, Linux allows any symbol in the variable name.

c)

C. No, special symbols and leading numerals are not allowed

d)

D. Yes, it’s a free country.

26.

What is the proper way to display(2 answers):

Hello "World"

a)

A) echo Hello "World"

b)

B) echo 'Hello "World"'

c)

C) echo "Hello "World""

d)

D) echo "Hello World"

e)

E) echo "Hello \"World\""

27.

How do we unset variables as an error?

a)

a. set -T

b)

b. set -t

c)

c. set -u

d)

d set -V

28.

Where do you find the list of shell options :

a)

a. man page 5

b)

b. --help

c)

c. man page of bash

d)

d. whoisthis bash

29.

True or False

Does set -u and set -o nounset both mean the same thing :

a)

a. True

b)

b. False

30.

What is the command to turn on noclobber option :

a)

a. set -N

b)

b. set -n

c)

c. set -C

d)

d. set -c