Wednesday, August 14, 2013

Finding Files & Folders


Find

Syntax

# find location  -name  filename

Example

find /etc -name ifcfg-eth0
Find file named ifcfg-eth0 under the directory /etc.

find /home -user joe
Find every file under the directory /home owned by the user joe.

find /usr -name *stat
Find every file under the directory /usr ending in "stat".

find . -perm 664
Search for files with permission 644 in current directory

find / -inum  1011
Searches for file with inode number 1011 in entire filesystem.


Locate
Locate has comparatively easy syntax, but it is recommended to run updatedb prior to running locate.

# updated
# locate filename
Example –
# locate passwd

0 comments: