LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 11-17-2011, 04:52 PM   #1
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Rep: Reputation: Disabled
(problem) Linux command line overwrites itself on long commands.


I'm using Debian 6.0 and I have recently modified the bash prompt for root. (from the .bashrc file). The problem is that when I am writing longer commands, the text starts from the same line overwriting the prompt instead of passing on the next line (or continuing on the same line as there is still room). I have attached a picture illustrating the problem (the green highlight is where the typing cursor is). I have also ssh-d into the machine, and the same thing happens. When I try to log in as another user (with a normal bash prompt), the problem is no longer present. Can you tell me what might be causing this issue and how to solve the problem please?
Attached Thumbnails
Click image for larger version

Name:	error linux.png
Views:	146
Size:	1.3 KB
ID:	8404  
 
Old 11-17-2011, 05:02 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Well, first put the prompt back to what it was (or the same as a working user).
2nd, show us what your new prompt definition looks like and tell us what you are trying to do.
 
Old 11-17-2011, 05:08 PM   #3
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
Well, first put the prompt back to what it was (or the same as a working user).
2nd, show us what your new prompt definition looks like and tell us what you are trying to do.
At the first point, I wouldn't want that. I want to know how to be able to type normally with any prompt I want. That is not supposed to be a problem.

Secondly, the prompt definition ($PS1) is: \e[0;31m\t\e[m-\e[0;32m\[\u\]\e[m@\e[0;36m\h\e[m:\e[0;23m\w\e[m\e[0;32m\$\e[m

I'm trying to write commands longer than 10 characters without having the string I'm typing continue at the beginning of the line, overwriting the prompt (and being harder to read).

Last edited by venom4u31; 11-17-2011 at 05:20 PM.
 
Old 11-18-2011, 12:33 PM   #4
Kenhelm
Member
 
Registered: Mar 2008
Location: N. W. England
Distribution: Mandriva
Posts: 360

Rep: Reputation: 170Reputation: 170
Try enclosing each of the colour escape sequences in escaped square brackets.
Code:
PS1='\[\e[0;31m\]\t\[\e[m\]-\[\e[0;32m\]\u\[\e[m\]@\[\e[0;36m\]\h\[\e[m\]:\[\e[0;23m\]\w\[\e[m\e[0;32m\]\$\[\e[m\]'
See "3.4 Non-Printing Characters in Prompts":
http://www.linuxselfhelp.com/howtos/...t-HOWTO-3.html
Also:
http://zeusville.wordpress.com/2007/...pping-problem/
 
1 members found this post helpful.
Old 11-18-2011, 12:41 PM   #5
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Kenhelm View Post
Try enclosing each of the colour escape sequences in escaped square brackets.
Code:
PS1='\[\e[0;31m\]\t\[\e[m\]-\[\e[0;32m\]\u\[\e[m\]@\[\e[0;36m\]\h\[\e[m\]:\[\e[0;23m\]\w\[\e[m\e[0;32m\]\$\[\e[m\]'
See "3.4 Non-Printing Characters in Prompts":
http://www.linuxselfhelp.com/howtos/...t-HOWTO-3.html
Also:
http://zeusville.wordpress.com/2007/...pping-problem/
Woow! It completely solved the problem... Just when I thought the thread was dead. I can't thank you enough for putting this amount of effort for helping me. You really are a credit to this forum mister/ma'am.
 
  


Reply



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
How long can my command-line be? Angus Linux - General 17 11-24-2009 08:31 AM
LXer: Useful Commands For The Linux Command Line LXer Syndicated Linux News 0 03-12-2007 10:01 AM
Konsole wraps up long command to the same line rsashok Red Hat 2 01-30-2007 07:41 PM
bash prompt overwrites instead of going to next line jon23d Linux - General 1 07-09-2006 06:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:13 AM.

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
Open Source Consulting | Domain Registration