2022-01-16 18:20:39 +00:00
|
|
|
---
|
|
|
|
title: "locating"
|
2022-01-26 21:29:48 +00:00
|
|
|
tags: [ "Documentation", "Basics" ]
|
2022-01-16 18:20:39 +00:00
|
|
|
---
|
2022-01-26 21:29:48 +00:00
|
|
|
# Type
|
|
|
|
|
|
|
|
`type` shows what kind of thing you're running, be it an alias, function, or binary program.
|
|
|
|
|
2023-06-17 19:28:20 +00:00
|
|
|
```bash
|
|
|
|
type cmus
|
|
|
|
```
|
2022-01-26 21:29:48 +00:00
|
|
|
|
2020-01-05 12:33:53 +00:00
|
|
|
# Whereis the Program
|
2020-01-02 00:04:35 +00:00
|
|
|
|
2020-01-05 12:33:53 +00:00
|
|
|
Ask where the `angband` program is, along with all its configuration files:
|
2020-01-02 00:04:35 +00:00
|
|
|
|
|
|
|
`whereis angband`
|
|
|
|
|
2020-01-02 18:20:55 +00:00
|
|
|
Also `which` shows where a binary file (the program) is,
|
|
|
|
|
2023-06-17 19:28:20 +00:00
|
|
|
```bash
|
|
|
|
which cmus
|
|
|
|
```
|
2020-01-02 18:20:55 +00:00
|
|
|
|
2020-01-05 12:33:53 +00:00
|
|
|
# Quick Search for Files
|
2020-01-02 00:04:35 +00:00
|
|
|
|
2022-01-26 21:29:48 +00:00
|
|
|
You'll need to set up `locate` for this by installing `mlocate`.
|
|
|
|
`mlocate` needs a list of all files on the machine, so run:
|
2020-01-05 12:33:53 +00:00
|
|
|
|
2023-06-17 19:28:20 +00:00
|
|
|
```bash
|
|
|
|
sudo updatedb
|
|
|
|
```
|
2020-01-05 12:33:53 +00:00
|
|
|
|
|
|
|
Then to find a file called 'my-cats.jpg', run:
|
|
|
|
|
2023-06-17 19:28:20 +00:00
|
|
|
```bash
|
|
|
|
locate cats
|
|
|
|
```
|
2020-01-02 00:04:35 +00:00
|
|
|
|
2022-01-26 21:29:48 +00:00
|
|
|
For best results, run `updatedb` regularly, perhaps in crontab.
|
|
|
|
|