Results 1 to 4 of 4

Thread: grep command in Linux

  1. #1
    Join Date
    May 2008
    Posts
    29

    grep command in Linux

    Hi,

    I am new to Linux commands.

    I want to know about Linux Grep Command. My friend told me that its very helpful to find files with similar extension, Is it true?

    Please help me with Grep & find command in Linux.

    Thanks in Advance.

  2. #2
    Join Date
    Jan 2009
    Posts
    40

    Re: grep command in Linux

    Grep command searches the given file for lines containing a match to the given strings or words.
    See grep command prints the matching lines. Use grep to search for lines of text that match one or many regular expressions, and outputs only the matching lines.
    syntax:
    Code:
    grep 'word' filename
    grep 'string1 string2'  filename
    cat otherfile | grep 'something'
    command | grep 'something'
    Search /etc/passwd for boo user:
    Code:
    $ grep boo /etc/passwd

  3. #3
    Join Date
    May 2008
    Posts
    29

    Re: grep command in Linux

    Thanks for the quick reply but My actual problem is that I can not find out the exact difference between the "grep" & "find" command.

  4. #4
    Join Date
    Jan 2009
    Posts
    40

    Re: grep command in Linux

    There is some similarity between the commands, that is true. But 'find' is a tool to search the filesystem, while 'grep' is a tool to search for regular expressions in bigger streams of text.
    find searches for files and directories that match a user specified set of criteria. grep searches the contents of files for patterns that match those provided by the user.
    Read the man pages for find and grep for details.

Similar Threads

  1. How to use linux dd command
    By Rubeen in forum Operating Systems
    Replies: 5
    Last Post: 02-04-2010, 10:59 AM
  2. GREP like command for Windows XP
    By RockeЯ in forum Windows Software
    Replies: 4
    Last Post: 24-03-2010, 10:08 PM
  3. Creating script with GREP OR ?
    By Aidan 12 in forum Operating Systems
    Replies: 4
    Last Post: 12-03-2010, 08:36 PM
  4. Linux grep command
    By Alkesh jain in forum Operating Systems
    Replies: 3
    Last Post: 27-05-2009, 09:02 AM
  5. Linux history command and fc command
    By Alkesh jain in forum Operating Systems
    Replies: 3
    Last Post: 26-05-2009, 07:53 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,557,734.18868 seconds with 16 queries