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).
621
questions
1530
votes
10
answers
472k
views
What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?
I think these terms almost refer to the same thing, when used loosely:
terminal
shell
tty
console
What exactly does each of these terms refer to?
187
votes
9
answers
147k
views
How can I disown a running process and associate it to a new screen shell?
I have a running program on a SSH shell. I want to pause it and be able to unpause its execution when I come back.
One way I thought of doing that was to transfer its ownership to a screen shell, ...
239
votes
10
answers
148k
views
Terminal prompt not wrapping correctly
I have an issue where if I type in very long commands in bash the terminal will not render what I'm typing correctly. I'd expect that if I had a command like the following:
username@someserver ~/...
93
votes
15
answers
72k
views
Removing control chars (including console codes / colours) from script output
I can use the "script" command to record an interactive session at the command line. However, this includes all control characters and colour codes. I can remove control characters (like backspace) ...
444
votes
11
answers
629k
views
How can I run a command which will survive terminal close?
Sometimes I want to start a process and forget about it. If I start it from the command line, like this:
redshift
I can't close the terminal, or it will kill the process. Can I run a command in such ...
252
votes
9
answers
307k
views
What causes this green background in ls output?
There are two directories shown by 'ls'. Normally directories anywhere are blue on black background. But the first one is blue on green and impossible to read. Why is this? How to make it blue on ...
86
votes
4
answers
24k
views
What are the responsibilities of each Pseudo-Terminal (PTY) component (software, master side, slave side)?
I am trying to figure out how a tty works1 (the workflow and responsibilities of each element). I have read several interesting articles about it, but there are still some blurry areas.
This is what I ...
77
votes
2
answers
65k
views
Output from ls has newlines but displays on a single line. Why?
I think I may be overlooking a relatively fundamental point regarding shell. Output from the ls command by default separates output with newlines, but the shell displays the output on a single line.
...
925
votes
3
answers
535k
views
How to unfreeze after accidentally pressing Ctrl-S in a terminal?
It's a situation that has happened quite often to me: after I press (with a different intention) Ctrl-S in a terminal, the interaction (input or output) with it is frozen. It's probably a kind of "...
103
votes
3
answers
129k
views
What is stored in /dev/pts files and can we open them?
According to my knowledge, /dev/pts files are created for ssh or telnet sessions.
83
votes
6
answers
19k
views
Can I configure my shell to print STDERR and STDOUT in different colors?
I want to set my terminal up so stderr is printed in a different color than stdout; maybe red. This would make it easier to tell the two apart.
Is there a way to configure this in .bashrc? If not, is ...
5
votes
2
answers
7k
views
Why `clear` do not clear whole screen?
When I use clear command to clear the screen. It is not cleared (see screenshot when I scroll up a bit after command done)
So I double the command to get right behavior:
$ clear && clear &...
151
votes
5
answers
240k
views
How do I attach a terminal to a detached process?
I have detached a process from my terminal, like this:
$ process &
That terminal is now long closed, but process is still running, and I want to send some commands to that process's stdin. Is ...
15
votes
2
answers
19k
views
Execute command in remote active terminal
Suppose you have a terminal emulator (T1) open with a PID of 6350.
From another terminal, type this command (C1):
echo "ls\n" > /proc/6350/fd/0
This writes ls and the new line in T1 but does not ...
100
votes
4
answers
328k
views
Save all the terminal output to a file
Is there some way of saving all the terminal output to a file with a command?
I'm not talking about redirection command > file.txt
Not the history history > file.txt, I need the full terminal ...
10
votes
2
answers
23k
views
Why (and how) did using cat on binary files mess up the terminal?
If I understand the cat manual correctly:
concatenate files and print on the standard output
cat will take files as argument and print them on standard output.
What I don't get is if I use the ...
170
votes
9
answers
120k
views
Fix terminal after displaying a binary file
I'd tried command cat with an executable file:
cat /bin/ls
Now I can't read any word in this terminal (Linux console). How can I fix it?
60
votes
8
answers
158k
views
How can I hook on to one terminal's output from another terminal?
I need to hook onto output of currently running terminal (tty1) from virtual terminal and capture it (running X server).
21
votes
3
answers
3k
views
How does a program decide whether or not to have coloured output?
When I execute a command from a terminal that prints coloured output (such as ls or gcc), the coloured output is printed. From my understanding, the process is actually outputting ANSI escape codes, ...
10
votes
2
answers
2k
views
Is it the process that has a controlling terminal, or is it the session that has a controlling terminal?
When we say that a process has a controlling terminal, do we mean that the process itself has a controlling terminal, or is it the session that the process belongs to that has a controlling terminal?
...
3
votes
1
answer
1k
views
What type of terminal to support if implementing a terminal emulator? [closed]
I have heard that VT100 is the de facto standard. Does it mean if I can just support VT100 and then my terminal can work for existing commandline applications without big problems? If not, how to make ...
67
votes
3
answers
74k
views
tmux, TERM and 256 colours support
Introduction
My question arises from the necessity of understanding why I have now (after multiple trials) Terminal and tmux supporting 256 colours and tput colors telling me there are only 8 of them....
47
votes
3
answers
79k
views
Where does the TERM environment variable default get set?
When I open a terminal window with the GNOME Terminal emulator in the desktop GUI the shell TERM environment variable defaults to the value xterm.
If I use CTL+ALT+F1 to switch to a console TTY ...
30
votes
7
answers
38k
views
"Friendly" terminal color names in shell scripts?
I'm aware of libraries in languages such as Ruby and Javascript to make colorizing your terminal scripts easier by using color names like "red".
But is there something like this for shell scripts in ...
30
votes
1
answer
8k
views
What protocol/standard is used by terminals?
I was wondering how the "GUI" of a command line application is communicated over a network. Most of the time, it's quite simple (plain text / input) but sometimes it's more complex (aptitude).
Is it ...
2
votes
2
answers
692
views
What is switching environments on the system wide terminal called?
I am currently trying to make an autonomous drone using the Robot Operating System (ROS). To do this, I have installed Raspbian Lite (Jessie) on a Raspberry Pi 3 and am currently using ROS Kinetic on ...
328
votes
10
answers
695k
views
How to split the terminal into more than one "view"?
From vi, if you issue the command :sp, the screen splits into two "views", allowing you to edit more than one file from the same terminal.
Along those same lines, is there a way to have multiple ...
196
votes
4
answers
74k
views
What is the point of Ctrl-S?
Ctrl+S stops all output to the terminal which can be restarted with Ctrl+Q.
But, why does Ctrl+S exist in the first place? What problem was trying to be solved by putting that control sequence in ...
76
votes
6
answers
42k
views
How to check if Bash can print colors
I want to know if there's any way to check if my program can output terminal output using colors or not.
Running commands like less and looking at the output from a program that outputs using colors, ...
62
votes
2
answers
20k
views
Documentation on LESS_TERMCAP_* variables?
I see these pretty colors in manpages viewed with less when setting a bunch of these variables. What do they mean, where is the documentation? Is this interpreted by less or termcap?
screenshot
55
votes
9
answers
52k
views
Unable to stop a bash script with Ctrl+C
I wrote a simple bash script with a loop for printing the date and ping to a remote machine:
#!/bin/bash
while true; do
# *** DATE: Thu Sep 17 10:17:50 CEST 2015 ***
echo -e "\n*** DATE:"...
28
votes
6
answers
38k
views
key bindings table?
Do we have a key bindings table that translates all the various ways of referring to a key press? I'm using zsh, but I presume that if there was such a table it would work for any shell.
The reason I ...
27
votes
4
answers
12k
views
Can I configure bash to execute "clear" before every command typed in the console?
I would like to configure bash to execute clear command every time I type some command in the terminal (before executing my command). How can I do that?
I'm using Debian Linux.
7
votes
1
answer
4k
views
How do I come by this pty and what can I do with it?
It seems that a simple shell redirect from /dev/ptmx gets me a new pseudo-terminal.
$ ls /dev/pts; ls /dev/pts </dev/ptmx
0 1 2 ptmx
0 1 2 3 ptmx
It disappears as soon as the process that ...
113
votes
11
answers
241k
views
How to solve the issue that a Terminal screen is messed up? (usually after a resizing)
Sometimes, a terminal screen is messed up, and when we use man ls to read the manpages, or press the UP arrow to go to previous commands in history, the screen will show characters not as the right ...
83
votes
2
answers
11k
views
Clear / erase a mistyped invisible password on a shell / terminal in Linux
One thing that annoys me using Linux's terminal is when I have to type a invisble password, like when you run ssh. Sometimes I mistype one or more letters and then I have to press backspace key a few ...
64
votes
5
answers
41k
views
Where do I find a list of terminal key codes to remap shortcuts in bash?
For example:
"\e[1;5C"
"\e[Z"
"\e-1\C-i"
I only know bits and pieces, like \e stands for escape and C- for Ctrl, but what are these numbers (1) and letters (Z)? What are the ;, [ and - signs for?
...
43
votes
3
answers
4k
views
How do some tools (e.g. nano , less) manage to leave no content in terminals after exit? [duplicate]
Whenever I use a pager like less or an editor like nano in the shell (my shell is GNU bash), I see a behaviour I cannot explain completely and which differs to the behaviour I can observe with other ...
32
votes
2
answers
23k
views
What’s the difference between a “raw” and a “cooked” device driver?
Does this concept only apply to terminal drivers (which is what most sites cover) or to any driver in general?
25
votes
2
answers
33k
views
Ctrl+D for ending terminal line input
If I do
$ cat > file.txt
textCtrl-DCtrl-D
Question 1: If I don't press enter, why do I have to press Ctrl-D twice?
If I do
$ cat > file.txt
pa bam pshhhCtrl-Z
[2]+ Stopped ...
20
votes
1
answer
2k
views
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 ...
13
votes
1
answer
4k
views
How to configure screen-restore in a terminal?
Depending on the terminal/environment following sequence has different effects:
$ ls
1
2
$ man ls
enter q
Either I see last displayed man-page screen above the current prompt or the ls output and ...
570
votes
7
answers
495k
views
Scroll inside Screen, or Pause Output
I use screen for my command-line tasks while managing the servers where I work. I usually run small commands (mostly file-system tasks) but sometimes I run more extensive tasks (like DBA).
The output ...
256
votes
7
answers
712k
views
List all connected SSH sessions?
I just SSH'd into root, and then SSH'd again into root on the same machine. So I have two windows open both SSH'd into root on my remote machine.
From the shell, how can I see a list of these two ...
160
votes
5
answers
585k
views
How to find application's path from command line?
For example, I have git installed on my system.
But I don't remember where I installed it, so which command is fit to find this out?
159
votes
21
answers
164k
views
How can I set my default shell to start up tmux
I would like my default bash shell to go straight into tmux instead of my always having to type tmux every time.
101
votes
3
answers
155k
views
How to signal the end of stdin input
In Bash, I learned that the ending signal can be changed by here document. But by default how can I signal the end of stdin input?
I happened to find that with cat and chardet, their stdin inputs can ...
60
votes
7
answers
43k
views
Why do Vim colors look different inside and outside of tmux?
Environment:
Fedora 25 (4.9.12-200.fc25.x86_64)
GNOME Terminal 3.22.1 Using VTE version 0.46.1 +GNUTLS
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 22 2017 16:26:11)
tmux 2.2
I recently started ...
40
votes
1
answer
4k
views
What happens when Ctrl + Alt + F<Num> is pressed?
I am looking for an explanation of what happens in Linux when this key combination is pressed to change the current terminal. In particular, what software component intercepts this key combination and ...
37
votes
7
answers
44k
views
How can I close a terminal without killing its children (without running `screen` first)?
sometimes I run an app in the gnome-terminal, but then I suddenly have to restart gnome or something. I guess the answer to the question is also useful then I want to disconnect from SSH where ...