To search for files or directories, specify a search path and search pattern on the command line. For example:
find /usr -name *emacs -xdev
The example above will search the /usr directory for the emacs editoer and other and other files locates th emacs program and its manual page, the -xdev option tell the command to search only your local machine (if there's any remotely mounted file system, it will be searched as well without the -xdev option and this will take a long tame).
another example would be finding files in /usr/bin directory which are accessed witihin the last 30 days. To do this, use the -atime option of the find command like so:
find /usr/bin -type f -atime +30 -print
the -type in the example above specifies that we want to find files (as opposed to a directory, symlink, device and so on).
You can also use the locate command to search for files and directories. For example, to look for any icons of the emacs text editor, use the locate command like this:
locate *icon*emacs*
The locate command searces a database called locatedb. This database is created with the updatedb command. System managers generally use the cron daemon and an updatedb crontab entry to keep the locate locatedb updated and accurate.
0 comments:
Post a Comment