Questions tagged [terminal]

A terminal is an environment for text input/output. Inside the terminal, one runs command-line and text mode programs (including shells).

A terminal is an environment for text input/output. Inside the terminal, one runs command-line and text mode programs (including shells).

This tag is about terminals in general; for the Mac OS X Terminal application, use .

Don't confuse the terminal, which is the environment for text mode programs, with the , which executes commands. See also if your problem is accomplishing a task on the command line.

Background

In a unix context, a terminal is an environment for text input and output. Historically, a terminal was a physical device, but these days most terminals are provided by terminal emulators.

If your display is in text mode, this is usually known as a “text console”, or sometimes (somewhat confusingly) as a “virtual terminal”.

A “terminal” can be graphical, but in a unix context there will normally be a qualifier, e.g. “X terminal”.

Most interactive programs run inside terminals are of one of two kinds:

  • read-eval-print loops are programs that read a line, then execute it. Unix shells are examples of this.
  • full-screen text mode programs, such as emacs -nw, lynx, nethack, vi, …

Escape sequences

A terminal and the program inside it communicate by exchanging text with embedded escape sequences. When you type a character in a terminal, the program receives that character; if you type a function key, the terminal usually converts it to an escape sequence. In the other direction, if the program outputs a printable character, the terminal displays it; if the program outputs a control character, it performs a function such as moving the cursor, changing the color, etc. Most terminals are compatible with Xterm control sequences.

Further reading

4317 questions
83
votes
12 answers

How to disable line wrap in a terminal?

I need to view large logs files using a bash shell. I was using less to open the files, but since the lines are too lengthy there is some kind of line/word wrapping going on. Since the files are Log4J logs, and there is a pattern in the beginning…
nunaxe
  • 1,003
71
votes
4 answers

What's the difference between various $TERM variables?

I tried vt100, vt102, vt220, and xterm by using top. But I can't find their difference. Is there any other term type? What's their difference?
sam
  • 1,007
  • 1
  • 9
  • 11
51
votes
6 answers

Hash symbols (#) turned into pound symbols (£) after catting a binary

This is how my bash prompt used to look like. Then I did something which was probably not so smart, I did cat /bin/bash. And now my bash prompt looks like this, with a pound symbol (£) instead of a hash symbol (#). It even affects hash symbols…
lhermann
  • 643
38
votes
3 answers

How to change the contents of a line on the terminal as opposed to writing a new one?

So, when wget gets a web page, it shows you a status bar that indicated how much the file(s) is/are downloaded. It looks like this: 25%[=============>______________________________________] 25,000 100.0K/s (underscores are spaces; I just couldn't…
fouric
  • 2,281
33
votes
1 answer

Why does the `reset` command include a delay?

The reset command includes a delay, between clearing the screen and returning. This is even on the latest terminal type xterm-256color. Why? man reset does not mention a delay, only the printing of special strings. (It doesn't mention clearing…
sourcejedi
  • 50,249
32
votes
3 answers

How to fix a terminal after a binary file has been dumped inside it?

After having played with curl, a binary file has been dumped inside my terminal. For example, the horizontal lines: ─ I use to format my prompt are replaced by 'q', and it can be much worse. Why does this happen, and how can you fix it without…
alecail
  • 1,623
25
votes
3 answers

Find out the size of open terminal

Within a desktop environment we can resize terminals (GNOME Terminal for example) for our convenience. How can I know the size of the terminal in terms of pixels or number of columns and rows?
Alex Jones
  • 6,353
19
votes
3 answers

Pushdown Terminal Output

Is there a standard way to reverse the output order of a terminal output, ie: ~/Developer $ command0 -bash: comman0: command not found ~/Developer $ command2 -bash: command2: command not found ~/Developer $ command3 -bash: command3: command…
rudolph9
  • 1,425
18
votes
2 answers

Horizontal Scrolling in Terminal

So there are I believe 2 questions on this already. All of them to do with tail -f and hence people give the tangent answer of "use less". I need it for everything, every command, etc. The problem is I need to run a lot of console windows and even…
srcspider
  • 283
17
votes
1 answer

Display output from command and save to file

If I wanted to save output to a file from a command like make, I would do: make > out.txt However that stops the output from being displayed on the console window, and only saves to a file. Is there a way to display output from a monitoring…
John K
  • 534
14
votes
5 answers

Why would I set TERM to xterm-256color when using Alacritty?

So, I decided to give Alacritty a try, and in their default configuration there is the following comment: #env: # TERM variable # # This value is used to set the `$TERM` environment variable for # each instance of Alacritty. If it is not…
mamonas
  • 181
  • 1
  • 2
  • 7
10
votes
4 answers

How to write the output of live-f1 into a file

I opened terminal and ran live-f1 which displays live feed in terminal (text) that changes every second. Only "Enter" key can be used while this program is running (it exits that program). So you can't type anything else into the console. I would…
Gustav
  • 201
9
votes
1 answer

Unknowingly ran an infinite loop in terminal

I copied the below code from some random source to my terminal and ran: while sleep 1; do tput sc; tput cup 0 $(($(tput cols)-29)); date; tput rc; done & The code is to show a running clock at the top right corner of the terminal. The…
9
votes
1 answer

your screen size is bogus. Expect trouble

I opened terminal windows and I got a message your screen size %d%d is bogus. Expect trouble I closed the terminal and the next time I opened terminal, the message didn't show up. What is this message and why did I receive it?
9
votes
3 answers

How do I opt out of recieving broadcast messages?

I am logged in to a university system and a very annoying n00b thinks he or she is some awesome hacker because she or he can broadcast an object dump to everyone using pipes. I bet they think it is funny because it looks like the matrix. I was just…
jones
  • 737
  • 2
  • 7
  • 7
1
2 3
8 9