LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 02-18-2008, 12:30 AM   #1
Stevie-B-242
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
Linux
[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
Linux

[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.

--Steve
 
Old 02-18-2008, 12:33 AM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
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-18-2008, 12:38 AM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
In your .bashrc, you may see a line like this:
Quote:
PS1="${_t}${_u}:\w${_p} "
Edit the file to add a new line at the end, like this:
Quote:
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-18-2008 at 12:39 AM.
 
Old 02-18-2008, 02:02 AM   #4
Stevie-B-242
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 well...like so many other things in life, this little trick is painfully easy once you know how to do it.


Thanks!
--Steve
 
Old 02-20-2008, 10:23 AM   #5
KohlInGA
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?
 
  


Reply


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 11:05 PM
Basic Linux Question. rvijay Linux - Distributions 5 03-06-2005 01:16 PM
Basic Linux Wireless Question mntamimi Linux - Wireless Networking 2 02-03-2005 03:09 PM
linux prompt(really newbie question) blackzone Linux - Newbie 5 08-05-2004 01:37 AM
Changing the BASH prompt? Dravis Linux - Software 2 01-22-2004 10:17 PM


All times are GMT -5. The time now is 08:27 PM.

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