Pages

How to find directory in linux based environment using 'find' command

Some time we are using terminal and we need to search some files at same time. So Lets see how we can find any files/folder from terminal

There is one good command to find files on *nix based systems. (Apple machines are not exception to this :) )

We can divide find command syntax as below

Syntax :
find /where/to/look/up criteria action

Suppose you want to find item named 'myworkspace' in your user directoty, you can write find command as
find ~ -name "myworkspace"
In above line '~' represents current user home directory
This command will search and print all items (files/folders) matching 'myworkspace'

Goind further you can also add much more restrition for find , you can ask find command to list only files or folders using 'type' switch.
find ~ -type f -name "sample"  (This will find files only)
find ~ -type d -name "sample"  (This will find folders only)
f stands for File
d stands for Directory 

For more details you can head towards - http://content.hccfl.edu/pollock/Unix/FindCmd.htm !

Simple pattern matching in C

Following code snippet explains simple pattern matching program with modular functions