Process text streams using filters (2) Flashcards

Objective 103.2 Weight 2

1
Q

What of the following commands can you enter to display the first 8 lines of the /etc/passwd file?

  1. head /etc/passwd
  2. head -8 /etc/passwd
  3. head -n 8 /etc/passwd
  4. head /etc/passwd -8
  5. head 8 /etc/passwd
A

2. head -8 /etc/passwd
AND
3. head -n 8 /etc/passwd

By default the head command displays the first ten lines of a text file. To see a different number of lines, such as 8 lines, you need to use either the -n 8 option or the -8 option on the head command.

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

You want to display the number of bytes in the text file, test.txt. Which of the following commands will accomplish that?

  1. wc test.txt
  2. wc -c test.txt
  3. wc -l test.txt
  4. wc -w test.txt
  5. wc -b test.txt
A
  1. wc test.txt
    AND
  2. wc -c test.txt

Both the wc -c test.txt and the wc test.txt will show the number of bytes in the test.txt file. However, wc test.txt will also display the number of lines and words in the file as well.

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

Which of the following hash utilities produce the longest hash?

  1. md5sum
  2. md512sum
  3. hash
  4. sha256sum
  5. sha512sum
A
  1. sha512sum

The sha512sum produces the longest hash (two of the listed utilities are fake, and are not true hash utilities.)

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