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: [Read More]

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. [Read More]

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. [Read More]

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 many, many valid UTF-8 characters because ASCII is a subset of UTF-8 (reference). [Read More]