# How to see where a symbol is defined

**URL:** https://discourse.julialang.org/t/how-to-see-where-a-symbol-is-defined/85406
**Category:** General Usage
**Tags:** question
**Created:** [August 6, 2022, 4:56pm UTC](https://discourse.julialang.org/t/how-to-see-where-a-symbol-is-defined/85406 "2022-08-06T16:56:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Lilith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lilith/32/27492_2.png) [@Lilith](https://discourse.julialang.org/u/Lilith)
#### Post date: [August 6, 2022, 4:56pm UTC](https://discourse.julialang.org/t/how-to-see-where-a-symbol-is-defined/85406/1 "2022-08-06T16:56:36Z")

</div>

If I have the file

```julia
function f end

f(x) = x
f() = 5

```

I can use `methods` to find the method definitions on lines 3 and 4, but how can I find the function declaration on line 1?

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [August 6, 2022, 4:58pm UTC](https://discourse.julialang.org/t/how-to-see-where-a-symbol-is-defined/85406/2 "2022-08-06T16:58:28Z")

</div>

if you know this is the pattern I’d just grep `function ...`

---

<div class="post-metadata">

### Author: ![Lilith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lilith/32/27492_2.png) [@Lilith](https://discourse.julialang.org/u/Lilith)
#### Post date: [August 6, 2022, 5:03pm UTC](https://discourse.julialang.org/t/how-to-see-where-a-symbol-is-defined/85406/3 "2022-08-06T17:03:37Z")

</div>

That would work in this specific case. Perhaps I should have asked a more general question: How can I find where a symbol is declared

```julia
function f end # here
f(x) = x

g(x) = 5 # here
g() = 5

struct T # here
    x::Int
end

const N = 3 # here
```
