Sublime Text 3 installation Guide

Installing sublime text 3 on ubuntu.

This tutorial will show you how to install the Sublime Text 3 in Ubuntu. Trusty LTS via PPA repository.

The Sublime Text 3 is currently in beta. Webupd8 Team has made an installer script into PPA which automatically downloads the Sublime Text 3 archive from its website and installs it on Ubuntu. The PPA does not host any Sublime Text 3 files.

Install sublime text 3 in ubuntu

Install Sublime Text 3:

To get started, press Ctrl+Alt+T on your keyboard to open a terminal window. When it opens, copy and paste below command into terminal and hit enter:

sudo add-apt-repository -y ppa:webupd8team/sublime-text-3

Type in your password when prompts and then you’ll get this PPA (Personal Package Archive) into your system.

NOTE: you’ll see nothing when typing passwords in Linux terminal, just type in mind and hit enter to get pass.

install sublime text 3 ubuntu

After added the PPA, run commands to install the script:

sudo apt-get update;
sudo apt-get install -y sublime-text-installer

Once installed, open the editor from Unity Dash or Menu.

To disable new version notifications, add the following to your User Preferences file (Preferences > Settings – User):

“update_check”: false

Ubuntu : Zip, Unzip file using terminal.

Here is way to create zip and unzip recursively. For this, You have to install zip and unzip installation packages with following commands in terminal. Open terminal by pressing Ctrl + Alt + T.

sudo apt-get install zip  // to install zip command packages. 
sudo apt-get uninstall zip // to Unistall unzip command package.

Create a zip file :

Go To the path of that folder which you have to make zip and run following command to make a zip file.

zip -r directory-to-compress/
  • zip :  This is the application name, which we are using to create zip file.
  • -r : For recursive
  • : Name of result zip file name.
  • directory-to-compress/ : Name of the directory which we want to compress.

You can add more than one directory in single archives by following command :

sudo zip -r directory-1/ directory-2/

There is no need of -r (recursive) option for single file archive.

sudo zip a2bizz.php

Unzip file

Following command will help you to unzip a file.

sudo unzip -d destination_dir/
  • sudo : super user
  • unzip : This is unzip application, which is using to extract a zip file.
  • -d : Shorts for destination
  • destination_dir/: This is the directory where you want to extract files.

You can also use unzip to extract data on same dir.

Enjoy :)


Magento2: indexer re-indexing manually using terminal

Indexing is how Magento2 transforms data such as products, categories, and so on, to improve the performance of your storefront. As data changes, the transformed data must be updated—or reindexed. Magento2 has a very sophisticated architecture that stores lots of merchant data (including catalog data, prices, users, stores, and so on) in many database tables. To optimize store front performance, Magento2 accumulates data into special tables using indexers.

In Magento2, there is none interface from admin, to re-index manually at a time as we did in magento1, for doing this we need to use terminal. Using Terminal we can did full indexing of magento2, whenever we need, to do this we just only need to open terminal and reach the root directory of magento2 installation and type below mentioned command.

magento indexer:reindex [indexer]

where [indexer] is a space-separated list of indexers. Omit [indexer] to reindex all indexers.

Restart, Start, Stop MySQL through Command Line Terminal, OSX, Linux

Linux start/stop/restart

/etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart

In some linux, run the following commond.

service mysqld start
service mysqld stop
service mysqld restart


service mysql start
service mysql stop
service mysql restart


In OS X,  to start/stop/restart MySQL pre 5.7 using command line:

sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server restart


In OS X Yosemite/El Capitan, to start/stop/restart MySQL using the command line:

sudo launchctl load -F /Library/LaunchDaemons/
sudo launchctl unload -F /Library/LaunchDaemons/

Mysql : terminal basics

About MySQL

MySQL is an open source database management software that helps users store, organize, and retrieve data. It is a very powerful program with a lot of flexibility—this tutorial will provide the simplest introduction to MySQL

How to Install MySQL on Ubuntu and CentOS

If you don’t have MySQL installed on your droplet, you can quickly download it.


sudo apt-get install mysql-server


sudo yum install mysql-server
/etc/init.d/mysqld start

How to Access the MySQL shell

Once you have MySQL installed on your droplet, you can access the MySQL shell by typing the following command into terminal:

mysql -u root -p

After entering the root MySQL password into the prompt (not to be confused with the root droplet password), you will be able to start building your MySQL database.

Two points to keep in mind:

  • All MySQL commands end with a semicolon; if the phrase does not end with a semicolon, the command will not execute.
  • Also, although it is not required, MySQL commands are usually written in uppercase and databases, tables, usernames, or text are in lowercase to make them easier to distinguish. However, the MySQL command line is not case sensitive.

How to Create and Delete a MySQL Database

MySQL organizes its information into databases; each one can hold tables with specific data.

You can quickly check what databases are available by typing:


Your screen should look something like this:

| Database           |
| information_schema |
| mysql              |
| performance_schema |
| test               |
4 rows in set (0.01 sec)

Creating a database is very easy:

 CREATE DATABASE database name;

In this case, for example, we will call our database “events.”

| Database           |
| information_schema |
| events             |
| mysql              |
| performance_schema |
| test               |
5 rows in set (0.00 sec)

In MySQL, the phrase most often used to delete objects is Drop. You would delete a MySQL database with this command:

 DROP DATABASE database name;

How to Access a MySQL Database

Once we have a new database, we can begin to fill it with information.

The first step is to create a new table within the larger database.

Let’s open up the database we want to use:

 USE events;

In the same way that you could check the available databases, you can also see an overview of the tables that the database contains.

 SHOW tables;

Since this is a new database, MySQL has nothing to show, and you will get a message that says, “Empty set”

How to Create a MySQL Table

Let’s imagine that we are planning a get together of friends. We can use MySQL to track the details of the event.

Let’s create a new MySQL table:

name VARCHAR(20),
food VARCHAR(30),
confirmed CHAR(1), 
signup_date DATE);

This command accomplishes a number of things:

  1. It has created a table called potluck within the directory, events.
  2. We have set up 5 columns in the table—id, name, food, confirmed, and signup date.
  3. The “id” column has a command (INT NOT NULL PRIMARY KEY AUTO_INCREMENT) that automatically numbers each row.
  4. The “name” column has been limited by the VARCHAR command to be under 20 characters long.
  5. The “food” column designates the food each person will bring. The VARCHAR limits text to be under 30 characters.
  6. The “confirmed” column records whether the person has RSVP’d with one letter, Y or N.
  7. The “date” column will show when they signed up for the event. MySQL requires that dates be written as yyyy-mm-dd

Let’s take a look at how the table appears within the database using the “SHOW TABLES;” command:

 mysql> SHOW TABLES;
| Tables_in_events |
| potluck          |
1 row in set (0.01 sec)

We can remind ourselves about the table’s organization with this command:

 DESCRIBE potluck;

Keep in mind throughout that, although the MySQL command line does not pay attention to cases, the table and database names are case sensitive: potluck is not the same as POTLUCK or Potluck.

 mysql>DESCRIBE potluck;
| Field       | Type        | Null | Key | Default | Extra          |
| id          | int(11)     | NO   | PRI | NULL    | auto_increment |
| name        | varchar(20) | YES  |     | NULL    |                |
| food        | varchar(30) | YES  |     | NULL    |                |
| confirmed   | char(1)     | YES  |     | NULL    |                |
| signup_date | date        | YES  |     | NULL    |                |
5 rows in set (0.01 sec)

How to Add Information to a MySQL Table

We have a working table for our party. Now it’s time to start filling in the details.

Use this format to insert information into each row:

INSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, "John", "Casserole","Y", '2012-04-11');
Once you input that in, you will see the words:
 Query OK, 1 row affected (0.00 sec)
Let’s add a couple more people to our group:
INSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, "Sandy", "Key Lime Tarts","N", '2012-04-14');
INSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, "Tom", "BBQ","Y", '2012-04-18');
INSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, "Tina", "Salad","Y", '2012-04-10');

We can take a look at our table:

mysql> SELECT * FROM potluck;
| id | name  | food           | confirmed | signup_date |
|  1 | John  | Casserole      | Y         | 2012-04-11  |
|  2 | Sandy | Key Lime Tarts | N         | 2012-04-14  |
|  3 | Tom   | BBQ            | Y         | 2012-04-18  |
|  4 | Tina  | Salad          | Y         | 2012-04-10  |
4 rows in set (0.00 sec)

How to Update Information in the Table

Now that we have started our potluck list, we can address any possible changes. For example: Sandy has confirmed that she is attending, so we are going to update that in the table.

UPDATE `potluck` 
`confirmed` = 'Y' 
WHERE `potluck`.`name` ='Sandy';

You can also use this command to add information into specific cells, even if they are empty.

How to Add and Delete a Column

We are creating a handy chart, but it is missing some important information: our attendees’ emails.

We can easily add this:

 ALTER TABLE potluck ADD email VARCHAR(40);

This command puts the new column called “email” at the end of the table by default, and the VARCHAR command limits it to 40 characters.

However, if you need to place that column in a specific spot in the table, we can add one more phrase to the command.

 ALTER TABLE potluck ADD email VARCHAR(40) AFTER name;

Now the new “email” column goes after the column “name”.

Just as you can add a column, you can delete one as well:

ALTER TABLE potluck DROP email;

I guess we will never know how to reach the picnickers.

How to Del

ete a Row

If needed, you can also delete rows from the table with the following command:

DELETE from [table name] where [column name]=[field text];

For example, if Sandy suddenly realized that she will not be able to participate in the potluck after all, we could quickly eliminate her details.

mysql> DELETE from potluck  where name='Sandy';
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM potluck;
| id | name | food      | confirmed | signup_date |
|  1 | John | Casserole | Y         | 2012-04-11  |
|  3 | Tom  | BBQ       | Y         | 2012-04-18  |
|  4 | Tina | Salad     | Y         | 2012-04-10  |
3 rows in set (0.00 sec)

Notice that the id numbers associated with each person remain the same.

Linux: Searching and Replacing string in multiple Files in a directory/ folder

I recently stuck into a condition in which I have to replace every occurrence of a certain word / string in a number of files spanning multiple directories, and this is the easiest way I found to do it. It uses grep to search for a certain word and if it find its it runs sed to replace the strings you want. Note: This will not work on windows systems

Basic Format

grep -rl 'stringToFind' /path/to/directory/where/files/are/saved | xargs sed -i 's/stringToFind/stringToReplace/g'
Note: The forward slash '/' delimiter in the sed argument could also be a different delimiter (pipe ‘|’ character). The pipe delimiter might be useful when searching through a lot of html files if you didn’t want to escape the forward slash, for instance.


grep -rl 'room' ./ | xargs sed -i 's/room/house/g'

This will search for the string ‘room’ in all files relative to the current directory and replace ‘room’ with ‘house’ for each occurrence of the string in each file.

Magento2: Command Line or Terminal installation on Ubuntu

A long-waited Magento2 now appeared on Magento site for installation. Of course we couldn’t sit still and installed Magento2 on our server. And described the installation process for you, including the issues we dealt with and how we fixed them.

Pre Installation

The first steps lead us to the installation guide page. It is required to check whether your server suits minimal Magento 2 requirements:

Apache: 2.2 or 2.4

PHP: 5.5.x or 5.6.x

MySQL: 5.6.x


As we are using Ubuntu 14.4,  so the system suits minimal database requirements, and we already have PHP 5.5.x support. Also you’ll need Git and Composer, install it if you haven’t done it before.

Use these commands in command line or terminal for root user permissions:

apt-get update
apt-get install git wget
wget -O /usr/local/bin/composer
chmod +x /usr/local/bin/composer

Magento 2 download

Now it’s time to clone Magento 2 code from GitHub repository. http://magento2/ is the URL of our website, and the document root is /var/www/magento2. Use these commands if you don’t plan to install Sample data for Magento 2:

cd /var/www 
git clone
cd /var/www/magento2
composer install

If you plan to install Sample data – refer to this link for details. As for now Magento 2 is still under development, the best variant is to read the latest documentation at Magento docs.

File permissions

create a root user, which is the owner of all magento files on your server, and Apache web server runs on behalf of ‘www-data’ user. Magento 2 documentation describes the access permission settings for files and directories on the principle that the web server runs on behalf of the user which is the owner of all Magento files. Our opinion is: it’s not the best decision, as it can lead to security issues (as the web server has permissions to write and run the code) as well as issues with setting access permissions for third party developers (as you’re not logging in as www-data user). We normally use the following access permissions:

chown -R :www-data /var/www/magento2
find /var/www/magento2 -type f -print0 | xargs -r0 chmod 640
find /var/www/magento2 -type d -print0 | xargs -r0 chmod 750
chmod -R g+w /var/www/magento2/{pub,var}
chmod -R g+w /var/www/magento2/{app/etc,vendor}


now create database –

echo 'CREATE DATABASE `magento2` DEFAULT CHARSET utf8 COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON `magento2`.* to `magento2`@`%` IDENTIFIED BY "magento2";' | mysql -h mysql56.local -u root -p

Magento2 installation

Now all is set start you magento installation using below command

/var/www/magento2/bin/magento setup:install --base-url=http://magento2/ --db-host=localhost --db-name=magento2 --db-user=root --db-password=root --admin-firstname=a2bizz --admin-lastname=user --admin-user=a2bizz --admin-password=a2bizz@123 --language=en_US