How to reindex Magento 1.x by using command line

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


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
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

For Magento 2:

From the magento root directory run below

php bin/magento indexer:reindex

Similar questions

Is this possible to install Magento 1.9.3 using the command line
I'm trying to create a Dockerfile for a little demo project and I was going to simply install the magento the way I want it with the commandline from Ununtu container. I found some solutions (like this ) which suggest getting it from here, but the links are obviously outdated: Is there a valid direct link to 1.9.3 archive nowadays?
Magento 1 : Get product collection using command line throwing error
I have a script file like getproducts.php & have placed it under script/getproducts.php. I want to get products collection in my script file. code in my file: After executing my getproducts.php through command line I am getting error on prompt: Note : However it's working when trying to hit directly by Url: http://localhost/demosite/script/getp...
How Uninstall Theme Using command line in Magento 2
How to uninstall or remove a theme using the command line In Magento 2. Thank You...
Magento2 - How to install Magento Sample data using command line
How to install Magento Sample data using command line?
Is there any way to kick off a very specific cron process in Magento 2 using command line?
We're working on troubleshooting a bug where product back in stock alerts aren't sent on our production or staging environment, but they are in dev(after a custom patch was applied to all three). Magento 2 by default only schedules this process once a day, even if you change the time the cron is supposed to run. We've cloned our staging environment...
Trying to install Magento 2.4.1 using command line ? What is elasticsearch host?
I got this example command from the guide (tutorial) - I also have elasticsearch running. But I have a doubt that should be something good value(I am trying to install magento on localhost ) is it correct or not, if i copy paste the...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.