Magento indexing is very important in magento websites. When you run magento indexing it just copy the product or category data from EAV tables into FLAT tables.

Magento provides two ways of indexing :

  1. Indexing using the magento admin panel.
  2. Indexing using the command line.

When you have large number of products in your magento websites then doing indexing using magento admin panel sometimes may work and sometimes not. It may be due several reasons. In that case, command line indexing is a good option. you can just run the indexing in backgroud in a terminal window and your indexing will be done.

You can also automate the magento indexing by setup a cron at specific time so that you don’t need to trigger magento indexing manually.

Lets check below how to do command line magento indexing.

Step 1 : cd [MAGENTO_ROOT]/shell/

You should replace [MAGENTO_ROOT] with your own absolute path to Magento root folder. For example /var/www/public_html/magento1/



$ cd /var/www/html/magento1/shell

Step 2 : To check the list of files exists in the Shell directory, execute the below command:



$ ls -l

Output something like the below screenshot :-

Step 3 : Now check the status of magento indexing:

For checking status of magento indexing please execute below command


$ php indexer.php --status

Output something like the below screenshot :-

Step 4 : To run the magento indexing for catalog_product_flat process, execute the below command:


$ php indexer.php --reindex catalog_product_flat

Output something like the below screenshot :-

Magento provides other arguments for different types of indexes:

  1. catalog_product_attribute for Product Attributes indexing.
  2. catalog_product_price for Product Prices indexing.
  3. catalog_url for Catalog Url Rewrites Indexing.
  4. catalog_product_flat for Product Flat Data Indexing.
  5. catalog_category_flat for Category Flat Data Indexing.
  6. catalog_category_product for Category Products Indexing.
  7. catalogsearch_fulltext for Catalog Search Index Indexing.
  8. cataloginventory_stock for Stock status Indexing .
  9. tag_summary for Tag Summary Indexing.

For Example, if you need to run magento indexing for Category Products Indexing, then you have to execute below command.



$ php indexer.php --reindex catalog_category_product

For reindex all magento indexing, execute below command:


$ php indexer.php --reindexall

Sometimes you may want to run magento indexing as a background process so you can close the terminal and do other activity, therefore you don’t have to wait till magento indexing completion. In this scenario, you can use a command line tool, called nohup. This command allows you to run any CLI command in background independently from your current session. If you want to reindex something in background, then you need to follow the next step below.

Step 5 : Run magento indexing process in background


$ nohup php indexer.php --reindex catalog_product_flat &

Output something like the below screenshot :-

For reindex all magento indexing using nohup, execute below command:


$ nohup php indexer.php --reindexall &

After executing nohup command, you can safely log out of ssh session. You can also login back to the terminal or machine any time to look if the process was finished or not. for that you need to go to the shell directory again.

Step 6 : Check magento indexing running in background

When you run magento indexing using nohup command in background then you see a nohup.out file has been created on the same directory. for checking the file in directory, execute below command.


$ cd /var/www/html/magento1/shell
$ ls -l

Output something like the below screenshot :-

For checking output of nohup.out file execute below command


$ cd /var/www/html/magento1/shell
$ cat nohup.out

Output something like the below screenshot :-

If you see an empty line or nothing, then you should allow some more time for the process to finish. Once indexing completed successfully then should see output on your screen as “Product Flat Data index was rebuilt successfully”.

Step 7 : Remove nohup.out file

if magento indexing was rebuild successfully then remove the file using below command.


$ rm nohup.out

Output something like the below screenshot :-

Previous post
How to enable and disable the firewall on Ubuntu
Next post
How to fix Missing GPG Key Apt Repository Errors (NO_PUBKEY) on Ubuntu, Mint and Debian

Write a Comment

Your email address will not be published. Required fields are marked *

All Rights Reserved. ReadAndCare