Controlling M2 via command line – when and why to use each command

Magento 2 Upgrade Command:

php -d set_time_limit=3600 -d memory_limit=1024M bin/magento setup:upgrade

Magento 2 reindex Command:

php bin/magento indexer:reindex

Magento 2 flush cache Command:

php bin/magento cache:flush

Magento 2 static content deploy Command:

php bin/magento setup:static-content:deploy

Magento 2 check developer mode Command:

php bin/magento deploy:mode:show

Magento 2 set developer mode Command:

php bin/magento deploy:mode:set developer
php bin/magento deploy:mode:set production

Magento 2 static content deploy Command if get memory error:

php -dmemory_limit=6G bin/magento setup:static-content:deploy

Magento 2 Disable module command:

php bin/magento module:disable Module_Name

Magento 2 enable module command:

php bin/magento module:enable Module_Name

Magento 2 command to find the all disabled/enabled module command:

php bin/magento module:status

How to Start/Stop/Restart the Datadog Agent

Mac OS X

To manually start the Agent:

/usr/local/bin/datadog-agent start

To stop the Agent:

/usr/local/bin/datadog-agent stop

To restart the Agent

/usr/local/bin/datadog-agent restart

Linux

To manually start the Agent:

sudo /etc/init.d/datadog-agent start

To stop the Agent:

sudo /etc/init.d/datadog-agent stop

To restart the Agent

sudo /etc/init.d/datadog-agent restart

Windows

Windows service

 

 

How to Setup Git on Windows & Mac

Step 1: Add your PC/Mac ssh key to your account.
1. If you are using Mac run following commands in Terminal window or if you are using Windows install GitBash command utility ( https://gitforwindows.github.io ) to run following commands.

Step 2. Create your SSH Keys:
2.1.Before generating an SSH key in your shell, check if your system already has
one by running the following command:

 cat ~/.ssh/id_rsa.pub

2.2.if keys are not there then generate a new SSH key, use the following
command:

ssh keygen -t rsa -C"$your_email"

Note:This command will prompt you for a location and filename to store the
key pair and for a password. When prompted for the location and filename,
just press enter to use the default.
2.3. To copy your public key to the clipboard, use the code below. Depending on
your OS you’ll need to use a different command:

 For Windows: clip < ~/.ssh/id_rsa.pub
 For Mac: pbcopy < ~/.ssh/id_rsa.pub

Step 3. Open Git repository from you credentials and Add your SSH Key
3.1. On the left side menu, click on “profile settings” and then click on “SSH Keys”:

Screen Shot 2016-08-31 at 11.43.36 AM

3.2. Then click on the green button “Add SSH Key”

3.3. There, you should paste the SSH Key which you copied from command line.

Screen Shot 2016-08-31 at 11.43.52 AM

Note:Now, you’ll be able to use Git over SSH

How to install Tomcat-8.5.3 on mac/linux

  1. Download a binary distribution of the core module: apache-tomcat-8.5.3.tar.gz from here. I picked the tar.gz in Binary Distributions / Core section.
  2. Opening/unarchiving the archive will create a folder structure in your Downloads folder: (btw, this free Unarchiver app is perfect for all kinds of compressed files and superior to the built-in Archive Utility.app) ~/Downloads/apache-tomcat-8.5.3
  3. Open to Terminal app to move the unarchived distribution to /usr/local
    sudo mkdir -p /usr/local
    sudo mv ~/Downloads/apache-tomcat-8.5.3 /usr/local
  4. To make it easy to replace this release with future releases, we are going to create a symbolic link that we are going to use when referring to Tomcat (after removing the old link, you might have from installing a previous version):
     sudo rm -f /Library/Tomcat
     sudo ln -s /usr/local/apache-tomcat-8.5.3 /Library/Tomcat
  5. Change ownership of the /Library/Tomcat folder hierarchy:
     sudo chown -R <your_username> /Library/Tomcat
  6. Make all scripts executable:
 sudo chmod +x /Library/Tomcat/bin/*.sh

Instead of using the start and stop scripts, like so:

$ /Library/Tomcat/bin/startup.sh
Using CATALINA_BASE: /Library/Tomcat
Using CATALINA_HOME: /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
Tomcat started.


$ /Library/Tomcat/bin/shutdown.sh
Using CATALINA_BASE: /Library/Tomcat
Using CATALINA_HOME: /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar

Finally, after your started Tomcat, open your Mac’s Web browser and take a look at the default page:http://localhost:8080

How to install SSL certificate on ubuntu(Magento)

Step1) Change to the Apache SSL Certificate directory:

cd /etc/apache2/ssl

OR

If it doesn’t exist then create it:

sudo mkdir /etc/apache2/ssl

Step2). You need three files:

– The public key provided by the Certificate Authority
– The Private key from your server which you created and submitted to the Certificate Authority
– The Intermediate or Chain Certificate provided from your Certificate Authority

Move them all to the /etc/apache2/ssl directory and name them appropriately

Step3) . Modify your virtual hosts file and add the config to listen on port 443:

<VirtualHost *:443>

ServerName your_domain.com
DocumentRoot /var/www/html/path_to_your_site
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/your_domain_public.crt // The Public Key provided from the Certificate Autority
SSLCertificateKeyFile /etc/apache2/ssl/your_domain_private.key // The key you created initially (probably using OpenSSL and submitted to the Certificate Authority)
SSLCertificateChainFile /etc/apache2/ssl/your_domain_intermediate.crt // The Intermediate Certificate provided from the Certificate Autority

<Directory /var/www/html/path_to_your_site/>
AllowOverride All
</Directory>

</VirtualHost>

Step4) Restart the Apache service using

Now you should be able to navigate to load your site using HTTPS but depending on your CMS or Shopping Cart platform you may need to make a config change in the admin area to force it to use HTTPS.

Magento

To change this in Magento navigate to:

System->Configuration->General->Web->Unsecure and System->Configuration->General->Web->Secure

Screenshot-from-2015-05-30-144137.png

 

Browser Cache Cleaning of Chrome & Safari

Cache Cleaning for Chrome

Step 1 ) Click on the settings icon that appears to the right of the address bar. In the newest versions of Chrome, this appears as three horizontal lines and in older versions will be a wrench icon .

Step 2) From the menu, select Tools > Clear browsing data….

Picture1

Step 3) Check the following:

  • Empty the cache
  • Delete cookies and other site and plug-in data

Select the beginning of time in the drop down box and click on the Clear browsing data button.

2

Cache Cleaning for Safari

Step 1)  Click Safari in the upper left hand side of your screen. In the menu that appears, click Preferences.

3

  1. Step 2) In the window that appears, click the Privacy tab. Click the button Remove All Website Data….

    4

  1. Step 3) Click Remove Now in the pop up window that appears.

    5

How to Import/Export a Products in Magento

Step 1) Click on System –> Import/Export–>Dataflow-Profiles and you will see this

1.png

Step 2) Now After Click on Dataflow-Profiles you will see this

2.png

Step 3) Now Click on Add New Profile & it will take you on a new window

3.png

Step 4) Now fill all the details in the Columns which i fill below image.

4.png

Step 5) Now After Filling all the details click on Save and Continue Edit button

5.png

Step 6) Now if you want to Export Product just click on Run Profile in Popup button.It will take a time to download your file so just relax for a 5 minute.

Step 7 ) After All If you want to Import your Product just Follow Above step only change the Import option which i show you in a image

6.png