bash
Search for lines containing either `foo` or `bar` in all files within the `/baz` directory recursively using `grep`. This demonstrates how to search for multiple patterns in files.
grep
bash
Search for lines containing either `foo` or `bar` in all files within the `/baz` directory recursively using `grep`. This demonstrates how to search for multiple patterns in files.
grep
bash
Search for the string `foo` in the file `/bar` and highlight the matches with color. This demonstrates using `grep` to find text in a file with colored output.
grep
bash
Search for the string `foo` in the file `/bar` and display the line numbers where matches occur. This demonstrates using `grep` to find specific text within a file and show the corresponding line numbers.
grep
bash
Search for the string `foo` in the file `/bar` and count the number of occurrences using the `grep` command with the `--count` option. This demonstrates how to find and count specific text in a file.
grep
bash
Search for lines in the file `/bar` that do not contain the string `foo` using the `grep` command with the `--invert-match` option. This demonstrates how to find lines that exclude a specific pattern.
grep
bash
Search for the string `foo` in the file `/bar` and display one line of context around each match. This demonstrates using `grep` with the `--context` option to show surrounding lines for better context in search results.
grep
bash
Search for the exact line containing `foo` in the file `/bar` using `grep` with the `--line-regexp` option. This demonstrates how to find exact matches in a file.
grep
bash
Search for the string `Foo` in the file `/bar` using `grep` with case-insensitive matching. This demonstrates how to find text in a file while ignoring case sensitivity.
grep
bash
Search for files in `/bar` that do not contain the string `foo` using `grep` with the `--files-without-match` option. This demonstrates finding files without a specific pattern.
grep
bash
Search for the string `foo` in the directory `/bar` and list the files that contain matches. This demonstrates using `grep` to find files containing a specific pattern.
grep
bash
Search for the string `foo` in the directory `/bar` recursively, following symbolic links. This demonstrates using `grep` to find text within files in a directory structure.
grep
bash
Search for the string `foo` recursively in the directory `/bar` using the `grep` command. This demonstrates how to find a specific string within files in a directory and its subdirectories.
grep
bash
Search for the string `foo` in the file `/bar.txt` using the `grep` command. This demonstrates how to find specific text within a file.
grep
bash
This code finds and deletes files in the specified `/path` directory that are older than 30 days. It uses the `find` command with the `-mtime +30` option to locate files modified more than 30 days ago and the `-delete` action to remove them. This demonstrates file cleanup based on modification time.
find
bash
This code searches for files in `/path` that were modified more than 30 days ago. It uses the `find` command with options `-type f` to specify files and `-mtime +30` to filter by modification time. This demonstrates finding files based on their last modification date.
find
bash
Find symbolic links named `foo.txt` in the `/path` directory. This demonstrates using `find` to locate specific files by type and name.
find
bash
Find directories named `foo` within the `/path` directory. This demonstrates using the `find` command to search for specific directories by name.
find
bash
Search for files named `foo.txt` in the `/path` directory and its subdirectories. This demonstrates using the `find` command to locate specific files by name.
find
bash
Find all `.png` files in `/path` and execute `pngquant` on each file. This demonstrates using `find` to locate files and apply a command to them.
find pngquant
bash
Find and delete files named `foo.txt` in the specified directory `/path`. This demonstrates using `find` to locate and remove specific files.
find