Name
basename — stdin stdout - file -- opt --help --version
Synopsis
basenamepath
[suffix
]
The basename
command prints
the final component in a file path:
$ basename /users/smith/finances/money.txt money.txt
If you provide an optional suffix, it gets stripped from the result:
$ basename /users/smith/finances/money.txt .txt money
Get Linux Pocket Guide, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.