Belajar Sendiri

Commands

grep

grep [-i] [-c] [-n] [-v] [-r] <word> <file>

Risk: Safe

What it does

Prints only the lines that contain a word.

When to use it

To pull answers out of logs and long files.

Example

$ grep -i unpaid orders.log

Every unpaid order, any spelling.

$ grep -c nasi-lemak orders.log

Count the matching lines.

$ grep -r belacan ~/kedai

Search every file in every folder.