On this page you find all important commands for the CLI tool dirname. If the
command you are looking for is missing please ask our AI.
dirname
The dirname
command line tool is used to extract the directory path from a given file or directory path. It removes the last component of the path and returns the remaining parent directory path.
Here's an example usage:
$ dirname /path/to/file.txt
/path/to
In this example, the dirname
command extracts the directory part from the file path /path/to/file.txt
, leaving the path /path/to
.
The dirname
command can be useful when writing scripts or performing certain operations on file or directory paths, as it allows you to extract and manipulate the directory portion separately from the filename or last component of the path.
List of commands for dirname:
-
dirname:tldr:59ef2 dirname: Calculate the parent directory of multiple paths.$ dirname ${filename_a} ${path-to-directory_b}try on your machineexplain this command
-
dirname:tldr:6b06f dirname: Delimit output with a NUL character instead of a newline (useful when combining with `xargs`).$ dirname --zero ${path-to-directory_a} ${filename_b}try on your machineexplain this command
-
dirname:tldr:d4258 dirname: Calculate the parent directory of a given path.$ dirname ${filename_or_directory}try on your machineexplain this command