🧀 Learn Linux

Advanced · Organize files

basename: Get the name at the end of the path

Put in free practice

Syntax

basename path [suffix]

Examples

basename /var/log/app.log .log

Usage and sandbox support

The specified suffix can be removed, suitable for constructing file names.

Hands-on exercises

Full documentation ↗

Related commands