Skip to content

Cheat sheet


Generate and validate checksums in Linux, assuming the exe file is named VxlPro.exe:

Terminal window
# generate:
md5sum VxlPro.exe > VxlPro.md5
# validate:
md5sum -c VxlPro.md5

Generate checksums in Windows 10 (to compare with that in VxlPro.md5)

Terminal window
certutil -hashfile VxlPro.exe MD5

Cross-compile C++ apps for Arm Linux ref:

Terminal window
sudo apt install qemu-user qemu-user-static gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu build-essential
podman run --rm --arch aarch64 -it alpine
# ...

Password-less login to a Linux server

Terminal window
# If no ~/.ssh/id_ed25519* file, create one:
ls ~/.ssh/id_ed25519 >/dev/null 2>&1 || ssh-keygen -t ed25519
# copy public key to server
ssh UNAME@HOST 'mkdir ~/.ssh && chmod 700 ~/.ssh'
cat ~/.ssh/id_ed25519.pub | ssh UNAME@HOST 'cat >> .ssh/authorized_keys'

Inspect open ports:

Terminal window
ss -tulpn | grep LISTEN # list open ports and processes using them
lsof -i -P -n | grep LISTEN # list open ports and processes using them
netstat -tulpn # list open ports and processes using them
Terminal window
nmap -sS <target_IP> # scan remote ports

Other commands: traceroute

Request/see pods/bashrc file for frequently used shortcuts!

Terminal window
# search in package repository (Note: not apt-get):
apt search <package>
# More cumbersome approach, as root/sudo:
apt-get install apt-file
apt-file update
apt-file find filename.h/libname # | grep -F .so
  • Edit /etc/default/console-setup and change font size to 16x32, and reboot!

  • Run sudo dpkg-reconfigure keyboard-configuration and follow the interactive visual terminal, leave the first page at its defaults.

  • Edit /etc/netplan/50-cloud-init.yaml and set password, and then run sudo netplan apply

  • If not using cloudinit, use wpa_supplicant… and e.g. dhclient -v wlan0 instead.

  • Get the ip address, ip addr show, and see below for ssh setup

  • To use faster 5GHz wifi:

    Terminal window
    sudo iw reg set US
    sudo systemctl restart netplan-wpa-wlan0.service

Fix the terminals blue colour bug:

Terminal window
printf %b '\e]4;4;#6495ed\a'

For more info request/see Ansible #Raspberry-pi configs!

Terminal window
#apt-get install dh-make build-essential dscripts
cd path/to/source/repo
# create debian folder
dh_make --packagename mypackage_0.0.1-2 --native --single --yes
tree debian | less
# Modify debian/[control,copyright,changelog,rules]
dhci -i # manage the package version
dpkg-buildpackage -b -uc
dpkg -i mypackage_0.0.1-2_all.deb
apt-get remove mypackage_0
  • Extensions for Gnome-3/4: hide-title-bar

  • Fix Linux Nautilus file browser regressions:

Terminal window
# Install meld and integrate:
mkdir -p ~/.local/share/nautilus/scripts/
echo '#!/bin/sh' > ~/.local/share/nautilus/scripts/meld.sh
echo 'meld $@' >> ~/.local/share/nautilus/scripts/meld.sh
chmod +x ~/.local/share/nautilus/scripts/meld.sh
# Restore ability to create text files!:
echo > ~/Templates/NewFile.md

git vs https vs ssh protocols:

Terminal window
git remote add gitea ssh://git@SERVER:PORT/USERNAME/REPO.git
# vs
git clone https://github/aliraeini/porescale.git
# vs
git clone git@github.com:aliraeini/porescale.git

OCR / image to text conversion, put all png images in a folder and run: Warning: renames and rewrites your files

Terminal window
rename 's/\ /_/g' *.png
# add `-channel RGB -negate` if needed:
for cas in `ls *.png`; do convert $cas ${cas%.png}.tif; done
for cas in `ls *.tif`; do tesseract $cas ${cas%.tif}; done