basename do?strip the directory (and optionally a suffix) from a path, leaving the file name.
▸ Explain your own basename command →$ basename /usr/bin/sort
$ basename -s .txt notes.txt
$ basename -a src/a.c src/b.c
| -a | treat every argument as a name to strip (process multiple) |
| -s | remove the given trailing suffix from the name |
| -z | end each output line with NUL instead of a newline |
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.