There are three other options: you can leave your computer on 24 hours (Macs automatically do this maintenance at 5 am), you can download MacJanitor (free from MacWorld), or you can just leave it alone. The periodic maintenance rarely affects performance.
The sudo commands are acceptable ways of doing things, but aren't for the newbs. (You won't hurt anything by doing the above, but try talking a 65-year-old grandmother how to do this.)
The equivalent of Windows' Disk Maintenance program is Apple's Disk Utility. You can find it by clicking Hard Drive : Applications : Utilities : Disk Utility. I highly recommend to use this after every software install and/or update. I usually use it weekly. Repairing permissions makes things run more smoothly and will speed things up a bit (hardly noticeable unless you have a lot of bad permissions).