linux

Force update known hosts

for H in __h1__ __h2__
do
  ssh -o 'StrictHostKeyChecking=no' $H uptime
done
aliases.sh
# alias ls='ls --color=auto'
# alias grep='grep --color=auto'
# alias fgrep='fgrep --color=auto'
# alias egrep='egrep --color=auto'

alias diff='diff --color=auto'

# alias ll='ls -lA'

alias gre='egrep -I'
alias grp='grep -IP'

alias nohup-run-za='nohup ./run-za.sh >run-za.log 2>&1 </dev/null &'
alias nohup-run-rlr='nohup ./run-rlr.sh >/dev/null 2>&1 &'

extend volume

pvcreate /dev/sda5
vgextend VARLIBVG /dev/sda5
lvextend -l +100%FREE /dev/VARLIBVG/varlib
xfs_growfs /dev/VARLIBVG/varlib

transfer – ssh

For mc:

D=%D; rsync -nvirc -e ssh --delete --exclude '.*' --exclude '__*' ./ ${${D#??????}/\//:/}/
# better:
rsync -nvirc $(sed -E 's/.sh:..(\w+)/\1:/' <<<%D)/ ./
for D in *
do
    tar czf - --no-xattrs --no-mac-metadata "$D" | ssh quux 'tar zxf - -C /tmp'
done

also/more nice: https://www.cyberciti.biz/faq/howto-use-tar-command-through-network-over-ssh-session/

some tuning

org.gnome.settings-daemon.plugins.power critical-battery-action 'shutdown'
sudo grub-mkfont --output=/boot/grub/fonts/DejaVuSansMono36.pf2 \
    --size=36 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf

/etc/default/grub
GRUB_FONT=/boot/grub/fonts/DejaVuSansMono36.pf2

sudo update-grub

therm.sh
#!/usr/bin/env bash

while true
do
  echo -n "$(date '+%H:%M')"
  for D in /sys/devices/virtual/thermal/thermal_zone*
  do
    echo -ne "  $(expr $(<$D/temp) / 1000) $(sed 's/-thermal//' $D/type)"
  done
  echo ''
  sleep 17
done

Docker image over ssh (+checksums)

# for T in $(docker images | ...)
docker save $T | gzip -c | tee >(sha256sum >&2) | ssh h27 'tee >(sha256sum >&2) >(docker load) >/dev/null'
# for T in *.txz
cat "$T" | tee >(sha256sum >&2) | ssh h27 'tee >(sha256sum >&2) >(docker load) >/dev/null'
find . -type d -execdir sh -c 'chmod 644 "{}"/*; chmod +X "{}"/*' \;
find . -type f -name '.DS_Store' -delete
(
XZ_OPT=-veT0 tar cJf v/tmp/d1-deed.txz d1/deed/
XZ_OPT=-veT0 tar cJf v/tmp/prj.txz -C prj/ .
)
.vimrc
source $VIMRUNTIME/defaults.vim
set mouse-=a
colorscheme torte

mc hotkeys

openssl

openssl x509 -in chain.pem -text | less

Check a Certificate Signing Request (CSR)

openssl req -text -noout -verify -in CSR.csr

Check a private key

openssl rsa -in privateKey.key -check

Check a certificate

openssl x509 -in certificate.crt -text -noout

Linux CA-certs

deb-flavour, also Alpine: man update-ca-certificates

  1. *.crt -> /usr/local/share/ca-certificates (*.crt - mind the extension!)
  2. sudo update-ca-certificates

rpm-flavour: man update-ca-trust for more on all those paths

  1. *.crt -> /etc/pki/ca-trust/source/anchors/
  2. update-ca-trust extract
## update-ca-trust @ Oracle Linux
install -t /etc/pki/ca-trust/source/anchors/ ... # PEM or DER format; System override, high priority
install -t /usr/share/pki/ca-trust-source/anchors/ ... # PEM or DER format; For package developers, low priority
update-ca-trust extract

rpm oel redhat centos upd/maint

yum group list
yum check-update
yum update-minimal
lsb_release -sd
lsb_release --all

Check whether reboot is neeed after installing updates

stat /var/run/reboot-required
cat /var/run/reboot-required

# CentOS/RHEL-specific check
needs-restarting -r # See also: `man needs-restarting`