Linux Commands
Grep
<Command Options>
-o, --only-matching: Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
-P, --perl-regexp: Interpret the pattern as a Perl-compatible regular expression (PCRE).
-v, --invert-match: Invert the sense of matching, to select non-matching lines.
-r, --recursive: Read all files under each directory, recursively, following symbolic links only if they are on the command line.
-l, --files-with-matches: Suppress normal output; instead print the name of each input file from which output would normally have been printed.
<Examples of Usage>
#Selected lines are those not matching any of the specified patterns.
grep -v ‘keyword’ test.txt
#Print only the mached parts with regular expression
grep -oP '\d{1,5}/open' allports.gnmap | sort -u
# 特定のキーワードを含まない行を表示
grep -v ‘keyword’ test.txt
# 検索したい文字列を含むファイルを表示
grep <keyword> -rl <path>Sort
Wget
Sed
Awk
Tr
Tar
Ps
Find
Cut
Kill
Sudo
Extracting archives
Compressing archives
Copy files remotely
Bash
for
Last updated
Was this helpful?