103.2 Process text streams using filters Flashcards
How do you use the md5sum command?
md5sum
What is a message digest?
it calculates and checks a file’s hash based on the MD5 algorithm.
It calculates and checks a file’s hash based on the MD5 algorithm.
What command counts the words in a file?
#wc file.txt #wc -w file.txt (for words alone) #wc -l file.txt (for number of lines)
What command is used to count lines in a file?
#nl file.txt or (will not count empty lines) #nl -b a file.txt (will count empty lines too)
How do you read a file live as lines are added to it?
tail -f file.txt
What does the #head command do?
It displays only the first 10 lines of a file. If more are desired, type: #head -n file.txt
What does the #tail command do?
By default it gives the last 10 lines of a file.
If more are desired, then type: #tail -n file.txt
How do you exit from a file read with #less?
Hit the ‘q’ key.
Within a file read with #less, when searching, how do you move between matching results?
n for next match
p for previous match
How do you search for a keyword within a file read with #less?
Type forward slash / and the keyboard
Is #less read only?
Yes, it is only for viewing, allowing for paging up and down within the file and it allows for searching keywords.
What is the original use of the #cat command?
To concatenate or join files together.
cat file1 file2 > newfile
What does the #split command do?
It splits a file up into individual pieces of up to 1000 lines per default (can be changed).
When you run the #split command (#split , what type of output does it give?
A file called xaa
How do you break up a large file in pieces at a desired size?
#split -b 100 (bytes) #split -b 100K (kilobytes) #split -b 100M (megabytes) #split -b 100G (gigabytes)