NeilSec: Security Learning Blog

Pentesting, infosec, hacking, learning.

  • Home
  • Knowledgebase
You are here: Home / Linux / grep

grep

2018-01-02 by Neil Leave a Comment

grep is a command line tool that searches text files for lines with matching text patterns and displays them.

It’s commonly used along with the pipe | symbol from commands that output text.

For example if you want to search the syslog for references to devices you could use: cat /usr/log/syslog | grep device which will display lines in the log with the word “device” in them.

It accepts an option call color which will change the colour of the search term so it’s highlighted in the output. E.g. cat /usr/log/syslog | grep –color=auto

To permanently set this colorised output you can use: export GREP_OPTIONS=’–color=auto’ in the shell startup script.

Filed Under: Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

About Me

I’m currently a systems admin / consultant at a IT firm who looks after the computer systems of small businesses in the UK. IT security is only a part of that job. However I’ve always enjoyed breaking into, getting around, subverting and otherwise hacking things, systems and ideas. In tackling some low-level IT security tasks I reignited my interest in the field and this blog charts my progress in the world of Computer Security, legal Hacking, Penetration Testing, Infosec – whatever you want to call it. As a Windows guy I’m learning about Linux, shell-scripting, python and all the other skills needed in this field.

Tags

Apache Boot-to-Root CTF curl dib Dirbuster FreeBSD Hack The Box Linux mysql NFS Penetration Testing PHP RCE shell VulnHub Wordpress

Categories

© 2023 · NeilSec;