A compilation of common find command parameters and usage for Linux VPS hosts

888u

Last update at :2024-07-02,Edit by888u

Under normal circumstances, when we build a website or run some projects, we will choose Linux VPS or server platform. However, when looking for a certain file or checking the modification time of a certain file, it is not as convenient as the Windows system to directly check the graphical view. It is also true that many Chinese webmaster users still like to use Windows VPS hosts or servers if allowed. For them, Linux is somewhat inadequate.

For example, if we are looking for whether system/website files exist or have been modified, we can use the find command. In previous contacts, Snail has only used it to find out whether there is a file in the current directory, or to find out whether a certain file has been modified within a certain period of time. Other contacts are better. In this article, we will organize and share some commonly used find application parameters.

First, general usage parameters of find command

find pathname -options [-print -exec -ok …]

The above is the general statement of the find command, and the specific parameters are as follows:

A – pathname: Indicates the file path searched by the find command. For example, we can use . to represent the current path directory, and / to represent the system root directory address. B – print: Using the find command will output the matching files to the standard output. C – exec: Use the find command to execute the shell command given by this parameter on the matching file. D – ok: This has the same effect as -exec, except that it executes the shell command given by this parameter in a safer mode.

It’s okay if you don’t read the above explanation, but it feels very vague when you look at it. It doesn’t matter. Here, just use a few examples to mix a few commonly used ones into the find command and apply it to solve the problem.

Second, practical methods of commonly used find commands

A – Check the modified .PHP files in the current directory within 60 minutes

find . -name \\’*.php\\’ -mmin -60

This is more commonly used to check web page files to see if there are any traces of modification.

B – Find PHP files modified within 24 hours in the current directory

find . -name \\’*.php\\’ -mtime 0

C – Find files starting with a capital letter in the current directory

find . -name \\”[A-Z]*\\” -print

D – Find files starting with vps in the www directory

find /www -name \\”vps*\\” -print

E – Find files with 777 permissions in the current directory

find . -perm 777 -print

Similarly, we can modify the check for 755 or 644 permissions.

F – Find files in the current directory that are larger than 1MB in bytes

find . -size +1000000c -print

The above are the daily uses of the find command that Snail has come into contact with. Of course, it is not limited to these. There are many other uses that we will learn and accumulate when necessary. After all, we are not studying Linux systems. , the most common problem is that you need to consult the documentation to solve it, and basic application mastery is enough.

Recommended site searches: dynamic ip server, free US hosting, quick domain name registration, hosting space, German server, my ip, registration-free jsp space, domain name valuation query, how to check ip address, domain name query network,

A compilation of common find command parameters and usage for Linux VPS hosts

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码