Image optimisation – bulk

Tools used to optimise images within a folder/sub-folder:¬†optipng, jpegoptim To install these tools use the following commands: Centos yum install epel-release yum update yum install -y optipng jpegoptim Debian/Ubuntu apt install -y optipng jpegoptim To use the the tools in a recursive way use the following bash script: #!/bin/bash ################## USAGE ########################### # ./optimiseImages.sh /full/path/to/folder […]

Delete large amounts of files

Script to remove large number of files (amount > ARG_MAX) Create a script file with whatever name you want, let’s say “removefiles.sh” and put in the following content: #!/bin/bash folderPath=$1 a=$(du -sk $folderPath | awk ‘{print$1}’) while [ $a -gt 0 ]; do for file in $(ls -p $folderPath | grep -v / | tail […]

Linux aliases

Aliases in linux are placeholders for longer commands to enable you to type faster without remembering the full syntax of a command. Aliases are defined usually in a file called .bash_aliases and included by default on some distributions of linux if not the following command will include them if it’s added in .bashrc/.bash_profile if [ […]

CSF Instalation (config server firewall)

CSF installation on servers with cPanel SSH onto the box and sudo as root, go into the normal user home folder (should be /home/plugandplayroot) and execute the following: wget https://download.configserver.com/csf.tgz tar -xzf csf.tgz cd csf sh install.sh This will take care of installing the firewall, now for the configuration. PS: leave your ssh connection opened […]