Basename

Why Trust Techopedia

What Does Basename Mean?

A basename is the name of a directory in a Unix pathname that occurs after the last slash. It is also the name of a standard utility on Unix-like systems that returns the basename when given a Unix pathname. This program is part of the Single Unix Specification and installed on nearly every system, including most Linux distributions.

Advertisements

Techopedia Explains Basename

A basename is the last directory in a Unix path after the last slash. For example, in the pathname /usr/share/techopedia, the basename would be “techopedia.” There is also a utility called basename that returns the basename of a directory when given a pathname. It is frequently used in shell scripts for convenience. The major scripting languages, including Perl and Python, also have the capability to generate basenames through libraries.

A companion utility, dirname, returns everything but the final basename in a pathname. Both of these utilities are part of the Single Unix Specification. Even though Linux is not part of the Single Unix Specification, almost all distributions include dirname and basename as part of GNU Coreutils. Similarly, the free BSD systems also include these utilities.

Advertisements

Related Terms

Margaret Rouse
Technology expert
Margaret Rouse
Technology expert

Margaret is an award-winning writer and educator known for her ability to explain complex technical topics to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles in the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret’s idea of ​​a fun day is to help IT and business professionals to learn to speak each other’s highly specialized languages.