# How clear the printed content in terminal and print to the same line?

**URL:** <https://discourse.julialang.org/t/how-clear-the-printed-content-in-terminal-and-print-to-the-same-line/19549>\
**Category:** New to Julia\
**Created:** [January 12, 2019, 3:01am UTC](https://discourse.julialang.org/t/how-clear-the-printed-content-in-terminal-and-print-to-the-same-line/19549 "2019-01-12T03:01:59Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [May 30, 2023, 10:05am UTC](https://discourse.julialang.org/t/how-clear-the-printed-content-in-terminal-and-print-to-the-same-line/19549/10 "2023-05-30T10:05:28Z")

</div>

It is also possible to use the functions defined in `REPL.Terminals`, instead of using the escape sequences directly (the functions just print the sequences anyway):

```julia
import REPL
terminal = REPL.Terminals.TTYTerminal(string(), stdin, stdout, stderr)
println() # Dummy line
for i in (1, "two", :III, "||||")
	REPL.Terminals.cmove_left(terminal, length(string(i)))
	REPL.Terminals.cmove_line_up(terminal)
	println(i)
	sleep(0.5)
end
println("Watch the final number dissapear above me")
sleep(0.5)
REPL.Terminals.cmove_line_up(terminal, 2)
REPL.Terminals.clear_line(terminal)
REPL.Terminals.cmove_line_down(terminal, 3) # If not, next input is above previous output, which looks funny

```

[https://global.discourse-cdn.com/julialang/original/3X/e/3/e3462d91b15938cae094755d4ce7b3a92c6f6e7f.mp4](https://global.discourse-cdn.com/julialang/original/3X/e/3/e3462d91b15938cae094755d4ce7b3a92c6f6e7f.mp4)

This was discovered as I was writing up [Overwriting previous terminal output with built-in functions](https://discourse.julialang.org/t/overwriting-previous-terminal-output-with-built-in-functions/99593).

---

_[View the full topic](https://discourse.julialang.org/t/how-clear-the-printed-content-in-terminal-and-print-to-the-same-line/19549)._
