Linux Operating System provides command to allow the user to search for files and folder in the desired directory. This is provided to facilitate a faster way of searching files and directories. In Linux, the find command is used. This gives the easiest way to look for files and directories in the system. The find command offers a variety of arguments which can be used by users in some situations.

The Linux find command searches in any specified directory the files the user specifies in the search criteria. The user can search for any files either by name, group, owner, date, permissions granted and any other criteria. The arguments of the find command are optional. The syntax of the search command is:

               find <where-to-look> <criteria> <what-to-do>
The simplest way to issue a find command is:
find
which displays all files in the current directory and all its subdirectories. For example, the commands:
find . -print
find –print
find .
give the same output as the first one.
To use the find command using any criteria, the following command is issued:
find / -name foo
which searches all files whose filename is foo. The output might be:
/home/wpollock/foo
/home/ua02/foo
/tmp/foo

Linux also allows users to search for files which are created at a specified time. In specifying time with find options, the mmin and mtime options are specified. For example,
find . -mtime 0   # find files modified between now and 1 day ago
# (i.e., within the past 24 hours)
find . -mtime -1  # find files modified less than 1 day ago
# (i.e., within the past 24 hours, as before)
find . -mtime 1   # find files modified between 24 and 48 hours ago
find . -mtime +1  # find files modified more than 48 hours ago
find . -mmin +5 -mmin -10 # find files modifed between
# 6 and 9 minutes ago
In addition, using the –printf action is useful to control the output. The –printf command produces outputs which can be parsed with other utilities and imported into the database or spreadsheet. The following command displays non-hidden files:
find . -maxdepth 1 -name ‘[!.]*’ -printf ‘Name: %16f Size: %6s

Best services for writing your paper according to Trustpilot

Premium Partner
From $18.00 per page
4,8 / 5
4,80
Writers Experience
4,80
Delivery
4,90
Support
4,70
Price
Recommended Service
From $13.90 per page
4,6 / 5
4,70
Writers Experience
4,70
Delivery
4,60
Support
4,60
Price
From $20.00 per page
4,5 / 5
4,80
Writers Experience
4,50
Delivery
4,40
Support
4,10
Price
* All Partners were chosen among 50+ writing services by our Customer Satisfaction Team

For administrator type of account, they can use find to look for suspicious files in the system. This can be done by:
find / -noleaf -wholename ‘/proc’ -prune
-o -wholename ‘/sys’ -prune
-o -wholename ‘/dev’ -prune
-o -wholename ‘/windows-C-Drive’ -prune
-o -perm -2 ! -type l  ! -type s
! ( -type d -perm -1000 ) -prin
(Pallock, 2002-2008, http://content.hccfl.edu/pollock/unix/findcmd.htm)

To issue command to find all files in the system which ends in .pdf or .PDF, the following command is issued in the command line:
find . –name *.pdf or
find . –name *.PDF
To find all executable files in the system which ends with the letter k or K, the following command is issued:
find . -name *k or
find . -name *K

Reference:
Pallock, Wayne. 2002-2008. A Unix/Linux “find” Command Tutorial. Retrieved on September 29, 2008 at http://content.hccfl.edu/pollock/unix/findcmd.htm

x

Hi!
I'm Niki!

Would you like to get a custom essay? How about receiving a customized one?

Check it out