Linux-command
Linux-command
Command
Description
Options
Examples
Command
Description
Options
Examples
Commands
Description
Options
Examples
Commands
Description
Options
Examples
grep used to search for specific patterns or regular expressions in text files or
streams and display matching lines.
-i: Ignore case distinctions while searching.
-v: Invert the match, displaying non-matching lines.
-r or -R: Recursively search directories for matching patterns.
-l: Print only the names of files containing matches.
-n: Display line numbers alongside matching lines.
-w: Match whole words only, rather than partial matches.
-c: Count the number of matching lines instead of displaying them.
-e: Specify multiple patterns to search for.
-A: Display lines after the matching line.
-B: Display lines before the matching line.
-C: Display lines both before and after the matching line.
grep -i "hello" file.txt
grep -v "error" file.txt
grep -r "pattern" directory/
grep -l "keyword" file.txt
grep -n "pattern" file.txt
In these examples we are extracting our desirec output from filename (file.txt)
5. System Information Commands
In Linux, there are several commands available to gather system information. Here
are some commonly used system information commands:
sudCommand
Description
Options
Examples
6. Networking Commands
In Linux, there are several networking commands available to manage and
troubleshoot network connections. Here are some commonly used networking commands:
Command
Description
Examples
Command
Description
Description
Command
Description
or
:
x
:x
or
:set number