Breaking News
Loading...
Monday, September 2, 2013

Basic Find Commands in Linux Part 1

5:55 AM

 

1. Find Files Using Name in Current Directory

Find all the files whose name is howtolinux247.txt in a current working directory.
#  vim howtolinux247.info
# find . -name howtolinux247.txt

./howtolinux247.txt

2. Find Files Under Root Directory

Find all the files under /root directory with name howtolinux247.txt.
# find /root -name howtolinux247.txt

/root/howtolinux247.txt

3. Find Files Using Name and Ignoring Case

Find all the files whose name is howtolinux247.txt and contains both capital and small letters in /root directory.
# find /root -iname howtolinux247.txt

./howtolinux247.txt
./Howtolinux247.txt

4. Find Directories Using Name

Find all directories whose name is howtolinux247 in / directory.
# find / -type d -name Howtolinux247

/Howtolinux247

5. Find PHP Files Using Name

Find all php files whose name is howtolinux247.php in a current working directory.
# find . -type f -name howtolinux247.php

./howtolinux247.php

6. Find all PHP Files in Directory

Find all php files in a directory.
# find . -type f -name "*.php"

./howtolinux247.php
./login.php
./index.php

0 comments:

Post a Comment

 
Toggle Footer