![]() The opposite can be specified using -basename. w, -wholename Match only the whole path name against the specified patterns. V, -version Write information about the version and license of locate on standard output and exit successfully. locate(1) is much younger than find(1). find(1), though, has many advantages over locate(1): find(1) is primordial, going back to the very first version of AT&T Unix.You will even find it in cut-down embedded Linuxes via Busybox.It is all but universal. s, -stdio Ignored, for compatibility with BSD and GNU locate. locate(1) has only one big advantage over find(1): speed. regex Interpret all PATTERNs as extended regexps. No PATTERNs are allowed if this option is used, but this option can be specified multiple times. r, -regexp REGEXP Search for a basic regexp REGEXP. For a simple explanation, the file indexing database in Unix system called slocate will list the locations of all files which ship with the Unix system. q, -quiet Write no messages about errors encountered while reading and processing databases. Both the locate and find commands will find a file, but they work in quite different ways. S, -statistics Write statistics about each read database to standard output instead of searching for files and exit successfully. This option is designed for interoperability with the -null option of GNU xargs(1). 0, -null Separate the entries on output using the ASCII NUL character instead of writing each entry on a separate line. This causes broken symbolic links to be reported like other files. P, -nofollow, -H When checking whether files exist (if the -existing option is specified), do not follow trailing symbolic links. m, -mmap Ignored, for compatibility with BSD and GNU locate. If the -count option is specified, the resulting count is also limited to LIMIT. l, -limit, -n LIMIT Exit successfully after finding LIMIT entries. i, -ignore-case Ignore case distinctions when matching patterns. h, -help Write a summary of the available options to standard output and exit successfully. The opposite can be specified using -nofollow. This causes broken symbolic links to be omitted from the output. L, -follow When checking whether files exist (if the -existing option is specified), follow trailing symbolic links. e, -existing Print only entries that refer to files existing at the time locate is run. Note that a database can be read from the standard input only once. A database file name - refers to the standard input. An empty database file name is replaced by the default database. If more than one -database option is specified, the resulting path is a concatenation of the separate paths. DBPATH is a :-separated list of database file names. ![]() d, -database DBPATH Replace the default database with DBPATH. c, -count Instead of writing file names on standard output, write the number of matching entries only. b, -basename Match only the base name against the specified patterns. Option -A, -all Print only entries that match all PATTERNs instead of requiring only one of them to match. ดูข้อมูล stat ของ locate catalog $ locate -S Database /var/lib/mlocate/mlocate.db: 14,942 directories 132,761 files 7,168,592 bytes in file names 3,062,580 bytes used to store database Locate $ locate find /bin/btrfs-find-root /bin/findmnt /etc/apparmor.d/abstractions/apparmor_api/find_mountpoint /sbin/findfs /usr/bin/find All the best.Linux Command – locate ใช้ในการค้นหา file หรือ directory So based on the nature, it is clear that locate is faster than find but find is real time. Therefore, it requires a lot of I/O calls. It will actually go and search all the directories to find the particular file specified and it examine each file one-by-one.Thus, many Linux system administrators use a cron job to regularly update the slocate database.įind will work in an online/"in real time" mode. Absent from traditional UNIX, is GNU software and comes standard with Linux. Executing locate again will now find the newly created file. Finds all filenames that match the specified query. locate certainly has a place in my toolbox but it's usually right at the bottom as a last-ditch effort to find something. To overcome this problem, you can use updatedb to update the slocate database. It can do things based on attributes, not just names. The problem with locate is if you just created a file which you now want to search for, locate will not work because the slocate database is not up-to-date. When you execute locate, it'll use that database to search for a particular file. For a simple explanation, the file indexing database in Unix system called slocate will list the locations of all files which ship with the Unix system.Both the locate and find commands will find a file, but they work in quite different ways.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |