compare the following screenshots of terminal

screenshot screenshot

2 Answers 2


This usually happens when there are actual trailing spaces in the output, after when the lines appear to end (e.g. because the program used %s in a printf with a length modifier).

The other lines end where they appear to end (i.e. no trailing spaces).

  • BTW, trailing spaces are easily removed by anything that can run s/ *$// or s/\s+$// or similar - e.g. sed, vi, perl, and many others.
    – cas
    Commented Sep 2, 2019 at 13:05

Selecting by default swaps the foreground and background color of the affected cells. (An explicit highlight color can be configured in GNOME Terminal's Prefences, or switched to using the OSC 17 / 19 escape sequences. But let's stick to the default behavior for now.)

If a space becomes yellow (orange, brown, whatever that color is :)) when highlighted, it means that its foreground color is this; which, due to the character being a space rather than a letter, is normally not visible.

apt maintains a temporary status bar (progress message) at the bottom of its output, erasing and overwriting it with messages that it intends to remain on the screen. You can notice that the text of that status bar is the same color as the highlight one. This means two things: apt removes the status bar's characters by overwriting them with spaces (as opposed to, let's say, a sequence that clears to the end of the line), and it does so before switching back from yellow to the default color.

You could file a bug request against apt to change to a more "highlighting-friendly" approach, although I assume it would be handled with extremely low priority. Let alone, other terminal emulators might implement different highlighting experience.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .