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?


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$UUID_1.img

Install Composer

apt install php-cli unzip
cd ~
curl -sS -o /tmp/composer-setup.php
HASH=`curl -sS`
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
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


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 


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


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

gpg --encrypt --output file.gpg --recipient 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:
user = dbusername
password = "dbpassword"
host = localhost

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

Crontab Calculator?

0 3 * * 0 /bin/bash /

MC connect to Minio cloud Storage


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

Apache Random Commands

a2ensite your_domain.conf

a2dissite 000-default.conf

apache2ctl configtest

change machine Time or see time


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