BASENAME(1)

πŸ’… BASENAME(1) β€” bestie edition ✨

okay so this is the manual page for basename, living in the General Commands Manual section (that's section 1, for the uninitiated πŸ’–). it's a little icon, it does one thing, and it does it gorgeously.


✨ NAME ✨

basename β€” print NAME with any leading directory components removed. If specified, also remove a trailing SUFFIX. πŸŽ€

that's it. that's the whole job. and yet. she serves. πŸ‘‘


🌸 SYNOPSIS 🌸

basename [-z] NAME [SUFFIX]
basename OPTION... NAME...

two whole modes, bestie. the classic one and the options girl one. πŸ¦‹


πŸ’œ DESCRIPTION πŸ’œ

Print NAME with any leading directory components removed. If specified, also remove a trailing SUFFIX.

fr fr that's the entire description, they really said "we're not gonna pad this." and honestly? respect. 🫢


πŸŽ€ OPTIONS πŸŽ€

  • -a, --multiple β€” support multiple arguments and treat each as a NAME. so you can just dump a whole list of paths in there and she'll handle all of them. no cap. πŸ”₯
  • -s, --suffix <SUFFIX> β€” remove a trailing SUFFIX. also, plot twist: this one implies -a, so you're automatically in multiple-argument mode whether you asked for it or not. ✨
  • -z, --zero β€” end each output line with NUL, not newline. for when newlines are simply not the vibe. 🧚
  • -h, --help β€” Print help. she'll tell you what's up. πŸ’–
  • -V, --version β€” Print version. ~receipts~ πŸ“œ

⭐ VERSION ⭐

v(uutils coreutils) 0.12.0

that's the version bestie. that's what -V is gonna hand you. πŸ’…


🌈 EXAMPLES 🌈

Show only the file name from a path:

basename path/to/file

Show only the rightmost directory name from a path:

basename path/to/directory

Show only the file name from a path, with a suffix removed:

basename path/to/file suffix
ngl, credit where credit is due: The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Also please note that, as uutils is a work in progress, some examples might fail. πŸ™ˆ not her fault, she's growing. πŸ’€

and that's the whole page, no crumbs left. πŸ“

this was BASENAME(1) from the v(uutils coreutils) 0.12.0 era, dated 2026-09-25. go forth and strip those directory components, you absolute main character. periodt. πŸ’–βœ¨πŸ‘‘
πŸ“¦ where this page comes from