Change Permissions Recursively

*wordpress example*
find /var/www/wordpress/ -type d -exec chmod 750 {} \;
find /var/www/wordpress/ -type f -exec chmod 640 {} \;

Set index.html as root file in Nginx?

location / {
    try_files $uri $uri/index.html;
}

enable/disable a website hosted with Apache?

a2ensite <site>
a2dissite <site>

cloud-init user-data script?

/var/log/cloud-init-output.log

Convert LV to qcow2

qemu-img convert -O qcow2 $LVPATH $DESTINATION/name.img

Migrate using Rsync with logged in user keys

rsync -avzh /dev/migrate/$VID.img lmao@loldumb.com:/home/vf-data/$UUID_1.img

Install Composer

apt install php-cli unzip
cd ~
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
HASH=`curl -sS https://composer.github.io/installer.sig`
php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
composer -V

Compress and decompress tar.gz

tar -czvf compressedfile.tar.gz targetfile.img
tar -xvf archive.tar.gz
or 
apt install pv
tar cf - /folder-with-big-files -P | pv -s $(du -sb /folder-with-big-files | awk '{print $1}') | gzip > big-files.tar.gz
pv <some .tar.gz file> | tar -xvzf - -C <some directory>

MC connect to Minio cloud Storage

mc alias set minio <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY>

Encrypt a file with your public keys

gpg --encrypt --armor -r <keyname> <file>

Mount a FTP server on linux

curlftpfs -o allow_other <ShareUsername>:<ftpUserPassword>@<serverhostname> <MountLocation>

Check OS version

cat /etc/os-release
lsb_release -a   (best one)
uname -r

Minio And Portainer fix

Set the following env on the container instance
MINIO_SERVER_URL    <url to the api not the console>

mysql command to change a user password

mysql -u root -p
use mysql;
ALTER USER 'user'@'hostname' IDENTIFIED BY 'newPass';

Using WordPress with a MySQL Unix Socket

define('DB_HOST', 'localhost:/var/lib/mysql/mysql.sock');

Raid 1 OS setup linux, raid used as /

1. Create bios boot partition (512mb or more)
2. Create raid.
3. set the raid partition as / or parition how you like
4. continue install
5. Select one of the raid drives to install grub on. (write down which one you used.)
6. finish install.
7. log into system
8 do grub-install /dev/*other raid drives*

Gpg Import keys and encrypt

gpg --import public.key 

then 

gpg --list-keys 
or
gpg --show-keys Keyfile 

then 

gpg --edit-key [key-id]
trust 
Set trust level 0-5

gpg --encrypt --output file.gpg --recipient user@example.com file

mysql auto login for user

Create a file named .my.cnf in your /home/username directory, replacing username with your account username.

Copy and paste the following text into the .my.cnf file. Replace dbusername with the database user and replace dbpassword with the database user's password:
[client]
user = dbusername
password = "dbpassword"
host = localhost

*Full Database backup*
mysqldump --all-databases > /backup/sql-backup-$(date +\%F).sql

Crontab Calculator?

https://crontab.guru

example
0 3 * * 0 /bin/bash /examplescript.sh

MC connect to Minio cloud Storage

mc alias set minio <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY>

mc cp file minioalias/bucket

Get public ip quick also see what interface is being used as the main

Use -4 or -6 to see ipv4 or ipv6
curl -4/-6 icanhazip.com

Apache Random Commands

a2ensite your_domain.conf

a2dissite 000-default.conf

apache2ctl configtest

change machine Time or see time

date 
or
timedatectl

to set a new timezone Example.
sudo ln  -sf /usr/share/zoneinfo/Americas/Denver /etc/localtime