-->
Previous Table of Contents Next


locate......Locate Pattern

locate option(s) pattern(s)

PURPOSE

The locate command locates a pattern in a database of filenames and returns the filenames that match. A pattern can contain shell-style metacharacters (*, ?, and []), but / and . are treated as part of the filename. If there are no metacharacters, then filenames are returned in the database that contain the string anywhere. If metacharacters are included, the locate command displays filenames that contain the exact pattern, so use * at the beginning or end of a pattern with metacharacters.

OPTIONS

-d path Searches the filename database in path, a colon-separated list of database filenames.
--help Prints a list of options and exits.
--version Returns locate version and exits.

RELATED COMMANDS

find
locatedb
lockfile
updatedb
xargs

locatedb......Locate File

locatedb option(s) pattern(s)

PURPOSE

The locate command locates a pattern in a database of filenames and returns the filenames that match. A pattern can contain shell-style metacharacters (*, ?, and []), but / and . are treated as part of the filename. If there are no metacharacters, then filenames in the database are returned that contain the string anywhere. If metacharacters are included, the locate command displays filenames that contain the exact pattern, so use * at the beginning or end of a pattern with metacharacters.

RELATED COMMANDS

find
locate
lockfile
updatedb
xargs

lockfile......Locks File

lockfile option filename

PURPOSE

The lockfile command creates one or more semaphore files, which limit access to a file. If lockfile can’t create the semaphore files in order, it waits for eight seconds and tries again; you can use the -r option to specify the number of times it will retry. The resulting files will have an access permission of 0 and need to be removed with rm -f.

OPTION

-r num Retries num of times before giving up.

RELATED COMMAND

rm

ls......List Files

ls option(s) name(s)

PURPOSE

The ls command lists the contents of a specified directory or extended information about a specified file. If no name is given, then it’s assumed that you want the contents of the current directory. Files are by default listed in columns, sorted vertically. While this can be a complex command, especially in the option-laden GNU version (with 38 options), chances are good that you’ll stick with the -F and -l options the most, and use the -u and -c options the least.

OPTIONS

-1 Lists one file per line.
-7 Treats all characters outside the ASCII (ISO 646) set (0x20-0x7E) as nonprintable control characters.
-8 Treats all characters from the 8-bit ISO 8859 character sets (0x20-0x7E, 0xA1-0xFF) as printable, including ASCII. (Default.)
-a Lists all files in a directory, including hidden files.
-A Lists all the contents of a directory, except for . and
-b Displays nongraphic characters using alphabetic and octal backslash sequences like those used in C.
-B Ignores backups (files ending with ~),
-c Sorts contents according to status change time.
-C Lists files in columns, sorted vertically.
-d Lists directories like other files, without their contents.
-e Lists all times in full.
-f Displays contents as found in disk, and not sorted in any way.
-F Lists the file types by character: / for directories, @ for symbolic links, | for FIFOs, = for sockets, and nothing for regular files.
-G Omits group ownership when listing files in long format.
-i Displays an index number of each file.
-I pattern Ignores files that match pattern.
-k Lists file sizes in kilobytes.
-l Lists files in long format, including the file type, permissions, number of hard links, owner name, group name, size in bytes, and timestamp (the modification time unless other times are selected).
-L Displays files by symbolic links instead of listing the contents of the links.
-m Lists files horizontally, separated by commas.
-n Lists the numeric UID and GID instead of the filenames.
-N Omits filenames from the listings.
-o Toggles the display of the files by colors.
-p Appends a character to each filename indicating the type.
-q Prints question marks in the place of nongraphic characters in filenames.
-Q Encloses filenames in double quotes (“) and display nongraphic characters like those used in C.
-r Sorts filenames in reverse order.
-R Lists contents of directories recursively.
-s Prints the size of the file (in 1K blocks) to the left of the filename.
-S Sorts files by file size, not alphabetically, with the largest files first.
-t Sorts files by timestamp (newest first) instead of alphabetically.
-Tcols Sets the tab stops at cols columns. The default is 8. Setting 0 disables tabs.
-u Sorts files by the last time they were accessed, not modified.
-U Displays contents as found in disk, and not sorted in any way.
-w cols Sets the screen as cols characters wide. The default is 80.
-x Prints listings in columns, sorted horizontally.
-X Sorts files alphabetically by file extensions.


Previous Table of Contents Next