Skip to main content

Command line tips and tricks

Apt / apt-get

Install error Unpacking xroad-signer (7.6.2-1.ubuntu22.04) over (7.5.1-1.ubuntu22.04) ... dpkg:...

Bash tools

Awk First and third column from file, seperated by spacesawk -F " " '{print $1,$3'} result.txt ...

Docker

Read compose logs docker-compose logs -f --tail=100 Volume in dir - ./name:/name # For macOS ...

Git

Push commits to another branch git push origin <branch with new changes>:<branch you are pushing...

IPtables

# src(me) -> dest iptables -A OUTPUT -p tcp --match multiport --dports 80,443 -d 10.11.12.55 -...

macOS / OS X

Mac install sshpass brew tap esolitos/ipa brew install sshpass Vagrant bash completion brew i...

macOS software setup

Install first docker - https://docs.docker.com/docker-for-mac/install/ iterm2 - https://ite...

Mounting

Get info of the disk(s) fdisk -l ls -l /dev/disk/by-uuid/ Manual USB mount mount /dev/sdb1 /m...

Network

Newer Debian resolvectl status service systemd-resolved restart Older Debian systemd-resolve ...

OpenSSL

Get sha256 fingerprint of cert openssl x509 -noout -sha256 -fingerprint -in <file> Utf8 output ...

Pkcs11-tool

Install pkcs11-tool apt install opensc Get hsm info pkcs11-tool --module /opt/...

PKI

PKI Signer- kasutades x hash algot, nt SHA luuakse data põhjal hash- kasutades priv võtit ja x k...

Resolve / DNS

Ubuntu 22 resolvectl status Ubuntu 18 systemd-resolve --status

Skype

List all members & roles in a chat /showmembers Make chat history visible to everyone /set opt...

SQL

PSQL get version psql -h <IP/DNS> -U <user> -d <database> -c 'SELECT VERSION()' PSQL test conne...

ssh, bash, vim configs

SSH # disable host key check Host * StrictHostKeyChecking no ServerAliveInterval 30 ...

Tips & Tricks

Create ssh key ssh-keygen -t ed25519 -C "comment" -f <keys-name> Last commands exit code echo ...

Vagrant

Basic commands vagrant up vagrant provision vagrant destroy vagrant ssh vagrant status Ex...

Windows

Test IP and port connection Test-NetConnection <IP> -port <port>