Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7943147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:10:58+00:00 2026-06-04T00:10:58+00:00

This is a weird one that I haven’t been able to find a good

  • 0

This is a weird one that I haven’t been able to find a good answer with Google (of course there’s always the possibility that I just fail at that). On my bash prompt, if I color a part of the prompt, when I hit ‘up’ to go to a previous command, I can’t go to the start of the line after it’s past a certain amount of characters (specifically 31).

My current bash prompt is this: (colors are defined earlier in my .bashrc)

PS1="[\u@$cyan\h$NC \w] "

But if I change it to this:

PS1="[\u@\h \w] "

It no longer prevents me from going to the beginning of the line.

The odd part, is visually, when I hit home to go to the beginning of the line (or use the arrow keys) it stops 11 characters in to the string, but if I edit it from there, it does edit starting at the beginning of the line.

Does anyone know why this might be happening? I would like to use colors in my prompt as I do server administration and the colors is how I differentiate my boxes at a glance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:11:01+00:00Added an answer on June 4, 2026 at 12:11 am

    Non-printing sequences such as color codes must be surrounded by \[ and \] so their lengths are not counted as part of the length of the prompt.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a weird one. On and off as I have been working on
I've searched through several suggestions on this site and haven't quite been able to
There is this weird bug in my program that I'm trying to fix, but
One of my users is having this weird problem that I cannot seem to
This is a weird one. I have a page that simple_format's a comments attribute
This is a weird one, but hopefully someone can give me an idea here.
This is a weird one, and unfortunately I can't test it. At my company
Ok, this is a really weird one. I have an MPI program, where each
I know this one is the weirdest of all weird questions I have asked
Boy, this one is really weird. I expect the following code to print 1990,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.