From LQWiki
Jump to: navigation, search

dirname returns the directory portion of a path.

For example:

$ dirname "foo/bar/baz"

dirname retains the part removed by basename.

Provided by

Most (all?) Linux distributions incorporate this from the GNU Coreutils: and use its man page

Related Commands

  • basename - get the base filename part of a pathname.
  • pathchk - check for strange names
  • mktemp - Create a temporary

See also

shell scripting

This article is a stub and needs to be finished. Plunge forward and help it grow!