Unix

Dit und dat

14. Februar 2021 / Stephan Post

delete files with extension recursively

find . -type f -name "*.jpg" -exec rm -rf {} \;
find . -type f -name "*.png" -exec rm -rf {} \;
find . -type f -name "*.md" -exec rm -rf {} \;
find . -depth -type d -empty -exec rmdir {} \;

wget

# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
--restrict-file-names=windows \ # Modify filenames to work in Windows as well.
--domains yoursite.com \ # Do not follow links outside this domain.
--mirror \ # recursive
--no-parent \ # Don't follow links outside the directory you pass in.
yoursite.com/whatever/path # The URL to download

Grab the whole site with all assets

wget --page-requisites --adjust-extension --convert-links --mirror --no-parent --domains kellinghusen-fahrsport.de http://www.kellinghusen-fahrsport.de

Apache2

site namen ohne .conf angeben.

# enable site
sudo a2ensite 009-upcoming.tripunlimited.de
 
# disable site
sudo a2dissite
 
# enable an apache2 module
sudo a2enmod
 
# e.g. a2enmod php4 will create the correct symlinks in mods-enabled to allow the module to be used. In this example it will link both php4.conf and php4.load for the user
 
# disable an apache2 module
sudo a2dismod
 
# force reload the server:
sudo  /etc/init.d/apache2 force-reload

Passwort für upcoming.tripunlimited.de und kellinghusen.tripunlimited.de

user: Vorausschau
pass: IchWillRein

SSL Certs

Vorher DNS Eintrag CNAME auf kellinghusen.tripunlimited.de

cd /etc/letsencrypt/
certbot certonly -d

subdomain ssl cert beziehen:
sudo certbot -i apache -d kellinghusen.tripunlimited.de

Cert renew

The recommended way to renew certificates is certbot renew, which ideally should be run automatically at least once per day, normally using cron.

certbot renew checks all of the certificates that you’ve obtained and tries to renew any that will expire in less than 30 days.

Compress an entire directory to a single file

To compress directory named /home/vivek/bin/ in to a /tmp/bin-backup.tar.gz type the tar command on Linux:

tar -zcvf /tmp/bin-backup.tar.gz /home/vivek/bin/
DRAFT
Weiterlesen: