Saturday, April 27, 2024
49
rated 0 times [  49] [ 0]  / answers: 1 / hits: 38158  / 1 Year ago, thu, march 16, 2023, 11:58:47

Help! Somehow my terminal looks like this:



enter image description here



It's nearly impossible to read the text. How can I fix it without exiting the terminal?


More From » command-line

 Answers
7

The likely cause of this problem are ANSI Escape Codes. These allow scripts to change the foreground and background color of the terminal. You can even mimic the colors of the screenshot above by running the following command:



echo -e 'E[32;46m'


To reset the terminal colors, use the following command:



tput init


According to the manpage:



    init  If the terminfo database is present and an entry for the user's
terminal exists (see -Ttype, above), the following will occur:

(1) if present, the terminal's initialization strings will be
output as detailed in the terminfo(5) section on Tabs and
Initialization,

(2) any delays (e.g., newline) specified in the entry will be
set in the tty driver,

(3) tabs expansion will be turned on or off according to the
specification in the entry, and

(4) if tabs are not expanded, standard tabs will be set
(every 8 spaces).

If an entry does not contain the information needed for any of
the four above activities, that activity will silently be
skipped.


This should restore your terminal to its original colors.


[#26188] Friday, March 17, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tonhorn

Total Points: 196
Total Questions: 118
Total Answers: 95

Location: Vanuatu
Member since Fri, May 13, 2022
2 Years ago
tonhorn questions
Tue, May 10, 22, 12:01, 2 Years ago
Sat, Dec 18, 21, 06:23, 2 Years ago
Thu, Jun 16, 22, 04:03, 2 Years ago
Fri, Apr 1, 22, 05:23, 2 Years ago
;