Friday, December 2, 2011

UNIX command find

UNIX has got a very good file system. It uses the principle of inodes to store a file logically in its file system.

How to find a file in unix ?

Below are the commands to find a file in unix.

case 1:

$ cd /(path of the file or folder )
$ ls -l | grep -i 'filename.*'

This will search a file in unix server and displays the file names matching the pattern 'filename.*'.

case 2:

Using find command in unix

$ find /path -type -f  -name '*.sh'

We can also search the list of files owned by a user using the below command.

$ find /path  -user username

1 comment: