How to reindex Magento 1.x by using command line
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
For Magento 2:
From the magento root directory run below
php bin/magento indexer:reindex