Skip to content
This repository has been archived by the owner on Jun 2, 2020. It is now read-only.

Locate #668

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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 _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!