Reset Terminal

If you’re using Terminal on OS X, just try ‘Send Reset‘ and ‘Send Hard Reset‘ in File menu.

Fix terminal size

Often occurs after screen.
Sometimes, try Control(ctrl)+L,
sometimes, try

Random characters after cat a binary file, often in SecureCRT

Unix: How to fix UNIX garbage characters in your terminal
QQ20140903-1
Run:

Press: Control(ctrl)+v, Control(ctrl)+o, Enter, Control(ctrl)+d

Newline does not work

Output like:

Run:

More…

These links might be helpful.
http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-4.html
http://www.cyberciti.biz/tips/bash-fix-the-display.html
http://docstore.mik.ua/orelly/unix/upt/ch42_04.htm

Reset Terminal by @sskaje: https://sskaje.me/2015/10/reset-terminal/

IPTables port proxy

Uncomment net.ipv4.ip_forward=1 in sysctl.conf.
Then run:

Add iptables rules.

IPTables port proxy by @sskaje: https://sskaje.me/2015/10/iptables-port-proxy/

Incoming search terms:

Linux 禁用 IPv6

家里配了IPv6的tunnel,所有设备也把IPv6配上了,结果导致dns解析时默认v6的解析结果会被高优先级拿出来用。
Debian更新时,国内镜像就灾难了。

应对这种方案,需要临时禁用IPv6,方案是:

也可以针对特定设备关闭。

这个方案在wifi重连之后还得再来一次。

否则就得彻底禁用IPv6。

改 /etc/sysctl.conf

Linux 禁用 IPv6 by @sskaje: https://sskaje.me/2015/10/linux-disable-ipv6/

Incoming search terms:

OS X Create Casper-RW

1 Install e2fsprogs

MacPorts is required.

2 Create file using dd

Create an 8GB casper-rw file.
If you’re on an FAT32 partition, the largest single file size can be 4GB.

3 Format casper-rw

OS X Create Casper-RW by @sskaje: https://sskaje.me/2015/10/os-create-casper-rw/

Incoming search terms:

SSH KeepAlive

网络不稳定的情况下,可能SSH的连接会中断。一般GUI的客户端,如SecureCRT、XShell、vSSH等,都可以有选项直接定时(例如每5秒)发送心跳包,来保持连接。命令后的OpenSSH客户端也有类似功能,需要开启参数 ServerAliveInterval
Mac 下需要用root编辑 /etc/ssh_config,linux下在 /etc/ssh/ssh_config.
也可以使用 ~/.ssh/config 配置用户级参数。

编辑后的内容形如:

ssh_config 里还有个参数 TCPKeepAlive,默认false,可以改为yes。
参考 http://unix.stackexchange.com/questions/34004/how-does-tcp-keepalive-work-in-ssh/34201#34201 的说明:
TCPKeepAlive是靠发送空的ACK包来保持连接,由可能在特定情况下无效(被防火墙过滤);
ServerAliveInterval 是SSH层的,数据加密状态传输,不会被简单规则过滤。
更多参数说明可以参考 man ssh_config.

上边的配置里我还开启了 ServerAliveCountMax 5,解释是:
10秒钟发送一次心跳,如果连续5次都没有响应,客户端就断开连接。
这个值默认是3。

SSH KeepAlive by @sskaje: https://sskaje.me/2015/10/ssh-keepalive/

Incoming search terms: