How can I reindex magento using by command line. Kindly provide steps for the same.


4 Answers 4

step 1 : cd [MAGENTO_ROOT]/shell/

You should replace [MAGENTO_ROOT] with your own absolute path to Magento root folder. For example /home/Thief/public_html/ Then list all files to see what we have here. Just enter simple command:

step 2 : ls -l

If you can find something like ‘indexer.php‘, that’s what we need and we can go on. To see the status of all indexes, you can execute the command

php indexer.php --status

step 3 : php indexer.php --reindex catalog_product_price 

Here catalog_product_price is the index type that you want to rebuild. You can use next arguments for different types of indexes:

catalog_product_attribute Product Attributes
catalog_product_price Product Prices
catalog_url Catalog Url Rewrites
catalog_product_flat Product Flat Data
catalog_category_flat Category Flat Data
catalog_category_product Category Products
catalogsearch_fulltext Catalog Search Index
cataloginventory_stock Stock status

For all reindexall : php indexer.php --reindexall

Background reindex process Sometimes you may want to run this process in background so you can turn off your computer or just have a couple of beers. In this case, you can use a command line tool, called ‘nohup’. It allows you to run almost any CLI command in background independently from your current session. If you want to reindex something in background, your command should look like this:

nohup php indexer.php --reindex catalog_product_price &

For more information refer this link


You can use

Go to shell folder and run this cmd

php indexer.php --reindexall

For separate

php yourmagentofolder/shell/indexer.php -reindex catalog_product_attribute
php yourmagentofolder/shell/indexer.php -reindex catalogsearch_fulltext
php yourmagentofolder/shell/indexer.php -reindex catalog_category_flat
php yourmagentofolder/shell/indexer.php -reindex cataloginventory_stock
php yourmagentofolder/shell/indexer.php -reindex catalog_category_product
php yourmagentofolder/shell/indexer.php -reindex catalog_product_price
php yourmagentofolder/shell/indexer.php -reindex tag_summary
php yourmagentofolder/shell/indexer.php -reindex catalog_url
  • 10
    @vaibhavahalpara, why you forcing him to delete answer? Anyone can share the answer which they thought in mind. Commented Jul 3, 2017 at 10:39

For Magento 2:

From the magento root directory run below

php bin/magento indexer:reindex

Use this command from the root folder of your project to run all the indexes:

php shell/indexer.php --reindexall

You can also run a specific entity index as well by passing as an argument in the command as:

php shell/indexer.php --reindex <indexer>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.