What is the difference between grep and find commands?

A)provides information on help
b)grep searches in a file whereas find searches for files and directories.
c)both a) and b)
d) none of the above

Questions by sumanktree

Showing Answers 1 - 47 of 47 Answers

santhanam

  • Jun 28th, 2007
 

Grep is used to find strings in a file.

Find is used to find a file in a directory or to find directory in the list of directories.

wow_suraj

  • May 7th, 2008
 

'grep' and 'find' both are used as matching pattern keywords. Whereas the difference between both the keywords are of their uses. 'find' command is used in case we need to locate any file name or diresctory name withing a directory. Whereas the 'grep' command is used to match a text appearing in a file.

  Was this answer useful?  Yes

cmanne

  • Sep 2nd, 2009
 

GREP is for finding out the string pattern inside a file

FIND is an utility for searching file and folders based on size, access time, modification time.

The basic difference is FIND is for searching files and directories at system level while GREP is for searching a pattern inside a file.

  Was this answer useful?  Yes

goksn

  • Sep 6th, 2009
 

Grep usually takes the input from another command (usually content of file or folders etc) where Find works without taking input from another command.

Find is more powerful thatn grep with many options like

-access time
-modification time
-user name
-terminal name
-folder
-file
-character file
etc..

Also, with find command we can execute certain actions (like removing the found files etc)

  Was this answer useful?  Yes

Vidhya

  • Jul 21st, 2011
 

Find is for finding files , Like you need to find a file named passwd
kk

find / -name "passwd"

output
/etc/passwd
there are several , U have to check that

If we need to check inside the file we need "grep"
grep is a pattern searching tool
like
grep hari /etc/passwd.

what is a pattern ?
do this
ls -l
rwx rwx rwx and lot here file 1
drwxrwxrwx and lot more file 2
.
.
so forth,
if u need to display a particular pattern like Directory "d"
u can type like that
ls -l | grep 'd'
it will shows all directory
| called PipE, makes input of one command to the output of another one. it is a special file system.
it will display like that

  Was this answer useful?  Yes

Rajesh

  • Jul 22nd, 2011
 

Grep Searches the content of a file and whereas find only searches files and directories

  Was this answer useful?  Yes

suresh

  • Feb 22nd, 2015
 

what is difference between grep -i and grep -v?

  Was this answer useful?  Yes

Nandana

  • Mar 9th, 2015
 

grep -i : Ignore case sensitive
grep -v : Display all lines that do NOT match

  Was this answer useful?  Yes

SK

  • Apr 16th, 2015
 

Grep is searching a pattern or string/text in the files, where will return the list of files that contains that string pattern with occurrence.

The Find the other hand, is a searching command for files/directory name based on provided regular expression.

  Was this answer useful?  Yes

valli

  • Apr 21st, 2015
 

grep -i (it will display both uppercase and lower case)
grep -v(invert search)
invert search (it will display other than that specified string in grep)

  Was this answer useful?  Yes

pinnaka

  • Jun 30th, 2015
 

Answer is b
grep command is used to find strings in a file.
find command is used to find a file in a directory or to find directory in the list of directories.

  Was this answer useful?  Yes

vijay

  • Jan 2nd, 2016
 

b)grep searches in a file whereas find searches for files and directories.

  Was this answer useful?  Yes

Subrata Chakrabortty

  • Mar 9th, 2016
 

grep is the short form of global regular expressions, so it generally searches for a word in a file or in a list of files. On the other hand find can find a regular file, directory file and special file based on name, i-node number, type, modification time, access time, change time. We can perform certain functions also (like rm, cp, mv) by using exec option with find command.

  Was this answer useful?  Yes

sandip

  • Sep 4th, 2016
 

In find command we can search all type of file or directory.
like: inode number wise, size wise, name wise, permission wise etc.

  Was this answer useful?  Yes

Parth Gandhi

  • Dec 6th, 2017
 

c) both a and b

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions