103.2 Process text streams using filters Flashcards

1
Q

How do you use the md5sum command?

A

md5sum

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

What is a message digest?

it calculates and checks a file’s hash based on the MD5 algorithm.

A

It calculates and checks a file’s hash based on the MD5 algorithm.

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

What command counts the words in a file?

A
#wc file.txt
#wc -w file.txt (for words alone)
#wc -l file.txt (for number of lines)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What command is used to count lines in a file?

A
#nl file.txt or (will not count empty lines)
#nl -b a file.txt   (will count empty lines too)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you read a file live as lines are added to it?

A

tail -f file.txt

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

What does the #head command do?

A

It displays only the first 10 lines of a file. If more are desired, type: #head -n file.txt

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

What does the #tail command do?

A

By default it gives the last 10 lines of a file.

If more are desired, then type: #tail -n file.txt

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

How do you exit from a file read with #less?

A

Hit the ‘q’ key.

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

Within a file read with #less, when searching, how do you move between matching results?

A

n for next match

p for previous match

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

How do you search for a keyword within a file read with #less?

A

Type forward slash / and the keyboard

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

Is #less read only?

A

Yes, it is only for viewing, allowing for paging up and down within the file and it allows for searching keywords.

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

What is the original use of the #cat command?

To concatenate or join files together.

A

cat file1 file2 > newfile

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

What does the #split command do?

A

It splits a file up into individual pieces of up to 1000 lines per default (can be changed).

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

When you run the #split command (#split , what type of output does it give?

A

A file called xaa

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

How do you break up a large file in pieces at a desired size?

A
#split -b 100 (bytes)
#split -b 100K (kilobytes)
#split -b 100M (megabytes)
#split -b 100G (gigabytes)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the #cut command do?

A

It extracts columns or fields of data from a file.

17
Q

How do you swap all capital letters in a file to lowercase in one go?

A
#tr
#cat file.txt | tr 'A-Z' 'a-z'
18
Q

What does the #paste command do?

A

It combines or merges lines of files in parallel.

19
Q

What command do you use to replace or swap a character for another within a file?

A
#tr (it needs to be fed the stdout of cat as stdin)
#cat file.txt | tr 'x' 'y'
20
Q

What command is used to display unique lines of a file?

A

uniq

21
Q

How do you sort the contents of a file by numerical order?

A

sort -n

22
Q

What is the #sort command used for?

A

sort is used to sort or merge files.

23
Q

What other commands besides md5sum can you use to check a file’s integrity?

A
#sha256sum 
#sha512sum