# How do I move the cursor up?

**URL:** https://discourse.julialang.org/t/how-do-i-move-the-cursor-up/120882
**Category:** General Usage
**Created:** [October 4, 2024, 2:38am UTC](https://discourse.julialang.org/t/how-do-i-move-the-cursor-up/120882 "2024-10-04T02:38:35Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Paul\_Warburton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_warburton/32/206802_2.png) [@Paul\_Warburton](https://discourse.julialang.org/u/Paul_Warburton)
#### Post date: [October 4, 2024, 2:38am UTC](https://discourse.julialang.org/t/how-do-i-move-the-cursor-up/120882/1 "2024-10-04T02:38:35Z")

</div>

I want to print an array on the screen, then wait 1 second and print it again in the exact location (it will have changed) such that I only ever see one copy and the screen does not scroll downwards.

I just need a escape code the moves the cursor up one row? Is that possible\>

Cheers, Paul

---

<div class="post-metadata">

### Author: ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)
#### Post date: [October 4, 2024, 2:52am UTC](https://discourse.julialang.org/t/how-do-i-move-the-cursor-up/120882/2 "2024-10-04T02:52:54Z")

</div>

Here you go

```julia-repl
julia> Base.current_terminfo[:cursor_up] # Private API, do not rely on
"\e[A"

```

---

<div class="post-metadata">

### Author: ![Paul\_Warburton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_warburton/32/206802_2.png) [@Paul\_Warburton](https://discourse.julialang.org/u/Paul_Warburton)
#### Post date: [October 4, 2024, 3:23am UTC](https://discourse.julialang.org/t/how-do-i-move-the-cursor-up/120882/3 "2024-10-04T03:23:52Z")

</div>

Unfortunately this does not work, Does it matter if I am inside Jupyter notebook?

---

<div class="post-metadata">

### Author: ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)
#### Post date: [October 4, 2024, 3:31am UTC](https://discourse.julialang.org/t/how-do-i-move-the-cursor-up/120882/4 "2024-10-04T03:31:29Z")

</div>

Very much so, my answer was presuming you’d be operating from a terminal emulator (TTY).

---

<div class="post-metadata">

### Author: ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)
#### Post date: [October 4, 2024, 5:44am UTC](https://discourse.julialang.org/t/how-do-i-move-the-cursor-up/120882/5 "2024-10-04T05:44:43Z")

</div>

> [@Paul\_Warburton](#):
>
> inside Jupyter notebook

That is very relevant. I don’t use Jupyter but took the liberty of googling for you:

1. For Python [the solution seems to be](https://stackoverflow.com/questions/24816237/ipython-notebook-clear-cell-output-in-code) to call `clear_output` to remove previous output
2. This function is apparently available in IJulia.jl as well  
[Way to programmatically clear last println() statement in Jupyter cell? - #2 by djsegal](https://discourse.julialang.org/t/way-to-programmatically-clear-last-println-statement-in-jupyter-cell/3582/2)
3. However that thread is quite old and apparently it broke some time ago. The comment about it breaking is quite old itself by now. So I suggest you try this and report back if it doesn’t work

Edit: there is an [open issue](https://github.com/JuliaLang/IJulia.jl/issues/1066) about this. Maybe @MilesCranmer can comment if there is a known workaround. @Paul_Warburton if it still doesn’t work then consider commenting on the issue I linked to draw attention to it.
