Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jun 2, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions 40 _commands/basics/locate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
---

locate
---

`locate` : a command used to search a database for the location of files

```bash
# Sample command and output format
$ locate FILENAME
$ /home/user/Documents/FILENAME
```
<!--more-->

### Common examples of commands using locate:

Each command is followed by a sample output format.

```bash
$ locate FILENAME # Outputs the complete path of the file
$ /home/user/Documents/FILENAME
```

Adding `-i` tells locate to ignore case while searching.

```bash
$ locate -i *FILENAME*
$ /home/user/Documents/FILENAME
$ /home/user/Downloads/filename
```

Locate can also be used to search for a string in a file name. Additionally, adding `-c` outputs the number of occurrences.

```bash
$ locate -c STRING # Outputs the count of the occurrences of the string
$ 34
```

Type `man locate` in your terminal to check out the man page for more information!
Morty Proxy This is a proxified and sanitized view of the page, visit original site.