Skip to main content

Primary links

  • Home
  • AI
  • Kubernetes
  • Incus
  • Ansible
  • Terraform
  • OpenStack
  • Virtualization
  • Linux
  • SmartHome
  • HowTo

Misc

  • Linux
  • Hardware
  • Programming
  • Databases
  • Multimedia
  • Windows

Cloud

  • OpenStack
  • cloud-config
  • nextcloud

Virtualization

  • Virtualization
  • Incus
  • Docker
  • KVM
  • Kubernetes
  • LXC
  • LXD
  • QEMU
  • VMware
  • VirtualBox
  • multipass
  • podman
  • vagrant
  • XEN

Network

  • DNS
  • Firewall
  • Linux
  • OpenvSwitch
  • SSL
  • VLAN
  • VPN
  • iPXE
  • namespaces
  • nmcli
  • tcpdump

Storage

  • CEPH
  • DRBD
  • LVM
  • S3
  • ZFS
  • btrfs

Automation / CI/CD

  • Install
  • Ansible
  • GitLab
  • LLM
  • Preseed
  • Puppet
  • Terraform
  • Ubuntu autoinstall

Monitoring / Visualisation

  • Grafana
  • Icinga
  • Prometheus
  • Monitoring
  • ELK
  • mermaid

find

# find files without read / write permissions for other
find /media/foo /media/bar ! -perm -o+rw -exec ls -l {} \;
find /media/foo /media/bar -ctime -1 -type f ! -perm -go+rw -exec chmod a+rw {} \;
find /media/foo /media/bar -1 -type d ! -perm -go+rwx -exec chmod 777 {} \;

# changed in last 1 minute
find /tmp -cmin -1

# find all empty files
find  /tmp -type f -empty

# find empty directories
find . -type d -empty

# print file content
find ./ -type f | while 
  read f; do printf "\n# file %s\n" "$f"; cat "$f";
done

# find files by date
find /path/to/dir -newermt "yyyy-mm-dd"

# list all files modified on given date
find /path/to/dir -newermt yyyy-mm-dd ! -newermt yyyy-mm-dd -ls

# create directory in all subdirectories
find -mindepth 1 -maxdepth 1 -type d -exec mkdir {}/en_US \;

# count files in a directory
find /path/to/dir -type f | wc -l

# find files from a user
find / -user foo
find /home -maxdepth 1 -type d -group FOO -printf "%f\n"

# find files with SUID bit
find / -perm 4000
find / -perm /u+s
find / -perm -u+s

# find print filename only
find /tmp -printf "%f\n"

# find big files
find /var -type f -size +1G -exec du -sh {} \;

# find file with size between
find . -type f -size +8M -size -10M -ls

find . -type d -size +4096c

# Remove files older then 1 day from /tmp
find /tmp/ -mtime +1 -exec rm -r {} \;

# remove files older then 23h
find /backup -name "$(hostname).${DB}.*.dmp" -mmin +$((23*60)) -delete

# files created in last 5 min
find -cmin -5

# find files modified in last 1 hour
find /path/to/dir -mmin -60 -type f

# replace owner
find -type f -uid 3000000 -exec chown 1000000:1000000 {} \;

# find NOT
find -name "*.json" -not -name '00000*'

# remove softlinks from /media
find /media -maxdepth 1 -type l

# find log errors
find /var/log/ -name "*.log" -ctime -1 | xargs tail -f {} \; | egrep -i "fail|error"

# show all changes under log directory
find /var/log/ -ctime -1 | xargs tail -f {} \;

curl

# authentification
curl www.example.com --user username:password

# DNS haeder
#curl -H 'Host: https://www.example.com/path/to/page1.html' 10.1.2.3
curl -v --resolve www.example.com:443:10.10.10.10 https://www.example.com

# put
curl -X PUT -d arg=val -d arg2=val2 localhost:8080

# view haeder
curl -I https://example.com/foo

# add to curl
curl ${URL} -sL | tar -xzf /dev/stdin

# use proxy
curl -v --proxy http://proxy.example.cmo:8080 http://www.example.com:8888/

# slient / quite
curl -s https://www.example.com

# globbing
https://ec.haxx.se/cmdline/cmdline-globbing
curl -O http://example.com/[0-100:2].png

Upgrade SSH to v7.3 (with include support)

echo "deb http://old-releases.ubuntu.com/ubuntu yakkety main" > /etc/apt/sources.list.d/yakkety.list
apt-get update
apt-get install -y ssh
rm /etc/apt/sources.list.d/yakkety.list
apt-get update
ssh -V
OpenSSH_7.3p1 Ubuntu-1, OpenSSL 1.0.2g  1 Mar 2016
mkdir ~/.ssh/config.d
sed -i '1iInclude config.d/*' ~/.ssh/config

Links
https://superuser.com/questions/247564/is-there-a-way-for-one-ssh-config-file-to-include-another-one

OpenShift

# OpenShift on OpenStack

https://docs.openshift.com/container-platform/3.11/install_config/configuring_openstack.html

apt-get install docker-engine=1.13.1-0~ubuntu-xenial

[embed_url: https://raw.githubusercontent.com/panticz/installit/master/install.openshift.sh]

# create test project

oc cluster up #--public-hostname=openshift.example.com --loglevel=10
oc login -u developer -p developer
oc whoami
oc new-app -L
oc projects
oc new-app openshift/ruby-20-centos7~https://github.com/openshift/ruby-ex
oc get all
oc get pod -w
oc logs -f ruby-ex-1-build
oc get services
oc expose service ruby-ex #--hostname=app1.example.com
oc get route

echo "192.168.178.31 ruby-ex-myproject.192.168.178.31.xip.io" >> /etc/hosts

Manage OpenShift with Ansible
https://github.com/openshift/openshift-ansible
https://www.ansible.com/blog/2013/09/19/deploying-highly-available-openshift-origin-clusters

# Ansible playbook

https://github.com/panticz/ansible/tree/master/roles/ansible

Links
https://www.openshift.org/
https://github.com/openshift/origin/blob/master/docs/cluster_up_down.md#linux
https://github.com/openshift/origin/releases/latest
https://github.com/OpenShiftDemos/openshift-cd-demo

Mount LUKS encrypted disk on command line with cryptsetup

Create
https://ubuntuforums.org/showthread.php?t=837416

sudo cryptsetup luksChangeKey /dev/sda5
sudo cryptsetup luksDump /dev/sda5

Mount LUKS crypted device

sudo apt-get install -y cryptsetup
sudo cryptsetup luksUUID /dev/sdb1

# sudo dmsetup ls --target crypt
DEVICE=/dev/sdb1
LUKS_UUID=$(sudo cryptsetup luksUUID ${DEVICE})

sudo cryptsetup luksOpen ${DEVICE} ${LUKS_UUID}
sudo mount /dev/mapper/${LUKS_UUID} /mnt

Unmount LUKS crypted device

sudo umount /mnt
sudo cryptsetup luksClose ${LUKS_UUID}

change device label

sudo e2label /dev/mapper/luks-fbf84040-3193-4f4b-123456-48af9e123456 backup_disk_1

nmcli - NetworkManager command line tool

# list all connections
nmcli con
nmcli con show --active | grep -i vpn

# show connection details
nmcli con show 'MY_CONNECTION_1'

# start vpn from command line (ubuntu)
nmcli con up id VPN_NAME

nmcli device wifi list

# create wifi configuration
SSID="FRITZ!Box 5960"
PASS=00011090700208423311

nmcli con add con-name "${SSID}" ifname wlan0 type wifi ssid "${SSID}"
nmcli con modify "c}" wifi-sec.key-mgmt wpa-psk
nmcli con modify "${SSID}" wifi-sec.psk "${PASS}"

# set DNS
nmcli con mod wg0 ipv4.dns "8.8.8.8 8.8.4.4."

nmcli con up "${SSID}"

# get connection UUID
nmcli -g connection.uuid connection show 
nmcli -t -f UUID con


# test: bounding
nmcli con add type bond con-name bond1 ifname bond1 mode 802.3ad ipv4 179.254.0.2/16
nmcli con mod id bond1 bond.options mode=802.3ad,miimon=100,lacp_rate=fast,xmit_hash_policy=layer2+3
nmcli con mod id bond1 802-3-ethernet.mtu 9000
nmcli con add type bond-slave ifname p5p1 con-name p5p1 master bond1
nmcli con add type bond-slave ifname p5p1 con-name p5p2 master bond1

# prority
nmcli connection modify "Samsung Galaxy A7" connection.autoconnect-priority 999

# disable autoconnect
nmcli connection modify wg0 autoconnect no

# configure secondaries hack (static DNS required)
nmcli connection modify my-wireguard connection.secondaries my-anyconnect

Autostart delayed VPN connection

# /home/foo/.config/autostart/vpn.desktop 
[Desktop Entry]
Type=Application
Exec=nmcli con up VPN1
Hidden=false
NoDisplay=false
X-GNOME-Autostart-Delay=3
X-GNOME-Autostart-enabled=true
Name=Auto connect to VPN1

NetworkManager event scripts

/etc/NetworkManager/dispatcher.d/

Network manager GUI

ip

Link / Interface

ip -d link show eth0.8
ip link show eno1

ip link set eth0 up
ip link set dev  up
ip link set dev  down

ip link del docker0

# shutdown interface
ip addr del 10.0.0.2/24 dev eth0
ip link set eth0 down

# Configure VLAN
ip link add link eth0 name eth0.100  type vlan id 100

# show VLAN
ip -d link show

# Delete virtual interface
ip link delete qvb333c3ed4-51

Address

ip addr show eth0

ip addr add 192.168.1.33/24 dev eth0
ip addr add 192.168.0.111/24 dev eth0:1

# remove ip
ip addr del 10.22.30.44/16 dev eth0
ip addr flush dev eth0

# output as json
ip -j a | jq
ip -o -4 -j a show eth0 | jq -r .[].addr_info[].local

MTU
https://www.networkworld.com/article/2224654/mtu-size-issues.html

ip ad | grep mtu
ip link set dev eth0 mtu 1400
ip l set mtu 1200 dev wlan0

ifconfig
https://p5r.uk/blog/2010/ifconfig-ip-comparison.html

ifconfig -a
ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
route add default gw 192.168.1.1
echo "nameserver 8.8.8.8" > /etc/resolv.conf

Route

Lakka (Retro game emulation distribution)

# download and create installation usb disc

#URL=http://mirror.lakka.tv/nightly/Generic.x86_64/Lakka-Generic.x86_64-devel-20161221183017-r21729-g274b40f.img.gz

URL=http://le.builds.lakka.tv/Generic.i386/Lakka-Generic.i386-2.2.img.gz
DEV=/dev/sdb
wget ${URL} -q -O - | gunzip | sudo dd of=${DEV}
# fix slow menu

Second Icon > Menu > Menu Shader Pipeline > Off

# gamepad

http://www.lakka.tv/doc/Input-settings/
http://www.lakka.tv/doc/Contributing-your-joypad-config/

# links

http://www.lakka.tv/get/linux/generic/
https://emulator.games/roms/
https://www.loveroms.com/
http://html5gamepad.com/ - HTML5 Gamepad Tester

Rundeck (Job scheduler and Runbook automation)

Installation
https://docs.rundeck.com/docs/administration/install/linux-deb.html#installing-rundeck
Switch to tab Community

sudo apt install -y curl

# OPTIONAL: install Java if not already available
sudo apt-get install -y openjdk-11-jre-headless

curl -L https://packages.rundeck.com/pagerduty/rundeck/gpgkey | sudo apt-key add -

cat < /etc/apt/sources.list.d/rundeck.list
deb https://packages.rundeck.com/pagerduty/rundeck/any/ any main
deb-src https://packages.rundeck.com/pagerduty/rundeck/any/ any main
EOF

sudo apt-get update
sudo apt-get install -y rundeck

#sudo apt install -y sshpass

Configuration

ansible-playbook rundeck-ansible.example.com.yml -i your_inventory

[embed_url: https://raw.githubusercontent.com/panticz/ansible/master/rundeck-ansible.example.com.yml]

Ansible role
https://github.com/panticz/ansible/tree/master/roles/rundeck
https://github.com/panticz/ansible/blob/master/rundeck.example.com.yml

Admin
http://localhost:4440/user/login;jsessionid=16lnsilhg9n6x38a090agwe8y

admin/admin

Configuration
https://docs.rundeck.com/docs/administration/configuration/configuration-file-reference.html

# override rundeck properties
/etc/rundeck/framework.properties
/etc/rundeck/rundeck-config.properties
/etc/rundeck/realm.properties
/etc/rundeck/rundeck-config.properties

# (global)
/etc/rundeck/framework.properties

# job database
/var/lib/rundeck/data/rundeckdb.mv.db

# hosts
/var/rundeck/projects/JOB_NAME/etc/resources.xml

# add user
echo "foo:bar,user,devops" >> /etc/rundeck/realm.properties

# acl
/var/rundeck/projects//acls/.aclpolicy

Docker
https://docs.rundeck.com/docs/administration/configuration/docker.html
https://github.com/rundeck/docker-zoo/blob/master/cloud/docker-compose.yml
https://docs.rundeck.com/docs/administration/install/docker.html#open-source-rundeck

Configuration (project)

Sonoff Basic / ITEAD ESP8266

Flash ESPEasy with a FTDI adapter

pip3 install tasmotizer
chmod 777  /dev/ttyUSB0 
tasmotizer.py
Release 12.5.0
tasmota.bin
Tasmotizue!

Connect to temporary WiFi access point

SSID: ESP_0
pass: configesp

Configure connect to your WiFi access point

http://192.168.4.1/

Commands
# remove serial connector

# on
http://192.168.178.10/tools?cmd=gpio,12,1

# off
http://192.168.178.10/tools?cmd=gpio,12,0

Fix
Hidden rules page
http://192.168.178.10/rules

Debug

screen /dev/ttyUSB0 115200

Integrate to HomeAssistant
https://automation.baldacchino.net/flashing-tasmota-on-a-sonoff-basic-r4-connecting-to-home-assistant/

# configuration.yaml
switch:                         
  - platform: mqtt            
    unique_id: sonoff_poweroutlet
    name : "SonOff"           
    state_topic: "stat/device_name/POWER"
    command_topic: "cmnd/device_name/POWER"
    value_template: "{{ value_json.STATE }}"
    payload_on: "ON"          
    payload_off: "OFF"        
    state_on: "ON"            
    state_off: "OFF"          
    qos: 2

Links
https://rutg3r.com/sonoff-firmware-tutorial-to-esp-easy/
https://wiki.fhem.de/w/index.php?title=Sonoff
https://wiki.fhem.de/wiki/Sonoff#Produkt.C3.BCbersichtsliste_sonoff
https://github.com/espressif/esptool
https://waschto.eu/easyesp
https://www.letscontrolit.com
https://github.com/arendst/Sonoff-MQTT-OTA
https://forum.fhem.de/index.php/topic,55036.90.html
http://captain-slow.dk/2016/05/22/replacing-the-itead-sonoff-firmware/
https://github.com/tasmota/tasmotizer

Pagination

  • Previous page
  • 6
  • Next page
linux
Profiles GitHub StackOverflow LinkedIn Xing
Contact Imprint
© panticz 2026

Cookie-Einstellungen

Diese Website nutzt eingebettete Inhalte von Drittanbietern (z.B. YouTube, SoundCloud). Beim Laden dieser Inhalte werden Daten an die jeweiligen Anbieter übermittelt. Datenverarbeitungserklärung