Saturday, 7 September 2019

FINDING FILES WITH LINUX FIND COMMAND

FIND COMMAND :

The find command helps you to locate files in the file system.

The find command searches through the contents of one or more directories, including all of their sub directories. Tell find in which directory to its search. To search through your directories.

Eg:
     The following examples searches user tecno's directory system for the file devops_file and prints the full path name of any file with that name that it finds.
                            $pwd
                            /usr/tecno
                            $find . -name devops_file -print
                            /usr/tecno/dir/abc/devops_file
                            /usr/tecno/xyz/x1/devops_file
                            /usr/tecno/aaa/a1/a2/devops_file
The first argument is the name of the directory in which the searches starts.
In this case it is current directory (represented by the .)
The second part of the commands specifies the file or files to search for, and the third pard tells find to print the fill pathnames of any matching files.


To search the entire file system, start in the system's root directory, represented by the / :
             $find / -name devops_file -print
This will find a file named devops_file  anywhere in the file system.
Find will skip some files or directiries that it does not have permission to read.

              $find . /tmp/project -name devops_file -print
This command first searches the current directory and its sub directories and the look in /tmp/project and its sub directories.

No comments:

Post a Comment

Streamlining the usage of GITHUB

Streamlining the usage of Github with Commands 1. Start a new git repository under one directory locally In this step, we need to bui...