1DIRNAME(1) User Commands DIRNAME(1)
2
3
4
6 dirname - strip last component from file name
7
9 dirname [OPTION] NAME...
10
12 Output each NAME with its last non-slash component and trailing slashes
13 removed; if NAME contains no /'s, output '.' (meaning the current di‐
14 rectory).
15
16 -z, --zero
17 end each output line with NUL, not newline
18
19 --help display this help and exit
20
21 --version
22 output version information and exit
23
25 dirname /usr/bin/
26 -> "/usr"
27
28 dirname dir1/str dir2/str
29 -> "dir1" followed by "dir2"
30
31 dirname stdio.h
32 -> "."
33
35 Written by David MacKenzie and Jim Meyering.
36
38 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
39 Report any translation bugs to <https://translationproject.org/team/>
40
42 Copyright © 2023 Free Software Foundation, Inc. License GPLv3+: GNU
43 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
44 This is free software: you are free to change and redistribute it.
45 There is NO WARRANTY, to the extent permitted by law.
46
48 basename(1), readlink(1)
49
50 Full documentation <https://www.gnu.org/software/coreutils/dirname>
51 or available locally via: info '(coreutils) dirname invocation'
52
53
54
55GNU coreutils 9.3 September 2023 DIRNAME(1)