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

  • SEARCH
  • Home
  • 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 4121428
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:21:00+00:00 2026-05-20T23:21:00+00:00

When you scroll through the history the text changes at the prompt. I’ve looked

  • 0

When you scroll through the history the text changes at the prompt. I’ve looked at the structures involved but haven’t looked deep enough in the source code to find out how it changes the text on the screen without changing all the text above it (the prompt, past text that has been printed out.)

It can’t just clear the screen and reprint everything out with only the minor change after the prompt– that would just be so inefficient. How do they do this?

It probably sounds really dumb, but I tried printing a backspace character which results in moving the cursor into the prompt in which when you type it just writes over top of the prompt.

I just can’t figure how they print out text and change it or cycle through text in place.

If anyone knows how this is done I would really appreciate it.

Thanks

  • 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-05-20T23:21:00+00:00Added an answer on May 20, 2026 at 11:21 pm

    bash uses the GNU readline library to do this. It’s ultimately a wrapper over the terminfo library (from System V or the ncurses library), whose purpose is to use terminal descriptions to figure out how to do those updates. If the terminal type is unknown or declared incorrectly, you’ll notice that you either end up with garbage or all the pretty in-place updates go away.

    A terminal description looks something like

    xterm-color|nxterm|generic color xterm,
            am, km, mir, msgr, xenl,
            colors#8, cols#80, it#8, lines#24, ncv@, pairs#64,
            acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
            bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M,
            csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
            cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
            cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
            dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J,
            el=\E[K, enacs=\E)0, home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL,
            il1=\E[L, ind=^J,
            is2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8, kbs=^H,
            kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
            kdch1=\E[3~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~,
            kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~,
            kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~,
            kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~,
            kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
            kfnd=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
            kslt=\E[4~, meml=\El, memu=\Em, op=\E[m, rc=\E8, rev=\E[7m,
            ri=\EM, rmacs=^O, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l,
            rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m,
            rs2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8, sc=\E7,
            setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[m, smacs=^N,
            smcup=\E7\E[?47h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m,
            smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
            u8=\E[?1;2c, u9=\E[c,
    

    and describes how to do various screen updates, what function and action keys are available and what they send, and special terminal behaviors (line-drawing characters, colors and other forms of highlighting, whether it can insert characters in the middle of a line, etc.). You don’t need to understand it, usually, unless something is set up wrong or you’re into advanced terminal hackery. (If you do want to understand it, start with terminfo(5) and the other curses/ncurses/terminfo documentation. If nothing else, you’ll learn how to make really fancy shell prompts.)

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

Sidebar

Related Questions

With my code I can get a div to scroll through 4 images, but
C-b: gives you tmux command prompt. Is there a way to scroll through the
I have a Gallery that contains a ScrollView. I can scroll through the text
All: I want to scroll through a sequence of tumblr/twitter posts as a long
For some reason, whenever I scroll through my list of items, the background inside
I need to scroll up the div as the new text comes in. My
There is no scroll bar when browsed with firefox, but it shows up in
I am attempting to scroll through a database of Album Names using ListView. When
I need to be able to scroll text on a label i am using
Is there a keyboard hot-key to scroll through multiple IntelliSense method overload options for

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.