How to find a file location under Linux

Source: Internet
Author: User

To install PL/SQL, look for the Tnsnames.ora file: Find out what directory This file is under Linux.

Find/-name Tnsnames.ora

To find:

/opt/app/oracle/product/10.2/network/admin/tnsnames.ora
/opt/app/oracle/product/10.2/network/admin/samples/tnsnames.ora

You can also use locate to find

Locate Tnsnames.ora
The result is:/opt/app/oracle/product/10.2/hs/admin/tnsnames.ora.sample
/opt/app/oracle/product/10.2/network/admin/tnsnames.ora
/opt/app/oracle/product/10.2/network/admin/samples/tnsnames.ora

I. Using the file name lookup method:

For example, Suppose you forget httpd.conf the file is in the directory of the system, or even somewhere in the system, you can use the following command:
find/-name httpd.conf
This command syntax seems to be easy to understand, just write-name directly behind find, Indicates that the system is required to search by file name, and finally write the httpd.conf target file name.  Wait a minute. The system displays a list of search results on the computer screen:
etc/httpd/conf/httpd.conf
This is the full path to the httpd.conf file in the Linux system. Find success.
If the system does not show results after entering the above lookup command, do not assume that the system does not perform a Find/-name httpd.conf command, and it is possible that the Apache server is not installed on your system, you can find this configuration file if you install the Apacheweb server and then use the Find/-name httpd.conf.

two. No errors Find tips:

The "find" command in a Linux system is a command that most system users can use, not a root system administrator's patent. However, it is also possible for ordinary users to use the "find" command, which means that the system administrator root in the Linux system can set some file directories to block access mode. This way, ordinary users do not have the right to use the "find" command to query these directories or files. When ordinary users use the "find" command to query these file directories, the "permissiondenied." will often appear. (No access) words. The system will not be able to query the file you want. To avoid such errors, we tried to find the file using the method of the transfer error, such as input:
Find/-name access_log 2>/dev/ Null
three. Find a method based on a partial file name:

For example, we know that a file contains 3 letters of SRM, so it is possible to find all the files containing these 3 letters in the system, and enter:
  Find/etc-name ' *srm* '
This command indicates that the Linux system will look up all of the 3-letter files containing SRM in the/etc directory, such as ABSRMYZ,TIBC.SRM and so on, which can be displayed. If you also know that this file starts with SRM 3 letters, then we can omit the first asterisk, the command is as follows:
Find/etc-name ' srm* '
This is only a file like Srmyz is found, such as Absrmyz or ABSRM files are not meet the requirements, not be displayed, so the efficiency and reliability of the search file is greatly enhanced.

   four. Query method according to the characteristics of the file:

If you only know the size of a file, features such as modified date can also be found using the "find" command, which is essentially the same as the "search" feature in Windows systems. In Microsoft's search, Search Companion makes it easier to search for files and folders, printers, users, and other computers on the network. It even makes searching on the Internet much easier. The Search Companion also includes an Indexing service that maintains an index of all the files in the computer, making the search faster. When you use Search Companion, users can specify multiple search criteria. For example, users can search for files and folders by name, type, and size. Users can even search for files that contain specific text. If the user is using active Directory, you can also search for a printer with a specific name or location.
For example, we know a Linux file size of 1,500bytes, so we use the following command to query the find/-size
Span style= "color: #000000;" >1500C, the character C indicates that the size of the file to find is in bytes. If we do not know the exact size of this file, then in Linux can also be used in the fuzzy search method to solve. For example, we enter the Find/-size+10000000c command, which indicates that we specify that the system finds files larger than 10000000 bytes in the root directory and displays them. The "+" in the command indicates that the system is required to list only files larger than the specified size, while using "-" means

find/-amin-10 # Find files accessed in the last 10 minutes of the system
Find/-atime-2 # Find files accessed in the last 48 hours of the system
Find/-empty # Find files or folders that are empty in the system
Find/-group Cat # Lookup in the system belongs to GROUPC At Files
Find/-mmin-5 # Find files modified in the last 5 minutes of the system
Find/-mtime-1 #查找在系统中最后24小时里修改过的文件
Find/-nouser #查找在系统中属 To void a user's file
Find/-user Fred #查找在系统中属于FRED这个用户的文件

The following list is part of the criteria for finding the characteristics of a file that can be specified by the Find command. There are no search criteria listed here, refer to the linux for books you can know all the find functions of the Find command.

-amin N
Find the last n minutes of files accessed in the system
-atime N
Find the last n*24 hour Access file in the system
-cmin N
Find files in the system for the last N minutes changed state
-ctime N
Find files that have been changed in the last n*24 hours of the system
-empty
Find a blank file in the system, or a blank file directory, or a folder with no subdirectories in the directory
-false
Find files that are always wrong in your system
-fstype type
Find files in the system that exist on the specified file system, for example: ext2.
-gid N
Find files with file Number group ID N in the system
-group Gname
Find files in the system that belong to the Gnam filegroup, and specify the group and ID of the file

How to find a file location under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.