Skip to main content

The basename command strips directory information and suffixes from file names.

# To show only the file name from a path:
basename <path/to/file>

# To show only the file name from a path, with a suffix removed:
basename <path/to/file> <suffix>