4

Is there any way I can configure terminal applications to display command text from front of $ to under the user name on terminal window? See image attached. I use terminator.

enter image description here

1
  • Note, though, that vertical screen space is more limited than horizontal. Modern displays typically have aspect ratios of 16:9 (e.g. 1920x1080) or 16:10 (e.g. 1920x1200). It's easy to have a terminal window far wider than you need it to be (which is great for viewing log files), but adding extra line-feeds to the prompt further reduces the limited number of lines that can display meaningful information. – cas Mar 11 '16 at 1:49
6

POSIXly:

$ NL='
'
$ PS1=${PS1}${NL}
$
<cursor here>
2
  • Thanks, it worked, but it only stays there for the current session. On restarting the terminal (in my case, the Terminator), the cursor goes back to the same old position, the front of command prompt. Can I do this permanently? – 8thperson Mar 16 '16 at 7:12
  • Add it to your rc file, .bashrc, .zshrc ... – cuonglm Mar 16 '16 at 7:25
5

In bash (and yash), add a newline \n at the end of the PS1 environment variable.

For example:

$ echo "$PS1"
\[\e]0;\u@\h: \w\a\]\u@\h:\w\$ 

$ PS1='\[\e]0;\u@\h: \w\a\]\u@\h:\w\$\n'

$
echo "$PS1"
\[\e]0;\u@\h: \w\a\]\u@\h:\w\$\n

To make it permanent, save it in your shell startup configuration file (for example ~/.bashrc):

echo "PS1='\[\e]0;\u@\h: \w\a\]\u@\h:\w\$\n'" >>~/.bashrc
0
4

Another way in bash, yash is:

$ PS1="$PS1\n"
0

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.