Normally you sand in the direction of the grain1 for best results. But this surface is all end grain, so that doesn't apply since technically the grain direction is outwards (towards the viewer).
What you do with end grain is instead sand until no sanding marks are visible, and/or you're happy with the surface. Beyond that the sanding direction makes little or no difference to the quality of the result.
Here though there is a good reason to sand in a specific direction, and that's simply one of ease — it's far harder to consistently sand a long, narrow surface like this working up and down, you really have to sand going side to side.
I plan to sand it up to 180 grit and apply an oil finish.
Generally you need to go finer than this on end grain (it's fairly commonplace to sand end grain to a higher grit than the long-grain surfaces of the same project)2.
How fine to sand is always a matter of individual preference. I would go to 240 at minimum myself, and sometimes you'll read of people sanding their end grain to 400 and sometimes beyond. But basically sand until you are happy with how it looks and feels since you're the one who has to live with it.
1 Approximately in the direction of the grain. You can't always sand exactly parallel to the grain since it may vary across the surface of any board, and additionally some coarse-grained woods respond well to deliberately sanding at a slight angle (not an issue if sanding using random-orbit sanders).
2 In addition to other reasons it also helps the end grain not turn out so dark when wet with the finish. If both long-grain and end-grain surfaces are sanded equally, to normal levels, the end grain will be very much darker once most finishes have been applied because end grain is very open and absorbs finish like a sponge.