---

Linux basename Command Tutorial for Beginners (with Examples)

Sometimes, while working on the command line (especially when dealing with shell scripts), you might be interested in only the filename, but what’s available to you is the complete path of the file. So, the requirement is to strip the directory component of the path. You’ll be glad to know there exists a command – basename – that does this job.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis