Name

basename

Synopsis

basename name [suffix]

basename option

Description

Remove leading directory components from a path. If suffix is given, remove that also. The result is printed to standard output.

Options

--help

Print help message and then exit.

--version

Print the version number and then exit.

Examples

% basename /usr/lib/libm.a
libm.a

% basename /usr/lib/libm.a .a
libm

Get Linux in a Nutshell, Third 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.