shellspells beta

basename

basename NAME [SUFFIX]

basename prints NAME with any leading directory components removed.

Often used in shell scripts to strip the directory part of a file name.

Examples

Remove the directory

$ basename .gnome2/keyrings/default.keyring
default.keyring

Related commands: dirname