Take a quick drive from downtown San Francisco over the Golden Gate Bridge to the Marin Headlands, which is part of the Golden Gate National Recreation Area, http://www.nps.gov/goga/marin-headlands.htm. The park contains miles of excellent hiking trails, many with postcard views of San Francisco. Some of the better views can be obscured by thick fog common in the region so check the weather before you head out.
Confession: I’ve been to the Headlands dozens of times but never actually hiked there. I’d have to stop gaping slack-jawed at the view and pay attention to where I was walking, and how much fun is that?