Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
1
votes
1
answers
2442
views
How to get a serial terminal emulator in linux to ignore RTS & DTR?
I purchased a generic 8-pin ESP8266 off Amazon. It came loaded with some "AT" command firmware that acted like a modem. I connected the module to an FTDI1232 which is a USB connected UART that acts like a serial port. Here is the USB ID: Bus 002 Device 010: ID 0403:6001 Future Technology Devices Int...
I purchased a generic 8-pin ESP8266 off Amazon. It came loaded with some "AT" command firmware that acted like a modem. I connected the module to an FTDI1232 which is a USB connected UART that acts like a serial port.
Here is the USB ID:
Bus 002 Device 010: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
It appears as
This is basically the circuit I already had, but I **had to add the RTS & DTR lines** to complete this.
I created a very simple sketch like this
void setup(){
Serial.begin(115200); // 8 bit char, no parity, 1 stop bit
while(!Serial){};
}
void loop(){
int v = Serial.read();
if(-1 != v){
Serial.write((uint8_t)v);
}else{
delay(10)
}
}
This is a basic "echo" type sketch that should write back whatever is written to the device.
After uploading the sketch I can use the Tools -> Serial Monitor to interact with the sketch. I created a couple more, including one that transformed the data sent and then echo'd it back. They all work.
At this point CuteCom, didn't work at all. After much searching for the reason, I eventually looked at the implementation of the Serial Monitor in the java code. What I found is this line
!BaseNoGui.getBoardPreferences().getBoolean("serial.disableRTS"),
!BaseNoGui.getBoardPreferences().getBoolean("serial.disableDTR"));
From: https://github.com/arduino/Arduino/blob/ee1967cd530ceb9a1d638875e385157e90d532e8/arduino-core/src/processing/app/Serial.java#L68
It appears that basically each "board" (the nomenclature for the code that lets the SDK talk to the ESP8266 here) defines whether or not RTS & DTR should be enabled. The code then calls the jccs library to enable or disable RTS & CTS.
At this point I disconnected the lines from my ESP8266 that were connected to RTS & CTS. I was able to use CuteCom again to talk to my new sketch I had uploaded. However, I don't want to have to disconnect & reconnect my lines each time I program from the Arduino IDE.
Obviously it's possible to talk to the device without disconnecting them as the "Serial Monitor" in the Arduino IDE works just fine.
How can I get a serial terminal emulator in Ubuntu 14.04 that will let me ignore RTS & DTR? I'd also accept commands to put the port in this mode so it can be used with
/dev/ttyUSB0
in my system. I installed CuteCom on my Ubuntu 14.04 machine, selected a speed of 115200, no parity, 8 bit characters and 1 stop bit. I was able to communicate normally to send and receive data using CuteCom.
However, I don't really have much usage for this default firmware. I downloaded the latest version of Arduino IDE and then added in ESP8266 support via an additional core package.
To program this device, I connected the ESP8266 based off this diagram.

socat
or similar.
It's probably irrelevant, but here is a photo of the actual devices

Eric Urban
(163 rep)
Aug 27, 2018, 01:54 AM
• Last activity: Jul 2, 2025, 05:05 AM
54
votes
2
answers
33151
views
Print true color (24-bit) test pattern
How can I test that my terminal / tmux is correctly setup to display truecolor / 24-bit color / 16.8 million colours?
How can I test that my terminal / tmux is correctly setup to display truecolor / 24-bit color / 16.8 million colours?
Tom Hale
(32892 rep)
Nov 14, 2017, 07:51 AM
• Last activity: Jun 23, 2025, 03:23 PM
2
votes
1
answers
201
views
TTY line discipline echoing feature
I'm confused from the actual meaning of the echoing feature implemented in Linux `TTY` driver. As far as I know, a pseudo-terminal pair (`PTY` pair) consists of a `PTY` master, a `PTY` slave and a line discipline all implemented in kernel code (i.e. kernel code running in kernel space). From my unde...
I'm confused from the actual meaning of the echoing feature implemented in Linux
TTY
driver.
As far as I know, a pseudo-terminal pair (PTY
pair) consists of a PTY
master, a PTY
slave and a line discipline all implemented in kernel code (i.e. kernel code running in kernel space).
From my understanding, echoing is the feature of sending back what is written on the master side ptm
so that the process opening such a fd
(by opening the PTY
multiplexer /dev/ptmx
device file) receives back what it has written to.
My questions:
- is this echo feature implemented within the line discipline kernel code ?
- does this echo feature apply only to the PTY
master side, i.e. it doesn't
send back what is written to the PTY
slave side /dev/pts/x
?
Thanks.
CarloC
(385 rep)
Jun 21, 2025, 09:36 AM
• Last activity: Jun 23, 2025, 10:54 AM
2
votes
1
answers
3814
views
What can I do to fix occasional lagging of terminal emulator?
My terminal emulators are lagging occasionally. It's not heavy a lag. May be once in 20-30 mins( I think). The terminal becomes unresponsive and all the characters I typed during lag appears suddenly. It's not happening in any other app (even in SMPLAYER during 1080p video playback). The lag occurs...
My terminal emulators are lagging occasionally. It's not heavy a lag. May be once in 20-30 mins( I think). The terminal becomes unresponsive and all the characters I typed during lag appears suddenly. It's not happening in any other app (even in SMPLAYER during 1080p video playback). The lag occurs even during low memory usage(nearly 1 GB free). I thought there might be a problem in
xterm
and switched to xfce4-terminal
emulator. problem still persisted. Then thought there might be a bug in bash
and switched to zsh
. still no luck. What's happening ? How can I narrow the down problem?
system info : Arch + i3 + compton
Update1: I thought my history size(1000) might be causing the problem and changed it to 100. And this doesn't seem to work either.
Update2: My ~/.bashrc
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='\[\033[32m\]\u\[\033[33m\]@\[\033[36m\]\h \[\033[31m\]\W\[\033[33m\]\$\[\033[00m\]'
## my settings
alias vi='vim'
alias vi_i3='vim ~/.config/i3/config'
alias pacs='sudo pacman -S'
alias pacss='pacman -Ss'
alias pacsyu='sudo pacman -Syu'
export TERMINAL='xfce4-terminal'
HISTSIZE=100
Update3: But in zsh I used very simple Prompt string without any color. Still it was lagging.
Abinash Dash
(631 rep)
May 1, 2019, 05:47 PM
• Last activity: May 19, 2025, 12:03 AM
1
votes
1
answers
15042
views
Arch, Gnome - how to change the default terminal?
I want to change my default terminal emulator, that is, the terminal that opens when I `Right Click` -> `Open in terminal` So far, I've tried: - `sudo update-alternatives --config x-terminal-emulator` - `sudo update-alternatives --config $TERM` (`$TERM` is equal to xterm-256color) - changing the `TE...
I want to change my default terminal emulator, that is, the terminal that opens when I
Right Click
-> Open in terminal
So far, I've tried:
- sudo update-alternatives --config x-terminal-emulator
- sudo update-alternatives --config $TERM
($TERM
is equal to xterm-256color)
- changing the TERM
variable in ~/.bashrc
- chaning the default terminal in GNOME settings - however, there was no option to choose a default terminal emulator, only for the default browser, media player, etc
aurelia
(139 rep)
Jun 24, 2022, 10:30 PM
• Last activity: May 18, 2025, 10:02 AM
0
votes
3
answers
85
views
How can I make a double-click act as the Enter key in Linux terminal and browser URL bars?
I want to use a double-click (or a specific mouse button for double-click) to act like the Enter key in both the Linux terminal (e.g., KDE Terminal) and browser URL bars (Firefox/Chrome) or anywhere else.
I want to use a double-click (or a specific mouse button for double-click) to act like the Enter key in both the Linux terminal (e.g., KDE Terminal) and browser URL bars (Firefox/Chrome) or anywhere else.
F4r5h4d
(101 rep)
Apr 27, 2025, 02:48 PM
• Last activity: Apr 29, 2025, 03:18 PM
0
votes
1
answers
47
views
What does Ctrl+L do "under the hood", if not invoke clear?
I've noticed that using Ctrl+L to clear my terminal has some differences from using the clear command (from ncurses 6.5.20240427). It seems that the clear command will wipe every character in the terminal, set the cursor at the top left, and then type out the prompt. [![result of the clear command][...
I've noticed that using Ctrl+L to clear my terminal has some differences from using the clear command (from ncurses 6.5.20240427).
It seems that the clear command will wipe every character in the terminal, set the cursor at the top left, and then type out the prompt.
Ctrl+L might seem to do the same, but the upper 2 lines of my prompt (and the blank line above it) don't show.
Interestingly, if I had something typed after the prompt, it retains that - and not just the line that the prompt was on, but everything after the prompt.
I looked into



man clear
and found no options to replicate this behaviour, so what exactly is Ctrl+L doing under the hood? Is it invoking a program, or is it a behaviour built into most terminal emulators with implementation down to the specific terminal?
Josh Brunton
(146 rep)
Apr 4, 2025, 02:29 PM
• Last activity: Apr 4, 2025, 02:44 PM
0
votes
1
answers
35
views
bind -x with unicode codepoints
I instructed my terminal emulator to send "\u{85}" (C1 control character `"NEXT LINE" (NEL)`) down the pipe to be caught by bash: bind -x '"\u0085":"echo Hello"' But this doesn't trigger anything. So my **first** question is: How do I represent unicode codepoints for `bind -x`? Strange enough, bash...
I instructed my terminal emulator to send "\u{85}" (C1 control character
"NEXT LINE" (NEL)
) down the pipe to be caught by bash:
bind -x '"\u0085":"echo Hello"'
But this doesn't trigger anything. So my **first** question is: How do I represent unicode codepoints for bind -x
? Strange enough, bash picks up the octal representation:
bind -x '"\205":"echo Hello"'
In any case, the above creates weird artifacts in the shell:
Hello
$ �Hello
Hello
$ �
I figured the control character probably has some sideffects. So my **second** question is, which unicode range can I safely repurpose for my own good?
glades
(117 rep)
Mar 29, 2025, 01:59 PM
• Last activity: Mar 29, 2025, 06:39 PM
8
votes
1
answers
4072
views
Urxvt: how to increase the amount of lines I can scroll back?
In other terminal emulators you can usually control the amounts of lines you can scroll back, but it seems it's a fixed amount in Urxvt. I thought the "saveLines" option controlled that but I tried changing it to a higher amount to no avail, the amount of lines displayed doesn't change no matter the...
In other terminal emulators you can usually control the amounts of lines you can scroll back, but it seems it's a fixed amount in Urxvt.
I thought the "saveLines" option controlled that but I tried changing it to a higher amount to no avail, the amount of lines displayed doesn't change no matter the amount.
Is there any way to increase the amount of lines I can scroll back?
Vitor
(81 rep)
Nov 21, 2018, 10:24 PM
• Last activity: Mar 27, 2025, 06:04 AM
-3
votes
1
answers
92
views
Switching to a new default terminal breaks my desktop and panel shortcuts
I am a noobie running a Hyper-V instance of Kali Linux and have switched my default terminal editor to Ghostty. Doing so has broken the desktop and panel shortcuts I have, but only the ones that run from the terminal. Switching the default back fixes the issue, but I would like to keep using Ghostty...
I am a noobie running a Hyper-V instance of Kali Linux and have switched my default terminal editor to Ghostty.
Doing so has broken the desktop and panel shortcuts I have, but only the ones that run from the terminal.
Switching the default back fixes the issue, but I would like to keep using Ghostty as my default. I haven't tried anything described in this post, however This issue was described here and was only "fixed" by switching back.
The only shortcut I really use is Neovim so I will use that as the example here:
The following is a screenshot for the settings of the launcher
When I run this launcher, a blank Ghostty terminal opens and I receive a popup titled Configuration Errors:

One or more configuration errors were found while loading the configuration. Please
review the errors below and reload the configuration or ignore the erroneous lines.
nvim: invalid field
My current theory is that when I use the launcher, the command nvim
is run in the terminal, as this replicates the behavior. Why this is happening, I have no idea. It could have to do with the way Ghostty is run as the default Terminal, perhaps its launcher is broken?
(For reference this is my first week with Linux so go easy on me, but I had trouble installing Ghostty since there isn't an official version for the Testing version of Debian which is what Kali runs on right now. With much difficulty, I was able to do it using Snapd, so perhaps this is why it's all broken)
Please let me know what other information may help, I apologize that I don't know what else may assist.
Any and all help is appreciated, thank you for your time!
AudBid
(7 rep)
Mar 9, 2025, 08:28 PM
• Last activity: Mar 22, 2025, 09:32 PM
64
votes
6
answers
109613
views
How can I set the position that terminal opens at?
I'd like Terminal to open near the bottom of my screen. Is there a way to set the default size and position? I'm using Linux Mint 13, Cinnamon.
I'd like Terminal to open near the bottom of my screen. Is there a way to set the default size and position?
I'm using Linux Mint 13, Cinnamon.
Korgan Rivera
(2563 rep)
Sep 24, 2012, 11:39 AM
• Last activity: Mar 19, 2025, 01:18 PM
21
votes
4
answers
19997
views
The easiest way to clear scrollback buffer of terminal + some deeper explanation?
Why bother? Clearing scrollback buffer is handy in many ways, for example, when I wish to run some command with long output, and want to quickly scroll to start of this output. When scrollback buffer is cleared, I can just scroll to top, and will be done. Some considerations: There is `clear` comman...
Why bother?
Clearing scrollback buffer is handy in many ways, for example, when I wish to run some command with long output, and want to quickly scroll to start of this output. When scrollback buffer is cleared, I can just scroll to top, and will be done.
Some considerations:
There is
clear
command, according to man,
> **clear** clears your screen if this is possible, including its scrollback buffer (if the extended "E3" capability is defined).
In gnome-terminal clear
does *not* clear scrollback buffer. (What is "E3" capability, though?)
There is also reset
, which clears, but it does a little bit more than that, and it is really slow (on my system it takes more than a second, which is significant delay for humans to be noticed).
And there is echo -ne '\ec'
or echo -ne '\033c'
, which does the job. And indeed it is much faster than reset
.
The question is, what is \ec
sequence, how it differs from what clear
and reset
does, and why there is no separate command for it?
There is also readline's C-l
key sequence, which by default bound to clear-screen
command (I mean, readline command, not shell command). What is this command? Which escape sequence it emits? How does it actually work? Does it run shell command? Or what? Again, in gnome-terminal, it seems like it works just by spiting out blank lines until prompt appear in top line of terminal. Not sure about other terminal emulators. This is very cumbersome behavior. It pollutes scrollback with chunks of emptiness, so you must scroll up more, and more. It is like a hack, rather than clean solution.
Another question is, is there a readline command for mentioned \ec
sequence? I want to bound it to C-l
instead because I _always_ want to clear scrollback buffer when I clear the screen.
And another question is how to _just type_ such escape sequence into terminal, to perform desired action? Then do not have to think about binding C-l
to another readline command (if such command exists). I tried typing Esc
, then c
but this does not work.
**UPDATE**
This question answered mostly here: https://unix.stackexchange.com/a/375784/257159 . It is very good answer which explains almost all questions asked here.
Anthony
(687 rep)
Dec 13, 2017, 05:52 PM
• Last activity: Feb 28, 2025, 06:38 PM
3
votes
3
answers
2122
views
Wrong colors in xterm
I don't quite understand XTerm's (UXTerm's in this case) behaviour regarding colors. I'm using Solarized Light color theme for Alacritty and UXTerm. They're more or less identical: `~/.alacritty.yml`: ``` # Colors (Solarized Light) colors: # Default colors primary: background: '0xfdf6e3' foreground:...
I don't quite understand XTerm's (UXTerm's in this case) behaviour regarding colors. I'm using Solarized Light color theme for Alacritty and UXTerm. They're more or less identical:
UXTerm:
Though all is fine in emacs:
Alacritty:
UXTerm:
Both pass this test I've found:
UXTerm:
The prompt:
EDIT2: Forgot to mention one (probably relevant) detail: if I get rid of the color scheme whatsoever, UXTerm starts to show colors at least _resembling_ Alacritty's:
So the direction is kinda correct. But it's plain unusable to me in this state.
~/.alacritty.yml
:
# Colors (Solarized Light)
colors:
# Default colors
primary:
background: '0xfdf6e3'
foreground: '0x586e75'
# Normal colors
normal:
black: '0x073642'
red: '0xdc322f'
green: '0x859900'
yellow: '0xb58900'
blue: '0x268bd2'
magenta: '0xd33682'
cyan: '0x2aa198'
white: '0xeee8d5'
# Bright colors
bright:
black: '0x002b36'
red: '0xcb4b16'
green: '0x586e75'
yellow: '0x657b83'
blue: '0x839496'
magenta: '0x6c71c4'
cyan: '0x93a1a1'
white: '0xfdf6e3'
~/.Xresources
:
#define S_base03 #002b36
#define S_base02 #073642
#define S_base01 #586e75
#define S_base00 #657b83
#define S_base0 #839496
#define S_base1 #93a1a1
#define S_base2 #eee8d5
#define S_base3 #fdf6e3
#define S_yellow #b58900
#define S_orange #cb4b16
#define S_red #dc322f
#define S_magenta #d33682
#define S_violet #6c71c4
#define S_blue #268bd2
#define S_cyan #2aa198
#define S_green #859900
!fonts&stuff
UXTerm*faceSize: 11
uxterm*eightBitInput: false
UXTerm*faceName: Fira Mono Regular
!Background & foreground
UXTerm*background: S_base3
UXTerm*foreground: S_base00
UXTerm*fading: 40
UXTerm*fadeColor: S_base3
UXTerm*cursorColor: S_base01
UXTerm*pointerColorBackground: S_base1
UXTerm*pointerColorForeground: S_base01
!UXTerm*borderColor: #343434
!Turning off scrollbar
UXTerm*scrollBar: off
!Starting up with a geometry
UXTerm*vt100*geometry: 160x50
!Colors
!-------------------------
!black
UXTerm*color0: S_base02
UXTerm*color8: S_base03
!red
UXTerm*color1: S_red
UXTerm*color9: S_orange
!green
UXTerm*color2: S_green
UXTerm*color10: S_base01
!yellow
UXTerm*color3: S_yellow
UXTerm*color11: S_base00
!blue
UXTerm*color4: S_blue
UXTerm*color12: S_base0
!magenta
UXTerm*color5: S_magenta
UXTerm*color13: S_violet
!cyan
UXTerm*color6: S_cyan
UXTerm*color14: S_base1
!white
UXTerm*color7: S_base2
UXTerm*color15: S_base3
Alacritty session:
trueneu@pop-os:~$ env | grep TERM
COLORTERM=truecolor
TERM=xterm-256color
UXTerm session:
trueneu@pop-os:~$ env | grep TERM
COLORTERM=truecolor
XTERM_VERSION=XTerm(353)
XTERM_SHELL=/bin/bash
XTERM_LOCALE=en_US.UTF-8
TERM=xterm-256color
But they show completely different behaviours color-wise:
Alacritty:




#!/usr/bin/env bash
awk 'BEGIN{
s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
for (colnum = 0; colnum255) g = 510-g;
printf "\033[48;2;%d;%d;%dm", r,g,b;
printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
printf "%s\033[0m", substr(s,colnum+1,1);
}
printf "\n";
}'
Alacritty:


PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
Same with ls
colors.
UXTerm's infocmp
, if it helps:
Reconstructed via infocmp from file: /lib/terminfo/x/xterm-256color
xterm-256color|xterm with 256 colors,
am, bce, ccc, km, mc5i, mir, msgr, npc, xenl,
colors#0x100, cols#80, it#8, lines#24, pairs#0x10000,
acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=\r,
csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m,
dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K,
el1=\E[1K, flash=\E[?5h$\E[?5l, home=\E[H,
hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@,
il=\E[%p1%dL, il1=\E[L, ind=\n, indn=\E[%p1%dS,
initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\,
invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~,
kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D,
kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=^?,
kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q,
kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~,
kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~,
kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S,
kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~,
kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~,
kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q,
kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~,
kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~,
kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~,
kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q,
kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~,
kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~,
kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~,
kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
memu=\Em, oc=\E]104\007, op=\E[39;49m, rc=\E8, rev=\E[7m,
ri=\EM, rin=\E[%p1%dT, ritm=\E[23m, rmacs=\E(B,
rmam=\E[?7l, rmcup=\E[?1049l\E[23;0;0t, rmir=\E[4l,
rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m,
rs1=\Ec\E]104\007, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,
setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
sgr0=\E(B\E[m, sitm=\E[3m, smacs=\E(0, smam=\E[?7h,
smcup=\E[?1049h\E[22;0;0t, smir=\E[4h, smkx=\E[?1h\E=,
smm=\E[?1034h, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?%[;0123456789]c,
u9=\E[c, vpa=\E[%i%p1%dd,
Am I missing some configuration here? Is this how XTerm works? I don't really understand how's it capable of passing that test though.
EDIT:
After Thomas Dickey's answer, I've indeed tried to redefine .Xresources to be without C preprocessor #define
s. Here's the result:
!fonts&stuff
UXTerm*faceSize: 11
uxterm*eightBitInput: false
UXTerm*faceName: Fira Mono Regular
!Background & foreground
UXTerm*background: #fdf6e3
UXTerm*foreground: #657b83
UXTerm*fading: 40
UXTerm*fadeColor: #fdf6e3
UXTerm*cursorColor: #586e75
UXTerm*pointerColorBackground: #93a1a1
UXTerm*pointerColorForeground: #586e75
!UXTerm*borderColor: #343434
!Turning off scrollbar
UXTerm*scrollBar: off
!Starting up with a geometry
UXTerm*vt100*geometry: 160x50
!Colors
!-------------------------
!black
UXTerm*color0: #073642
UXTerm*color8: #002b36
!red
UXTerm*color1: #dc322f
UXTerm*color9: #cb4b16
!green
UXTerm*color2: #859900
UXTerm*color10: #586e75
!yellow
UXTerm*color3: #b58900
UXTerm*color11: #657b83
!blue
UXTerm*color4: #268bd2
UXTerm*color12: #839496
!magenta
UXTerm*color5: #d33682
UXTerm*color13: #6c71c4
!cyan
UXTerm*color6: #2aa198
UXTerm*color14: #93a1a1
!white
UXTerm*color7: #eee8d5
UXTerm*color15: #fdf6e3
Loaded the settings without -merge
just to be sure:
xrdb ~/.Xresources
And launched UXTerm:


Pavel Gurkov
(165 rep)
Sep 10, 2020, 09:45 PM
• Last activity: Feb 23, 2025, 11:47 PM
2
votes
1
answers
74
views
Detectng missed SIGWINCH in Bash extension, when apparent terminal size has not changed
I maintain an extension for the Bash environment called [Basta](https://www.kylheku.com/cgit/basta/about). Basta provides a scroll-protected status line at the bottom of your ANSI/VT100 terminal. When Basta sets itself up, the effective number of lines, as known by the termios stuff in the kernel an...
I maintain an extension for the Bash environment called [Basta](https://www.kylheku.com/cgit/basta/about) . Basta provides a scroll-protected status line at the bottom of your ANSI/VT100 terminal.
When Basta sets itself up, the effective number of lines, as known by the termios stuff in the kernel and the shell
LINES
variable decreases by 1. Resizing the terminal is handled nicely. Almost. There is trap
for the SIGWINCH
signal to call the update routine, which is also called after every command, prior to returning to the prompt.
However, from time to time I see a situation in which the scrolling region is lost. The prompt is being painted over the bottom line, where the user is editing commands and where command output appears, resulting in a mess.
I have a hypothesis on one how it can occur, which has reliable repro steps.
1. We run a program that waits for input, while Bash is in the background, such as cat
.
2. While this program is running, we resize the window such that we shrink it by one line.
3. Terminate the cat
program.
If the terminal is resized while cat
is running, Bash does not get the SIGWINCH
(because, I think, SIGWINCH
is only sent to the processes in the terminal sessions foreground process group, and Bash is in the Background at that moment). Our trap
does not execute.
Basta's update function also relies on comparing the previous terminal size to the current to detect a size change.
**Here is the problem:** in this situation where a terminal with a scroll-protected status like has shrunk by one line, the **number of lines appears not to have changed**.
E.g. 40 line screen with 39 line scrolling region: LINES=39
. Resize terminal to be 39 lines long. Scrolling region is gone. LINES=39
again. To the software, it looks like the same size, so it concludes that there has not been a resize. The status line is now being painted over top of the bottom row, over top of the user's input, because Basta wants to put it on row 40, which doesn't exist any more, so the cursor clamps to 39.
If Basta knows what a window size change occurred, it will not do the size comparison; in that situation it takes the slow path whereby it queries the terminal itself to determine the size. (It would be undesirable to do that for each update, because sending queries to the terminal is dodgy. If the user is typing rapidly, the terminal response can get mixed up with their keystrokes, and there can be a noticeable delay in getting a response from the terminal over laggy remote connections.)
Is there any clever way to know that the terminal has changed (or at least suspect it with a reasonably low false positive rate), in the absence of having received the WINCH
trap, due to having been in the background, without talking to the terminal?
Kaz
(8867 rep)
Feb 7, 2025, 07:54 PM
• Last activity: Feb 11, 2025, 02:04 AM
3
votes
4
answers
934
views
Emulate a number of columns for a program in the terminal
I have a program that I'd like to run, deluding it to believe that my terminal has less columns than it does, because that enables its native truncation, which I need. I tried `resize` from `xterm` as suggested [on askubuntu](https://askubuntu.com/questions/852105/is-there-a-terminal-command-that-ch...
I have a program that I'd like to run, deluding it to believe that my terminal has less columns than it does, because that enables its native truncation, which I need.
I tried
resize
from xterm
as suggested [on askubuntu](https://askubuntu.com/questions/852105/is-there-a-terminal-command-that-changes-the-terminal-window-dimensions) , however, that only works properly within xterm and can hardly be scripted.
I need something that I can use within a script to get the output of a [taskwarrior](https://taskwarrior.org/) command.
Exporting a different value for COLUMNS
doesn't seem to change anything unfortunately.
xeruf
(631 rep)
Oct 23, 2020, 11:05 AM
• Last activity: Feb 3, 2025, 10:00 PM
93
votes
4
answers
28553
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 works** 1 (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 understand so far: * The emulated terminal makes different system calls to `/dev/ptmx`, the ma...
I am trying to figure out **how a tty works**1 (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 understand so far:
* The emulated terminal makes different system calls to
/dev/ptmx
, the master part of the pseudo terminal.
* The master part of the pseudo terminal allocates a file in /dev/pts/[0-N]
, corresponding to the obsolete serial port, and "attaches" a slave pseudo terminal to it.
* The slave pseudo terminal keeps information such as session ID, foreground job, screen size.
Here are my questions:
1. **Has ptmx** any purpose besides allocating the slave part? Does it provide **some kind of "intelligence"**, or does the emulated terminal
(xterm for instance) have all the intelligence of behaving like a
terminal?
2. **Why does xterm** have to interact with the master part, as it only forwards the stdout and stdin of the slave part? Why can't it
**directly write and read from the pts file**?
3. Is a session ID always attached to one pts file and vice versa?
Could I execute ps
and find **two session IDs for the same
/dev/pts/X**?
4. What other information does the pts
store? Does xterm update all
fields by itself, or does the ptm
add some "intelligence" to it?
----------
1. I base my understanding on the TTY demystified by Linus Åkesson , and the Linux Kernel by Andries Brouwer posts, as on several other questions on these sites
Pierre-Jean
(2279 rep)
Mar 3, 2014, 08:40 PM
• Last activity: Jan 7, 2025, 06:45 AM
0
votes
1
answers
127
views
Where is the tty line discipline exactly "logically" located?
I recently started learning about Operating Systems and the linux kernel. I was interested in terminals, so I started there, however, I quickly ran into a problem. I wrote a slightly longer question, because I wanted you to see exactly where the problem potentially arose in my understanding and know...
I recently started learning about Operating Systems and the linux kernel. I was interested in terminals, so I started there, however, I quickly ran into a problem. I wrote a slightly longer question, because I wanted you to see exactly where the problem potentially arose in my understanding and know exactly what is not clear to me. Thanks in advance :)
I have read the following articles and question/answer:
1. [The TTY demystified](https://www.linusakesson.net/programming/tty/)
2. [A Guide to the Terminal, Console, and Shell](https://thevaluable.dev/guide-terminal-shell-console/)
3. [Answer from *Stéphane Chazelas*](https://unix.stackexchange.com/a/120071/695799)
However, I'm having trouble understanding exactly where the terminal (tty) line discipline is exactly logically located because I found an inconsistency (as I naive understood it) between the 1st article and Stéphane Chazelas' answer.
[The TTY demystified](https://www.linusakesson.net/programming/tty/) first uses the following image:
It says that the TTY driver is represented through
Everything is the same, except that now we have an emulator and a virtual terminal. The only difference is that the UART driver will not be used, but the "console" driver.
The last picture shows the pseudo-terminal situation. In that case we have a master and a slave side. The terminal emulator is "pushed" into user space. Also, we have two files where the emulator interact with the master file (
Everything was working for me (or at least I think it was), and then I came across [an answer from *Stéphane Chazelas*](https://unix.stackexchange.com/a/120071/695799) :
> A lot of the intelligence is in the tty line discipline. The line
> discipline is a software module (residing in the driver, in the
> kernel) pushed on top of a serial/pty device that sits between that
> device and the line/wire (the master side for a pty).
According to images, we have a serial/console/pty "device" represented through driver in kernel (UART driver on first, emulator on second and "master side" on third picture) and then line discipline after (as part of driver, on top of it). However, next component on the pictures is TTY driver (

tty_io.c
, whereas the default Line discipline is represented through n_tty.c
. Processes (like bash) communicate with TTY driver (tty_io.c
). Actually in practice with a file that represents the entire device (UART driver + line discipline + TTY driver). UART driver is some "serial" class of driver that communicate with the physical line (and further terminal) on one side and the line discipline on the other.
Next picture from the [The TTY demystified](https://www.linusakesson.net/programming/tty/) is:

/dev/ptmx
), while processes (shell) interact with the slave file (/dev/pts/..
). In this case the pty driver is used and I would say that logically, as in the previous cases, it's at the place where "PTY master side" is written in the picture.

tty_io.c
), not line/wire as Stéphane Chazelas wrote... Maybe Stéphane thinks on TTY driver when he says "serial/pty device", but that doesn't make sense to me since then we would have, for example, UART (serial) driver line discipline TTY driver/UART (serial) driver
. Additionally, on images, TTY driver doesn't make difference between them, it is just tty_io.c
I am very confused. What am I missing? Where is the tty line discipline exactly "logically" located?
Yakog
(517 rep)
Jan 6, 2025, 11:28 PM
• Last activity: Jan 7, 2025, 02:34 AM
72
votes
10
answers
75995
views
What is making my cursor 'randomly' disappear when using gnome-teminal?
It happens often that my cursor on `gnome-terminal` disappears, forcing me to work on a new tab/window. It seems like a random occurrence. Does anyone else experience this? What about other X terminal emulators? How can I fix this (or maybe it's just a bug)? **update**: A simple work-around is to sw...
It happens often that my cursor on
gnome-terminal
disappears, forcing me to work on a new tab/window. It seems like a random occurrence. Does anyone else experience this? What about other X terminal emulators? How can I fix this (or maybe it's just a bug)?
**update**: A simple work-around is to switch away from the terminal and switch back.
**update 2**: I don't experience this any more, maybe because I'm using GNOME 3 version of the terminal.
tshepang
(67482 rep)
Feb 4, 2011, 10:50 AM
• Last activity: Dec 16, 2024, 07:10 PM
1
votes
1
answers
57
views
How do I distinguish paste and input in terminals?
In the latest versions of terminals (gnome-terminal, mate-terminal, konsole, xfce4-terminal, xterm, etc), programs seem aware of whether some text is from paste or keyboard input. Specifically: * If I paste something into bash, the pasted text would be highlighted, and newlines don't trigger command...
In the latest versions of terminals (gnome-terminal, mate-terminal, konsole, xfce4-terminal, xterm, etc), programs seem aware of whether some text is from paste or keyboard input. Specifically:
* If I paste something into bash, the pasted text would be highlighted, and newlines don't trigger command execution.
* If I paste something into vim, the text would be inserted into the cursor position, even if it wasn't in insert mode.
What is this feature called? How do I imitate this behavior in my own program? Could I temporarily disable this feature in these programs?
Related: https://unix.stackexchange.com/q/230678/95685
user23013
(1153 rep)
Dec 15, 2024, 08:19 AM
• Last activity: Dec 15, 2024, 09:48 AM
0
votes
1
answers
129
views
No command 'foo' found even though 'foo' is installed
I just installed django by typing `pip install django` but I can't use it now by typing `django startproject sitename`. The output is: No command 'django' found, did you mean: some suggestions here When I try to type `pip install django` again, I get: Requirement already satisfied: django in `/data/...
I just installed django by typing
pip install django
but I can't use it now by typing django startproject sitename
. The output is:
No command 'django' found, did you mean:
some suggestions here
When I try to type pip install django
again, I get:
Requirement already satisfied: django in
/data/data/com.termux/files/usr/lib/python3.6/site-packages
**How can I solve this problem?**
----------
echo $HOME
returns /data/data/com.termux/files/home
.
echo $PATH
returns /data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets
Clone
(153 rep)
Sep 15, 2017, 02:29 AM
• Last activity: Nov 21, 2024, 05:23 PM
Showing page 1 of 20 total questions