aboutsummaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/weblog/2021-03-27_fix-broken-terminal-ssh/index.md53
1 files changed, 53 insertions, 0 deletions
diff --git a/content/weblog/2021-03-27_fix-broken-terminal-ssh/index.md b/content/weblog/2021-03-27_fix-broken-terminal-ssh/index.md
new file mode 100644
index 0000000..41156b5
--- /dev/null
+++ b/content/weblog/2021-03-27_fix-broken-terminal-ssh/index.md
@@ -0,0 +1,53 @@
++++
+title = "Fixing terminal and remote machine misunderstandings"
+date = 2021-03-27T16:10:01Z
++++
+
+If you are like me and use a not-so standard terminal emulator and find yourself
+frequently ssh'ing into new machines, or maybe you've changed your terminal
+emulator, then this article might help you get your terminal fully functional
+over ssh.
+
+<!-- more -->
+
+Upon logging in you might notice that several shell features might not work as
+expected; clear does nothing, pressing backspace doesn't erase the text on
+screen, etc. Or trying to use a program like tmux you might come across a
+message like `open terminal failed: missing or unsuitable terminal: <your
+terminal>`. This means that the system you've just logged into doesn't know how
+to interact with your terminal emulator.
+
+This happens to me on a somewhat regular basis but not frequent enough to
+remember how to solve it, and for some reason it is not easy to find the nice
+answer I was looking for on the Internet, and so, I decided to write this to
+help me remember how to properly solve this problem.
+
+## Solution
+
+The way I solve this is to first generate the terminfo description file on my
+local computer. Let's say I am using Alacritty:
+
+```
+$ infocmp alacritty > alacritty.terminfo
+```
+
+Then copy that file to the remote machine, for example, using rsync:
+
+```
+$ rsync alacritty.terminfo remote:
+```
+
+Finally on the remote machine import the terminfo file. If you have root access,
+you can import using root/sudo so that it is available to all users, otherwise
+it will only be available for the user you're currently logged-in as.
+
+```
+# tic -x alacritty.terminfo
+```
+
+There are several other solutions (and some hacks) like copying the terminfo
+directly from your `/lib/terminfo/…` directory to the remote machine's. I,
+however, find the solution presented above to be cleaner and handier, since I
+usually keep the terminfo file I generated with `infocmp` in case I need to
+import it into any other machines, unless I change my terminal, in which case I
+regenerate it first.