In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to find tools in Linux", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to find tools in Linux" this article.
The find command is used to find files in the specified directory. Any string that precedes a parameter is treated as the name of the directory you are looking for. If you use this command without setting any parameters, the find command looks for subdirectories and files under the current directory. And all the subdirectories and files found are displayed.
Grammar
Find (option) (parameter)
Option
-amin: find files or directories that have been accessed at a specified time (in minutes)
-anewer: find that the access time is closer to the current file or directory than the specified file or directory
-atime: find files or directories that have been accessed at a specified time, calculated in 24 hours
-cmin: find files or directories that have been changed at a specified time
-cnewer finds that the change time is closer to the current file or directory than that of the specified file or directory
-ctime: find files or directories that have been changed at a specified time, calculated in 24 hours
-daystart: calculate the time from today
-depth: start from the deepest subdirectory under the specified directory
-expty: look for files with a file size of 0 Byte, or empty directories without any subdirectories or files in the directory
-exec: if the return value of the find instruction is True, the instruction is executed
-false: set the return value of the find instruction to False
-fls: the effect of this parameter is similar to specifying the "- ls" parameter, but saves the result as the specified list file
-follow: excluding symbolic links
-fprint: the effect of this parameter is similar to that of specifying the "- print" parameter, but saves the result as the specified list file
-fprint0: the effect of this parameter is similar to that of specifying the "- print0" parameter, but saves the result as the specified list file
-fprintf: the effect of this parameter is similar to that of specifying the "- printf" parameter, but saves the result as the specified list file
-fstype: only look for files or directories under this file system type
-gid: find files or directories that match the specified group identification number
-group: find files or directories that match the specified group name
-help or-- help: online help
-ilname: the effect of this parameter is similar to specifying the "- lname" parameter, but ignores the difference in character case
-iname: the effect of this parameter is similar to specifying the "- name" parameter, but ignores the difference in character case
-inum: find files or directories that match the specified inode number
-ipath: the effect of this parameter is similar to specifying the "- path" parameter, but ignores the difference in character case
-iregex: the effect of this parameter is similar to specifying the "- regexe" parameter, but ignores the difference in character case
-links: find files or directories that match the specified number of hard connections
-iname: specifies a string as a template style for finding symbolic links
-ls: if the return value of the find instruction is Ture, the file or directory name is listed to standard output
-maxdepth: sets the maximum directory level
-mindepth: sets the minimum directory level
-mmin: find files or directories that have been changed at a specified time (in minutes)
-mount: the effect of this parameter is the same as the specified "- xdev"
-mtime: find files or directories that have been changed at a specified time, calculated in 24 hours
-name: specifies a string as a template style for finding files or directories
-newer: find that the change time is closer to the current file or directory than that of the specified file or directory
-nogroup: find files or directories that do not belong to the local host group identification code
-noleaf: do not consider that the directory needs to have at least two hard connections
-nouser: find files or directories that do not belong to the user identification code of the local host
-ok: the effect of this parameter is similar to that of specifying "- exec", but the user is asked before the instruction is executed. If you answer "y" or "Y", the command is abandoned.
-path: specifies the string as the template style for finding directories
-perm: find files or directories that match the specified permission values
-print: if the return value of the find instruction is Ture, the file or directory name is listed to standard output. The format is one name for each column, and each name is preceded by a ". /" string
-print0: if the return value of the find instruction is Ture, the file or directory name is listed to standard output. All names in the format are on the same line
-printf: if the return value of the find instruction is Ture, the file or directory name is listed to standard output. The format can be specified by yourself
-prune: do not look for strings as template styles for finding files or directories
-regex: specifies a string as a template style for finding files or directories
-size: find files that match the specified file size
-true: set the return value of the find instruction to True
-typ: only look for files that match the specified file type
-uid: find files or directories that match the specified user identification number
-used: find files or directories that have been accessed at a specified time after the file or directory has been changed, in daily terms
-user: the file or directory of the finder and the specified owner name
-version or-- version: displays version information
-xdev: limit the scope to the advance file system
-xtype: this parameter has a similar effect to specifying the "- type" parameter, except that it checks for symbolic connections.
Parameters.
Start directory: find the starting directory of the file.
FD
Fd is an ultra-fast, Rust-based replacement for the Unix/Linux find command. It does not provide all the powerful features of find. However, it does provide enough functionality to cover 80% of the situations you may encounter. Features such as good planning and convenient syntax, color output, smart case, regular expressions, and parallel command execution make fd a very capable successor.
Installation
Go to the fd GitHub page and view the installation section. It covers how to install programs on macOS, Debian/Ubuntu Red Hat, and Arch Linux. After the installation is complete, you can get a complete overview of all available command line options by running help, concise help through fd-h, or more detailed help through fd-help.
Simple search
Fd is designed to help you easily find files and folders in your file system. You can use fd to perform the simplest search with a parameter that is anything you want to search for. For example, suppose you are looking for an Markdown document that contains the word services as part of the file name:
$fd servicesdownloads/services.md
If called with only one parameter, fd recursively searches the current directory to find any files and / or directories that match Mo's parameters. The equivalent search using the built-in find command is as follows:
$find. -name 'services'downloads/services.md
As you can see, fd is much simpler and requires less input. In my mind, it is always right to do more with less input.
Files and folders
You can use the-t parameter to limit the search to a file or directory, followed by a letter that represents what you want to search. For example, to find all files in the current directory that contain services in their filenames, you can use:
$fd-tf servicesdownloads/services.md
And, find all directories that contain services in the filename of the current directory:
$fd-td servicesapplications/serviceslibrary/services
How do I list all documents with the .md extension in the current folder?
$fd .mdadministration / administration.mddevelopment/elixir/elixir_install.mdreadme.mdsidebar.mdlinux.md
As you can see from the output, fd can not only find and list files in the current folder, but also find files in subfolders. It's simple.
You can even use the-H parameter to search for hidden files:
Fd-H sessions.. bash_sessions
Specify directory
If you want to search for a specific directory, the name of that directory can be passed to fd as the second parameter:
$fd passwd/etc/ etc/default/passwd/etc/pam.d/passwd/etc/passwd
In this example, we tell fd that we want to search the etc directory for all instances of the word passwd.
Global search
What if you know part of the file name, but don't know the folder? Suppose you download a book about Linux network management, but you don't know where it is saved. No problem:
Fd Administration / / Users/pmullins/Documents/Books/Linux/Mastering Linux Network Administration.epub
Fd is an excellent alternative to the find command, and I'm sure you'll find it as useful as I do. To learn more about this command, just browse the man page.
The above is all the contents of the article "how to find tools in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.