linux find command tutorial: find syntax and examples

linux find – search for files in a directory hierarchy.

syntax

find [-H] [-L] [-P] [-D debugopts] [-Olevel] [starting-point...] [expression]

examples

use find command – find file

➜ find . -name "test*" -type f

find – type filter explanation

➜  blog find . -type d

where x may be any of:

  • b – block device (buffered);
  • c – character device (unbuffered);
  • d – directory;
  • f – regular file;
  • l – symbolic link;
  • p – named pipe;
  • s – socket;
  • D – door.

use ls & grep command

➜ ls -R . | grep -E "test*"

Reference:

https://en.wikipedia.org/wiki/Find_(Unix)
https://en.wikipedia.org/wiki/Grep

More about Linux commands:
 linux awk syntax and awk examples
linux grep command and grep examples
 Linux Commands Tutorial

Add a Comment

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