The dirname command in Bash

dirname is a UNIX-like OS program designed to convert an absolute or relative path to a file or directory into the name of the parent directory.
On this page

dirname is a UNIX-like OS program designed to convert an absolute or relative path to a file or directory into the name of the parent directory.

Syntax

1dirname string
  • string - path to file or directory

Example

1$ dirname ~/tests/1.txt
2/home/alimektor/tests

アリメクタ’s Blog

Watch. Read. Run. Repeat.

World’s Best Company Ask Me First

The first rule of Fight Club is: "You do not talk about Fight Club."

The second rule of Fight Club is: "You do not talk about Fight Club!"