![]() In the previous example, when you searched for Port in the SSH configuration file, grep returned two lines. Notice that grep finds all lines that match the text pattern regardless of where the pattern is located. For example, to find which port the Secure Shell (SSH) daemon uses, search for Port in file /etc/ssh/sshd_config: $ grep Port /etc/ssh/sshd_config To do this, type grep followed by the text pattern to search for and the file name to search in. The most basic way to use grep is searching for text in a single file. This article covers how to use the grep command to find text. Using grep, you can quickly find text matching a regular expression in a single file, a group of files, or text coming from stdin using the shell pipe operator. However, its main functionality is still the same. Grep evolved over the years, and the most common version available today for Linux, GNU grep, has additional features such as colored output. This utility was originally developed for the Unix operating system in the early 1970s. The most common way to find text in a Linux system is using the command-line utility grep.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |