[basename] Get the final filename component of a path

Created on November 30, 2026

Use basename to extract the last component of a path. This example takes a filename from an absolute path.

basename '/home/user/report.txt'
report.txt
Shell command