[vps tutorial] Common file search commands for Linux VPS hosts

888u

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

Generally speaking, Linux is not like Windows. When searching for a certain file or checking the modification time of a certain file, it is far less convenient than Windows. However, we generally consider Linux when building websites. Windows is too expensive.

Today we will share with you how to use find to find files in Linux vps.


First, the general usage parameters of the find command

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

The above is the general statement of the find command. 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.


Let’s analyze it with a few examples.

Check the .PHP files in the current directory that have been modified 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.

Find PHP files in the current directory that have been modified within 24 hours

find . -name '*.php' -mtime 0

Find files starting with an uppercase letter in the current directory

find . -name "[A-Z]*" -print

Find files starting with vps in the www directory

find /www -name "vps*" -print

Find files with 777 permissions in the current directory

find . -perm 777 -print

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. Of course, it is not limited to these. There are many other uses that we will learn and accumulate when necessary. After all, we only use Linux to build websites, not for research. Of course, studying is another matter.

Recommended site searches: server costs, Japanese server free, American virtual host, private server rental, Ministry of Industry and Information Technology filing system, Hong Kong host high defense, pw domain name, space service provider, online IP check, Korean website domain name,

[vps tutorial] Common file search commands for Linux VPS hosts

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