How to use the basename command

The basename command is a GNU core utility for UNIX and UNIX-like systems, and is designed to remove the file suffix and leading directories from a filename. It’s a reasonable alternative to at least some uses of the cut command. You’re not likely to use it alone, but it’s an interesting tool to have available to you when constructing a complex command.