By command prompt, I mean that for instance: [root@hostname][~]#

I need to display a line 2 lines below the command promt

I can set the absolute position with

tput cup <x> 0

Kwowing the value of the vertical position of the command prompt would solve my problem

How can I know the vertial position of the command prompt in my terminal?


See How to get the cursor position in bash on Stack Overflow. Essentially,

echo -en '\e[6n'

$CURSORPOS will be <line>;<column>. Works for Gnome Terminal, XTerm, Linux console.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.