« Back to Index

Terminal go back up one line

View original Gist on GitHub

Terminal go back up one line.md

http://stackoverflow.com/questions/6939673/go-back-up-a-line-in-a-linux-console

I know I can go back the line and overwrite its contents with \r.
Now how can I go up into the previous line to change that?

The basic solution involves: \x1B[1F (which effectively is an ANSI Escape Code: Esc [ 1 F)

But in context of a Ruby CLI script: print "\r\x1B[1F\x1B[1F"