docs.daveops.net

Snippets for yer computer needs

Terminal Emulation

https://en.wikipedia.org/wiki/Terminal_emulator

tmux

Share session

# Create session
tmux -S /tmp/tmsession
chmod 777 /tmp/tmsession
# Connect
tmux -S /tmp/tmsession attach

Keyboard shortcuts

Shortcut Description
C-b ? List keybindings
C-b “ Split screen horizontally
C-b % Split screen vertically
C-b arrow Switch pane
C-b (held) arrow Change size of pane
C-b ; Switch to last active pane
C-b x Kill pane
C-b c New window
C-b n Next window
C-b p Previous window
C-b & Kill window
C-b PgUp/PgDn Scroll mode
C-b . Move window

Adding to tmux buffers from shell

echo "hello" | tmux loadb -
tmux saveb - | sed 's,hello,hi,'

SSH

Generating a new key

# Generate a new RSA keypair
ssh-keygen -t rsa -b 4096 -C "<username> generated <date>" -f id_rsa
# Generate a new ed25519 keypair
ssh-keygen -t ed25519 -C "<username> generated <date>"

Getting key fingerprint

ssh-keygen -lf .ssh/id_rsa.pub

Security notes

General

Client

Server

IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no

# Don't use tunneled cleartext passwords
PubkeyAuthentication yes
PasswordAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no

# Disable root user login
PermitRootLogin no

UsePam yes

# Disable X11 forwarding
X11Forwarding no
# Disable TCP forwarding (unless you *actually* need it)
AllowTcpForwarding no

# Lock down to specific group of users 
AllowGroup ssh_users

HostbasedAuthentication no
PermitUserEnvironment no
StrictModes yes
UsePrivilegeSeparation yes

Troubleshooting

As silly as some of these seem, I’ve seen them all apply at one point or another.

Client-side

Server-side

DEC VTs

https://vt100.net/

Terminal Emulators

Alacritty

XTerm

Comes with X Windows

Command Keys
Paste clipboard shift + insert
Main menu ctrl + left click
Font menu ctrl + right click

Using bash to make TUIs

https://github.com/dylanaraps/writing-a-tui-in-bash

ncurses

Notcurses

A much prettier (albeit less compliant) TUI library

GNU Screen

# Reattach a terminal
screen -r
# Attach to a non-detached session (pair-programming)
screen -x

# Share session
screen -d -m -S (session name)
screen -x (session name)

Keyboard shortcuts

Shortcut Command Description
C-a ” windowlist -b list all windows
C-a C-a other go to previous screen
C-a C-d detach detach from screen back to the terminal
C-a k kill kill window
C-a H log log the current window
C-a C   new window

Scrollback

C-a :
scrollback <lines>
C-a [

Minicom

Attach to a serial console

# ensure that the dev node has correct permissions
minicom -s
# select "Serial port setup"
# save

Telnet

Neat things to connect to