Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
    
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 at 1:49
up vote 5 down vote accepted

POSIXly:

$ NL='
'
$ PS1=${PS1}${NL}
$
<cursor here>
share|improve this answer
    
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 at 7:12
    
Add it to your rc file, .bashrc, .zshrc ... – cuonglm Mar 16 at 7:25

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
share|improve this answer

Another way in bash, yash is:

$ PS1="$PS1\n"
share|improve this answer
    
Thank you, cuonglm, for revising this answer. – user31172 Mar 10 at 14:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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