Name
dirname — stdin stdout - file -- opt --help --version
Synopsis
dirname path
The dirname
command, given a
file path, prints the name of the directory that contains
it:
➜ dirname /Users/smith/finances/money.txt
/Users/smith/finances
dirname
does not change your
current working directory, and it doesn’t care if the path exists. It
simply manipulates a file path string, just like basename
does.
Get Macintosh Terminal Pocket Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.