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

rsync

On-the-fly backup (backup a running system)

sudo rsync -e "ssh -i ${HOME}/.ssh/id_rsa" \
  -av \
  --delete \
  --numeric-ids \
  --exclude=proc/* \
  --exclude=sys/* \
  --exclude=tmp/* \
  root@${HOST}:/ .

limit bandwith to 2 mbit/s

rsync --bwlimit=2000 --delete -avz root@www.example.com:/ /media/backup/www.example.com/$(date -I)/

# Specify SSH key and configuration
sudo rsync -av \
    -e "ssh -i /home/foo/.ssh/id_rsa -F /home/foo/.ssh/config" \
    --delete \
    --numeric-ids \
    -av \
    /from/dir/ root@192.168.0.1:/to/dir

--ignore-times

Set owner and permissions

rsync -og --chown=nobody:nogroup --chmod=644 file.txt root@example.com:/dir/file.txt

Rsync files betwen two remote hosts withoud direct connection

HOST_FROM=www.example.com
HOST_TO=new.example.com
DIR_FROM=/var/www/html/
DIR_TO=/var/www/html/
ssh -A -R localhost:50000:${HOST_TO}:22 ${HOST_FROM} "rsync -e 'ssh -o StrictHostKeyChecking=no -p 50000' --delete -a ${DIR_FROM} localhost:${DIR_TO}"

Delete files after successfully copy

sshpass -p "${SSH_PASS}"\
  rsync -av --remove-source-files -e ssh ${SSH_USER}@${SSH_HOST}:~/htdocs/*.gz /mnt/backup/

rsync --remove-source-files -av /source/dir/ 192.168.1.1:/target/dir/
rsync -aHAXx --numeric-ids --delete --stats --info=progress2 --out-format="[%%t]:%%o:%%f:Last Modified %%M" --verbose -e "ssh -o

Set file permissions

rsync --chmod=400 _.file1.pem root@www.example.com:/etc/haproxy/ssl/

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 {} \;
cli
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