Advertisement

Basename

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.

Advertisement

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.

Advertisement

Share this Term

  • Facebook
  • LinkedIn
  • Twitter

Related Reading

Tags

Software

Trending Articles

Go back to top