How To Install Dirname?

How To Install Dirname?

dirname

Calculates the parent directory of a given file or directory path.

Maintainer: Michael Stone



Section: utils

Install dirname

  • Debian apt-get install coreutils Click to copy
  • Ubuntu apt-get install coreutils Click to copy
  • Alpine OS apk add coreutils Click to copy
  • Arch Linux pacman -S coreutils Click to copy
  • Kali Linux apt-get install coreutils Click to copy
  • CentOS yum install coreutils Click to copy
  • Fedora dnf install coreutils Click to copy
  • Raspbian apt-get install coreutils Click to copy
  • macOS brew install coreutils Click to copy

Calculates the parent directory of a given file or directory path.

How to use dirname?

Below are few example commands for dirname that you can use in the terminal.

Calculate the parent directory of a given path:
dirname path/to/file_or_directoryClick to copy
Calculate the parent directory of multiple paths:
dirname path/to/file_a path/to/directory_bClick to copy
Delimit output with a NUL character instead of a newline (useful when combining with `xargs`):
dirname --zero path/to/directory_a path/to/file_bClick to copy
Install the latest version of dirname in Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian and macOS from terminal. To install the dirname just copy the above command for your OS and run into terminal. After you run the command it will grab the latest version of dirname from the respository and install it in your computer/server.