basename (display filename only)
Removes the path from a complete filename. Can also remove the extension name.
Format: basename path/filename
Examples: basename /home/janet/file1.txt
basename /home/janet/file1.txt .txt
First example displays file1.txt. The second example displays file1.
Get Spring Into Linux® 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.