Skip to main content

Linux

Open Source Operating System

Optimizing Images using command line

Submitted by system on
The images uploaded by users may not be of ideal size and may require compression to manage server space. There are some tools available for compressing JPG and PNG files. Please note that the owner changes to the current username for the file after compression. Please remember to change ownership if required of the file or per folder post compression. jpegoptim : Optimize a jpg image with the same name jpegoptim image.jpg
Optimize all jpg images in a folder jpegoptim *.jpg

SSL Certificate Using Let's Encrypt for Ubuntu

Submitted by system on
Automated creation, renewing of certificates is provided by software called certbot. To view a list of the certificates Certbot knows about, run the certificates subcommand: $> certbot certificates
Deleting certificates $> certbot delete --cert-name example.com
Install Certificates Using Apache $> sudo certbot --apache -d example.in -d www.example.in

Specify different default php version

Submitted by system on
If you are using Ubuntu and want to set a different version for php, considering multiple version of php is installed in your system sudo update-alternatives --set php /usr/bin/php7.0
Set php7.0 as the default version. -- Links: https://www.tecmint.com/install-different-php-versions-in-ubuntu/ https://jakelprice.com/article/how-to-upgrade-from-php-70-to-php-71

Server Certification

Submitted by system on
Checking Passphrase for private key:
openssl rsa -check -in keyfilename
Changing Passphrase:
openssl rsa -des3 -in keyfilename -out newkeyfilename
Installing or trusting certificates: Extensions .crt, .pem and .cer are interchangeable, just change the file name extension, they have the same form. Try this: sudo cp mycert.cer /usr/share/ca-certificates/mycert.pem
sudo dpkg-reconfigure ca-certificates
sudo update-ca-certificates

Opcache with Drupal

Submitted by system on
OPcache is an opcode cache for PHP. It is bundled with PHP 5.5.0 and later. The following settings work really well with Drupal. For Ubunti 14.04 , these following file can be modified to incorporate the changes /etc/php5/apache2/php.ini
Configuration: opcache.enable=1
opcache.memory_consumption=256
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1

Memcached Config For Drupal On Ubuntu

Submitted by system on
Memcached is a free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load Memcached is used in Drupal mostly for caching Database queries in memory to improve authenticated user experience and reduce load on database. Primarily cache tables are swapped to have a memcached backend. We can find a lot of tutorials to install Memcached on debian system including memcache PHP extension.

Handy Linux Commands

Submitted by amitsedai on
Split: Split a text file in half (or any percentage) on Ubuntu Linux The following command splits access.log files into multiple files with 6000 lines each split -l 6000 access.log
Split files into size of 5M each split --bytes 5M --numeric-suffixes --suffix-length=3 foo.mysql last_part.mysql
Diff : Get Difference between files and folders Following command provides recursive difference diff -r dir1/ dir2/

Using Drush Alias

Submitted by amitsedai on
drush aliases allow you to run a drush commands on your local server but actually execute the command on a remote server. One can create aliases in a folder that drush recognizes, mostly inside the .drush folder for Linux Based Systems. For a mysite example, we can create a file called as mysite.aliases.drushrc.php inside the .drush folder (Or any folder which Drush goes through before executing). All aliases in a site can also be combined in a single file called as aliases.drushrc.php Example data that can be added to mysite.aliases.drushrc.php <?php

Batch Process Images in Linux

Submitted by amitsedai on
Sometimes its a pain when you want to modify, resize multiple files at once in Linux. Fortunately ImageMagick comes with a handy command called convert that makes the work simpler Install ImageMagick in Ubuntu
sudo apt-get install imagemagick
Batch Process set of files in a folder and resize them to 1024X768
for file in *.jpg; do convert "$file" -resize 1024x768 "$file"; done
You may also try an app called as phatch for GUI related batch processing of images. Snippet to bulk rename files by replacing strings in filename