How to Re-Index spotlight in OS X

Generally, we re-index spotlight if it doesn't produce the correct result. To force re-indexing spotlight use the following command:
 
In order to change the power-button behaviour, open the Terminal application (located in /Applications/Utilities), then type in the following command, followed by the return key:
 
From OS X 10.9 Mavericks, 10.8 Mountain Lion and 10.7 Lion, the /Library and ~/Library are hidden from the Finder – to show these directories in the GUI, launch Terminal from /Applications/Utilities and run the command below with sudo and enter your admin password when requested:
 

Reset forgotten OS X Mavericks 10.9 admin password

The passwords for all accounts on OSX 10.9 Mavericks and OSX 10.8 Mountain Lion including admin and standard users can be reset and changed when booted from the Recovery Partition on OSX.