$manlookup

dirname

The Linux manual documents dirname in 2 places. Pick the section you want.