How to find a file location under Linux (GO)

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/gray13/article/details/6365654

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 results are:

/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, if you forget httpd.conf the file is in the system directory, or even somewhere in the system, you can use the following command: Find/-name httpd.conf This command syntax seems easy to understand, is directly behind the find write-name, indicating that the system according to the file name, and finally write httpd.conf the target file name can be. 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 on the Linux system.   Find success. If the system does not show results after entering the Find command above, do not assume that the system does not have a Find/-name httpd.conf command, and that the Apache server may not be installed on your system, as long as you install the Apacheweb server and then use the Find /-name httpd.conf will be able to find this configuration file.

  two. No error finding 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 by using the transfer error prompt, for example, entering:Find /-name access_log 2>/dev/null This method is to transfer the lookup error prompt to a specific directory. After the system executes this command, the information that encounters the error is sent directly to the STDERRSTREAM2, ACCESS_LOG2 is that the system will send the error message to STDERRSTREAM2,/dev/null is a special file, indicating empty or wrong information,   The error message that is queried will be shifted and will not be displayed again. Finding files on a Linux system also encounters such a practical problem. If we're on the entire hard drive, it's going to take a long time to find a file in this system, especially for large Linux systems and larger hard disks, where files are placed in deep-nested directories. If we know that this file is stored in a large directory, you can save a lot of time by looking down in this directory. Use Find/etc-name httpd.conf to solve this problem. The above command indicates that the httpd.conf file is queried in the ETC directory. Here again "/" The meaning of this function symbol, if the input "find/" means that the Linux system is required to find the entire root directory file, that is, the entire hard disk to find files, and "Find/etc" is only in the ETC directory to find files. Because "find/etc" means to find files only in the ETC directory, the speed of the lookup is much faster.

  three. Find the method according to the partial file name:

For example, if we know that a file contains 3 letters of SRM, 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 etc The entire directory to find all the files containing the SRM 3 letters, such as ABSRMYZ,TIBC.SRM, and so on, can be displayed in the eligible files. 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, Files such as Absrmyz or ABSRM do not meet the requirements and are not displayed, so the efficiency and reliability of finding files is greatly enhanced.

four. Root According to the characteristics of the file Query method: If you only know the size of a file, modification date and other features can also use the "find" command to find out, which is the same as the "search" function in Windows system is basically the same. 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, then we use the following command to query the find/-size 1500c, the character C indicates that the size of the file to find is in bytes units. 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, if we enter find /-size+10000000c This command, we indicate 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 only lists files larger than the specified size, while using "-" indicates that the system is required to list files smaller than the specified size. The following list is the system's look-up action after Linux uses a different "find" command, which makes it easy to see how the "find" command is used in Linux in many ways, with the "find" command looking for a file that is as flexible as it can be in Windows.

Find/-amin-10 # finds 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/g Roup Cat # Find files that belong to Groupcat in the system find/-mmin-5 # Find files that have been modified in the last 5 minutes of the system find/-mtime-1 #查找在系统中最后24小时里修改过的文件 Find/-no User #查找在系统中属于作废用户的文件 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, so refer to the Find function of all find commands for Linux-related books.

-amin N Find the last n minutes of access to a file in the system-atime N find the last n*24 hours of access to the file in the system-cmin n find the last n minutes of the changed state in the system file-ctime n Find the last n*24 hour in the system changed state of the text   -empty find a blank file in the system, or a blank file directory, or a folder in a directory that does not have subdirectories-false find the file in the system that is always wrong-fstype type find files in the system that exist in the specified file system, for example: ext2. -gid n finds files in the system that have a file number group ID of n-group gname find the files in the system that belong to the GNAM filegroup and specify the group and ID.

How to find a file location under Linux (GO)

Related Article

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.