CompTIA LINUX+ Flashcards

1
Q

Which of the following commands will open the mainlist. txt text file in a command-line text editor?

a) cd mainlist.txt
b) rm mainlist.txt
c) gedit mainlist.txt
d) vi mainlist.txt

A

d

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which command will modify the date and time stamp of an existing file?

a) ls {hfx,tor}??
b) file [Bb}*201[4-5]
c) touch [a-z] [a-z] [a-z] 0?

A

c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which command will allow you to replace the string red with the string blue in a text file without being asked for confirmation?

a) :%s /red/blue
b) :%c /red/blue/s
c) :%s /red/blue/c

A

a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

You used to vi to open a text file and now you want to edit it. What options represent the keys you can press that will allow you to actually edit the contents?

a) a
b) i
c) v
d) w

A

a and b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Write the command to compress every file contained in the /images directory using the fastest compression command.

A

gzip -r /images

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which statement best describes the purpose of the tee command?

a) It allows you to send the output of a query to another query
b) It allows you to print query results
c) It allows you to write standard output to the screen and additional locations

A

c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Write the command that would return any files owned by the emclampett that are in the /images directory.

A

find /images -user emclampett

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Complete the code to use the cpio command to extract the files from /images.cpio and place them in the same directory, recreating any required subdirectories.

A

-id < /images.cpio

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Complete the command that will add the /images directory to the PATH variable

A

PATH=$PATH:/images

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Complete the code to recursively copy all files in the current directory to the /backup001 directory. Make sure the code also returns what files have been copied.

A

-Rv

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

You want to search cheese.txt for instances of string blue, but you don’t want the search to be case sensitive.

a) -c
b) -i
c) -v

A

b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

You’ve opened a text file using vi and now you want to search for instances of the string mark. As mark can be a verb as well as a name you want to make your search case insensitive. Which option will perform this query?

a) \MaRk/
b) /mark\c
c) \mark/c

A

b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Write the command that will copy all subdirectories recursively in /images in the backup folder /imgbak.

A

cp -r /images /imgbak

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What command will return the value of the variable PATH in the shell?

a) echo $PATH
b) grep -vPATH
c) | | PATH

A

a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which operator could you use to mimic an IF statement on the command line?

a) ||
b) |
c) grep

A

a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which option will return all files including hidden ones?

a) lS -a ~
b) ls -a ~
c) ls-ls ~

A

b

17
Q

Which statement about piping of output is accurate?

a) Only one piping request can be made per query
b) Piped output must be stored in a variable before it can be used
c) Piping is accessed using the | symbol

A

c

18
Q

Which command will allow you to reopen a file without saving any changes?

a) :w!
b) :q
c) :e!

A

c

19
Q

You’ve run history command in the bash shell and now you want to execute the command listed 39th. Which option will do this?

a) ~/39
b) !39
c) 39_history

A

b

20
Q

Which options will return the contents of the variable myVar?

a) echo $MYVAR
b) echo $myVAR
c) cat &myVAR

A

b

21
Q

Which command will remove files and directories recursively from /images without prompting for confirmation before removing each file?

a) rm -rvi /budgets
b) rm - rv /images
c) rm rv-i /budgets

A

b

22
Q

Using gedit as your text editor, complete the query to search the snacks directory and open the files inside.

find/ home/snacks/*.txt | _______

A

xargs gedit