Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-17-2008, 11:30 PM   #1
LQ Newbie
Registered: Oct 2005
Posts: 9

Rep: Reputation: 0
REALLY BASIC QUESTION on changing the Linux prompt

Is it possible to encode a new line/line feed/carriage return character into the Linux prompt?

Basically, I'm trying to get more "white space" on the terminal so that output that would look like this normally:
[root@c1-n4 ~]# date
Sun Feb 17 21:28:19 PST 2008
[root@c1-n4 ~]# uname
[root@c1-n4 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5 (Tikanga)

will instead look like this:
[root@c1-n4 ~]# date
Sun Feb 17 21:28:19 PST 2008

[root@c1-n4 ~]# uname

[root@c1-n4 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5 (Tikanga)

Thanks for any help you can offer in answering this question.

Old 02-17-2008, 11:33 PM   #2
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Sure ... just embed a newline escape into the PS1 variable, e.g.:

export PS1="\n\u@\h \W\$ "

You will want to put this into your .bashrc so you don't have to retype the command every time you start up a shell.
Old 02-17-2008, 11:38 PM   #3
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,894

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
In your .bashrc, you may see a line like this:
PS1="${_t}${_u}:\w${_p} "
Edit the file to add a new line at the end, like this:
PS1="${_t}${_u}:\w${_p} \n"
For more info on customizing your bash prompt, google up a copy of the Bash-prompt HOWTO.

Last edited by bigrigdriver; 02-17-2008 at 11:39 PM.
Old 02-18-2008, 01:02 AM   #4
LQ Newbie
Registered: Oct 2005
Posts: 9

Original Poster
Rep: Reputation: 0
...thank you both for the "prompt" reply! %-)

That did the trick!

Despite popular belief, there are such things as stupid questions and that may have qualified as one...

...oh so many other things in life, this little trick is painfully easy once you know how to do it.

Old 02-20-2008, 09:23 AM   #5
LQ Newbie
Registered: Nov 2005
Location: Stone Mountain, GA
Distribution: SuSE
Posts: 28

Rep: Reputation: 15
Thumbs up I Loved this Tweak!

As someone not new to Linux but still getting comfortable, I would just like to say what an EXCELLENT question! Not to mention the ANSWERS!

Questions (and replies) like this is one of my main purposes for cruising LQ. Bravo! I can't wait to give give it a try. I'd better stop now before I begin frothing... ...I wasn't frothing was I?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the prompt? Ordinary12 Fedora 14 05-23-2007 10:05 PM
Basic Linux Question. rvijay Linux - Distributions 5 03-06-2005 12:16 PM
Basic Linux Wireless Question mntamimi Linux - Wireless Networking 2 02-03-2005 02:09 PM
linux prompt(really newbie question) blackzone Linux - Newbie 5 08-05-2004 12:37 AM
Changing the BASH prompt? Dravis Linux - Software 2 01-22-2004 09:17 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration