CompTIA LINUX+ Flashcards
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
d
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?
c
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
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 and b
Write the command to compress every file contained in the /images directory using the fastest compression command.
gzip -r /images
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
c
Write the command that would return any files owned by the emclampett that are in the /images directory.
find /images -user emclampett
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.
-id < /images.cpio
Complete the command that will add the /images directory to the PATH variable
PATH=$PATH:/images
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.
-Rv
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
b
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
b
Write the command that will copy all subdirectories recursively in /images in the backup folder /imgbak.
cp -r /images /imgbak
What command will return the value of the variable PATH in the shell?
a) echo $PATH
b) grep -vPATH
c) | | PATH
a
Which operator could you use to mimic an IF statement on the command line?
a) ||
b) |
c) grep
a