Cat: View or merge file contents
Example: View 1.txt and 2.txt file content and merge 1.txt and 2.txt file content into 3.txt
grep: Text Search {format: gerp [-options] ' search content string ' filename }
The grep command is a powerful text Search tool that grep allows for pattern lookups on text files . If a matching pattern is found, grep prints all rows that contain the pattern.
1. grep Common options:
Options |
Meaning |
-V |
Display all lines that do not contain matching text (equivalent negation) |
-N |
Display matching lines and line numbers |
-I. |
Ignore case |
2. grep Common Regular Expressions:
Find : File Lookup {format: find directory-name file name }
Typically used to search for a qualifying file in a specific directory , or to search for a specific user's owner's file
Common usage:
Command |
Meaning |
Find./-name test.sh |
Find all files named test.sh in the current directory |
Find./-name ' *.sh ' |
Find all files with the suffix. Sh in the current directory |
Find./-name "[a-z]*" |
Find all files in the current directory that begin with uppercase letters |
Find/tmp-size 2M |
Find files that are equal to 2M in the/tmp directory |
Find/tmp-size +2m |
Find files larger than 2M in the/tmp directory |
Find/tmp-size-2m |
Find files less than 2M in the/tmp directory |
Find./-size +4k-size-5m |
Find files larger than 4k and less than 5M in the current directory |
Find./-perm 0777 |
Find a file or directory with permission 777 under the current directory |
WC: Calculates the number of lines or words of a file
Common commands for Linux ""