What's new

Welcome to Ruzgar.com

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Ask question

Ask questions and get answers from our community


Answer questions and become an expert on your topic

Contact us

Contact the site administrator directly.


Just like Facebook join them and enjoy.

Centos Lesson 4 Search Functions


Staff member
Oct 3, 2021
Reaction score
In Linux, find, grep, ded and locate commands are used as search functions.

Find Command:​

  • find /ruzgar -name com : Lists the directories with the name com in the ruzgar folder.
  • find . -name "*.jpg" : With this command, we will list the jpg files where we are.
  • find . -user ruzgar : This command lists the documents written by the user ruzgar.
  • find /user -group ruzgar : this command lists documents created by user group named ruzgar.
  • find / -newer ruzgar.txt : This command lists documents created after the creation date of the ruzgar.txt file.
  • find /ruzgar -perm 777 : Lists files with permission status 777 in the /ruzgar folder.
  • find /wind ! -perm 777 : Lists files that do not have 777 permission status in the /ruzgar folder.
  • find . -size +200M : Lists files larger than 200Mb in the current directory.
  • find / -size +50M -size -80M : Lists files between 50Mb and 80Mb in current directory.
  • find . -type d : Lists all files in current directory and subdirectories.
  • find . -type f : Lists all folders in current directory and subdirectories.
  • find . -user wind -perm 777: Lists files with file permission 777 and owned by wind.
  • find /home -size +1M - type f : Folders larger than 1Mb in size are listed in the Home folder.
  • find /ruzgar -iname - com : It will fetch files with com, COM, Com, cOm etc. in ruzgar folder.
  • find / -type f -name "*.jpg" : lists all jpg images in the directory.
  • find / -type f -emtpty : Lists only empty folders.
  • find / -type d -emtpty : Lists only empty directories.
  • find / -type f -name ".*": Lists all hidden files on the system.
  • find / -amin 60: Lists files accessed in the last 1 minute.
  • find / -mmin 60: Lists files modified in the last 1 minute.
  • find / -atime 60: Lists files accessed in the last 60 days.
  • find / -mtime 60: Lists files modified in the last 60 days.

Grep Command:​

The grep command searches by file content. The command is case sensitive. We can turn this sensitivity off with -i.
  • grep ruzgar com.txt : Returns the lines that contain the word wind in the com.txt file.
  • grep -i ruzgar com.txt : Returns the lines in the com.txt file with the word ruzgar, Ruzgar, RUZGAR ....
  • grep iw [ruzgar] com.txt : It returns lines containing blank characters at the beginning and at the end.
  • grep -r [ruzgar] com.txt : Returns all lines containing the word wind.
  • grep ip gar$ com.txt : Returns lines that end with the word gar.
  • grep -iv ^$ com.txt : Returns non-blank lines.