1BASENAME(1) User Commands BASENAME(1)
2
3
4
6 basename - strip directory and suffix from filenames
7
9 basename NAME [SUFFIX]
10 basename OPTION... NAME...
11
13 Print NAME with any leading directory components removed. If speci‐
14 fied, also remove a trailing SUFFIX.
15
16 Mandatory arguments to long options are mandatory for short options
17 too.
18
19 -a, --multiple
20 support multiple arguments and treat each as a NAME
21
22 -s, --suffix=SUFFIX
23 remove a trailing SUFFIX; implies -a
24
25 -z, --zero
26 end each output line with NUL, not newline
27
28 --help display this help and exit
29
30 --version
31 output version information and exit
32
34 basename /usr/bin/sort
35 -> "sort"
36
37 basename include/stdio.h .h
38 -> "stdio"
39
40 basename -s .h include/stdio.h
41 -> "stdio"
42
43 basename -a any/str1 any/str2
44 -> "str1" followed by "str2"
45
47 Written by David MacKenzie.
48
50 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
51 Report any translation bugs to <https://translationproject.org/team/>
52
54 Copyright © 2019 Free Software Foundation, Inc. License GPLv3+: GNU
55 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
56 This is free software: you are free to change and redistribute it.
57 There is NO WARRANTY, to the extent permitted by law.
58
60 dirname(1), readlink(1)
61
62 Full documentation <https://www.gnu.org/software/coreutils/basename>
63 or available locally via: info '(coreutils) basename invocation'
64
65
66
67GNU coreutils 8.31 March 2019 BASENAME(1)