cmdxray / commands / dirname

What does dirname do?

strip the last component from a path, leaving the directory portion.

▸ Explain your own dirname command →

dirname examples, explained

$ dirname /usr/bin/sort

  • dirnamestrip the last component from a path, leaving the directory portion
  • /usr/bin/sortan argument passed to the command

dirname flags & options

-zend each output line with NUL instead of a newline

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.