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:
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.
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.
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
Follows are command lines that I often use (not necessarily the best approach) while interacting with AWS. Before starting, you will need to install the CLI.
For macOS, use brew install awscli For Linux, use pip install awscli Commands list files from a public S3 bucket. If the bucket is not publicly accessible, you need to sign in and do not need the --no-sign-request flag:
aws --no-sign-request s3 ls s3://<bucket>/<path> Download files from a S3 bucket:
Follows are command lines that I often use (not necessarily the best approach) while interacting with Docker Container. Commands are correct up to Version 18.03.1.
show all containers, including inactive ones:
docker ps -a show images:
docker images run a container from an image in interactive mode:
docker run -d -it --name [nameOfContainer] [imageName:version or imageID] get into a container with a bash shell:
docker exec -it [containerID] /bin/bash show images: