The bus 511 (direction “Urca”) is the correct city bus to go from Copacabana to Sugar Loaf. If you are at the end of Copacabana (next to Ipanema) the bus will cross the whole Copacabana neighborhood, which can take from 8 to 20 minutes (only to cross it), depending on the time of the day (rush hour 8 – 10 am, and 4-8 pm). Then, add other 5 to 10 minutes to get to the Sugar Loaf cable car ticket office.
On the other hand, if you are in the beginning of Copacabana, it can take very little time to get to Sugar Loaf, probably around 10 minutes.
On the way back to Copacabana, Ipanema or Leblon, take bus 512 (direction “Leblon”). Its stop is right across the street where you exited bus 511. The bus 512 is pretty much the same bus that goes from Copacabana to Sugar Loaf, but on the way back, it changes its number from 511 to 512. Do not be surprised if you meet the same driver after you visit Sugar Loaf, because the bus driver does the same route all day long — Urca-Leblon and Leblon-Urca!

See photos of Sugar Loaf in Rio de Janeiro, Brazil, as well as info on how to visit it.