Find man printf
This file documents the GNU utilities for finding files that match certain criteria and performing various operations on them. This file documents the GNU utilities for finding files that match certain criteria and performing various actions on them. This manual shows how to find files that meet criteria you specify, and how to perform various actions on the files that you find. The principal programs that you use to perform these tasks are find , locate , and xargs.SEE VIDEO BY TOPIC: 47. Printf float right and left justified in C Programming (Hindi)
SEE VIDEO BY TOPIC: Print Formatting Part 1: printf() Conversion Type Characters (Java)Content:
Subscribe to RSS
This file documents the GNU utilities for finding files that match certain criteria and performing various operations on them. This file documents the GNU utilities for finding files that match certain criteria and performing various actions on them.
This manual shows how to find files that meet criteria you specify, and how to perform various actions on the files that you find. The principal programs that you use to perform these tasks are find , locate , and xargs. Some of the examples in this manual use capabilities specific to the GNU versions of those programs. Many other people have contributed bug fixes, small improvements, and helpful suggestions. Reporting bugs this way means that you will then be able to track progress in fixing the problem.
The mailing list bug-findutils gnu. To join the list, send email to bug-findutils-request gnu. Please read any relevant sections of this manual before asking for help on the mailing list. If you ask for help on the mailing list, people will be able to help you much more effectively if you include the following things:. It may also be the case that the bug you are describing has already been fixed, if it is a bug.
If you take the time to check that your bug still exists in current releases, this will greatly help people who want to help you solve your problem. For brevity, the word file in this manual means a regular file, a directory, a symbolic link, or any other kind of node that has a directory entry.
A directory entry is also called a file name. A file name may contain some, all, or none of the directories in a path that leads to the file. A directory tree is a directory and the files it contains, all of its subdirectories and the files they contain, etc. It can also be a single non-directory file. Actions that you might want to perform on the files you have found include, but are not limited to:. The principal programs used for making lists of files that match given criteria and running commands on them are find , locate , and xargs.
An additional command, updatedb , is used by system administrators to create databases for locate to use. It is run like this:. Here is a typical use of find. Notice that the wildcard must be enclosed in quotes in order to protect it from expansion by the shell. The system administrator runs the updatedb program to create the databases.
Which file names are stored in the database depends on how the system administrator ran updatedb. Most often, these arguments are lists of file names generated by find. The expression that find uses to select files consists of one or more primaries , each of which is a separate command line argument to find. An expression can contain any of the following types of primaries:.
See Combining Primaries With Operators , for ways to connect primaries into more complex expressions. Options take effect immediately, rather than being evaluated for each file when their place in the expression is reached. Therefore, for clarity, it is best to place them at the beginning of the expression.
Many of the primaries take arguments, which immediately follow them in the next command line argument to find. Some arguments are file names, patterns, or other strings; others are numbers. Numeric arguments can be specified as. By default, find prints to the standard output the names of the files that match the given criteria. See Actions , for how to get more information about the matching files. Here are ways to search for files whose name matches a certain pattern. See Shell Pattern Matching , for a description of the pattern arguments to these tests.
True if the base of the file name the path with the leading directories removed matches shell pattern pattern. As of findutils version 4. True if the entire file name, starting with the command line argument under which the file was found, matches shell pattern pattern. These paths are often not absolute paths; for example.
True if the entire file name matches regular expression expr. This is a match on the whole path, not a search. For example, to match a file named. This option is positional; that is, it only affects regular expressions which occur later in the command line.
If this option is not given, GNU Emacs regular expressions are assumed. Currently-implemented types are. Regular expressions compatible with GNU Emacs; this is also the default behaviour if this option is not used. Regular Expressions for more information on the regular expression dialects understood by GNU findutils.
To search for files by name without having to actually scan the directories on the disk which can be slow , you can use the locate program. For each shell pattern you give it, locate searches one or more databases of file names and displays the file names that contain the pattern. See Shell Pattern Matching , for details about shell patterns.
If a pattern is a plain string — it contains no metacharacters — locate displays all file names in the database that contain that string. If a pattern contains metacharacters, locate only displays file names that match the pattern exactly. The exceptions are patterns that are intended to explicitly match the beginning or end of a file name. The differences are that the locate information might be out of date, and that locate handles wildcards in the pattern slightly differently than find see Shell Pattern Matching.
The file name databases contain lists of files that were on the system when the databases were last updated. The system administrator can choose the file name of the default database, the frequency with which the databases are updated, and the directories for which they contain entries.
Here is how to select which file name databases locate searches. The default is system-dependent. Instead of searching the default file name database, search the file name databases in path , which is a colon-separated list of database file names. The option overrides the environment variable if both are used. GNU locate can read file name databases generated by the slocate package.
However, these generally contain a list of all the files on the system, and so when using this database, locate will produce output only for files which are accessible to you. The updatedb program can also generate database in a format compatible with slocate. A shell pattern is a string that may contain the following special characters, which are known as wildcards or metacharacters. You must quote patterns that contain metacharacters to prevent the shell from expanding them itself.
Double and single quotes both work; so does escaping with a backslash. Matches exactly one character that is a member of the string string. This is called a character class. As a shorthand, string may contain ranges, which consist of two characters with a dash between them. Removes the special meaning of the character that follows it. This works even in character classes. This is also the case for locate.
Slash characters have no special significance in the shell pattern matching that find and locate do, unlike in the shell, in which wildcards do not match them. There are two ways that files can be linked together.
Symbolic links are a special type of file whose contents are a portion of the name of another file. Hard links are multiple directory entries for one file; the file names all have the same index node inode number on the disk. Symbolic links are names that reference other files. GNU find will handle symbolic links in one of two ways; firstly, it can dereference the links for you - this means that if it comes across a symbolic link, it examines the file that the link points to, in order to see if it matches the criteria you have specified.
Secondly, it can check the link itself in case you might be looking for the actual link. If the file that the symbolic link points to is also within the directory hierarchy you are searching with the find command, you may not see a great deal of difference between these two alternatives. By default, find examines symbolic links themselves when it finds them and, if it later comes across the linked-to file, it will examine that, too. In this situation, find uses the properties of the link itself.
This also occurs if a symbolic link exists but points to a file that is missing. This is the default behaviour. This option must be specified before any of the file names on the command line. If a symbolic link cannot be dereferenced, the information for the symbolic link itself is used. This will delete empty directories. This option is deprecated. True if the file is a symbolic link whose contents match shell pattern pattern. See Shell Pattern Matching , for details about the pattern argument.
So, to list any symbolic links to sysdep. Hard links allow more than one name to refer to the same file. This is useful because hard links cannot point outside a single filesystem, so this can cut down on needless searching. Hence you are searching for other links hard or symbolic to the file pointed to by name. You can also search for files by inode number.
printf(3) - Linux man page
find(1) - Linux man page