Command Line Tools

how to find text string from grep command

RHCSA exam checks candidate's caliber to find text string from configuration or logs files. Beside exam as a Linux administrator you should know how to use grep to analyze text. In this article I am going to show how to find text string from files in rhel6.

how to find text string

grep returns any lines that have characters, words, or expressions that match your query. we could use grep in two ways either independent or with any commands.

  • To use grep independent run grep with -r switch.
  • To use grep with other command use | pipe sign.

In Linux system configuration and log files could contain several thousand lines.

For example we would like to find whether sshd service start on boot time or not, we would find sshd service status in /var/log/boot.log

find in log file

Take an another example, you would like to find the running process id of firefox use grep with ps command

find in process

Now find in regular text file, first create a test file and then find any string from file

find in regular file

Finally find in configuration file, check whether userlist_enable ( a configuration value which check the access) is enable or not

check in vsftpd file

Search more about

Search in Google for

Custom Search