DIRNAME(1)
π DIRNAME(1) π
okay bestie, pull up a chair, we're talking about dirname from the GNU coreutils manual β it's a User Command, it's iconic, it's literally the girl who tells you where you actually are.
β¨ NAME β¨
dirname β strip last component from file name π
πΈ SYNOPSIS πΈ
dirname [OPTION] NAME...
π¦ DESCRIPTION π¦
so here's the vibe: you hand dirname one or more NAMEs, and it hands you back each NAME with its last non-slash component removed, and any trailing slashes removed too. like, the whole last chunk just. gone. bye. π
and if a NAME has no / characters in it at all? then dirname gives you . β which means the current directory, in case that wasn't obvious. no slash, no party, just . π«Ά
β¨ OPTIONS β¨
-z,--zeroβ end each output line with NUL, not newline β¨ (-zis giving "no newlines, we're NUL-maxxing", fr fr)--helpβ display this help and exit π--versionβ output version information and exit β
π EXAMPLES π
okay watch this, these are the examples and they ate:
dirname /usr/bin/
-> "/usr"
dirname dir1/str dir2/str
-> "dir1" followed by "dir2"
dirname stdio.h
-> "."
the last one is lowkey sending me β stdio.h has zero slashes so it just goes "." and moves on. main character behavior honestly π
π AUTHOR π
Written by David MacKenzie and Jim Meyering. legends, genuinely. periodt.
π REPORTING BUGS π
found a bug? don't suffer in silence bestie, report it:
- Report bugs to:
bug-coreutils@gnu.org - GNU coreutils home page: <https://www.gnu.org/software/coreutils/>
- General help using GNU software: <https://www.gnu.org/gethelp/>
- Report any translation bugs to <https://translationproject.org/team/>
π SEE ALSO π
Full documentation <https://www.gnu.org/software/coreutils/dirname> or available locally via: info '(coreutils) dirname invocation'
Packaged by Ubuntu (9.10-1ubuntu2)
Copyright Β© 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
no cap β that "NO WARRANTY" part is real and it's in CAPS for a reason, bestie. read it. π
okay that's the whole page, and the sign-off is literally the footer: this was GNU coreutils 9.10, from August 2026, and you're reading DIRNAME(1) β go split some paths, you've got this π¦πβ¨
π¦ where this page comes from
- ubuntu stonking: gnu-coreutils 9.10-1ubuntu2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms