Unix

Notes - ip, iptables, and other unix networking commands

Follows are command lines that I often use (not necessarily the best approach) while interacting with ip, which is used to show / manipulate routing, devices, policy routing and tunnels. Show current routes. ip route show Add route: sudo ip route add `a.b.c.d/e` via `gateway_IP` dev `device_name` a.b.c.d/e can be the subnet of IPs or just an IP address of the desired destination, and the gateway_IP is the IP address of the gateway where you want to route your traffic through (e.

Notes - Useful Bash Commands

Follows are command lines that I often use (not necessarily the best approach) while interacting with Unix shell. Find files (including files in subdirectories) whose size is larger than x k bytes (replace k with M for mega bytes). sudo find . -type f -size +xk Re-run through some tasks periodically (e.g., every 10 minutes = 10 * 60s): while true; do ...; sleep 600; done Get size (disk usage) of a file/directory:

Notes - Add OpenVPN and SSTP VPN Connections to NetworkManager in Ubuntu 18.04 Using CLI

This note originates from an effort to find ways to automate OpenVPN and SSTP VPN connections from an Ubuntu 18.04 machine using CLI. For setting VPN connection from GUI, NetworkManager GNOME has nice third-party packages for most VPN protocols. Only follow this note if you want to setup OpenVPN or SSTP VPN connection from CLI. OpenVPN has a nice CLI tool (i.e. openvpn). However, connecting to an SSTP VPN server using CLI (e.

Notes - Connect to An SSTP VPN Server Using Command Line in Ubuntu

SSTP stands for Secure Socket Tunneling Protocol, developed by Microsoft. It is one of the most powerful and widely used VPN protocols. It has the ability to bypass most firewalls because it uses SSL over port 443, which is also used by the famous protocol – HTTPS. Together with OpenVPN protocol, SSTP is considered one of the “stealth-VPN” protocols. Since it is owned by Microsoft, most Windows operating systems has a built-in SSTP-client.

Notes - Remove Broken Files (broken content, broken file name) in Ubuntu

I once wrote a python program to create text files, which only contain ASCII and UTF-8 Unicode text. Before being written to a file, every non-UTF-8 line of text is decoded to UTF-8 using this line of code: line = line.decode('utf-8', 'ignore').encode("utf-8") I noticed many suggestions on StackOverFlow to use python’s string.printable or bash’s strings command to sanitize the text. However, these functions will remove all non-ASCII characters, which includes