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 basename translation bugs to <https://translationpro‐
52 ject.org/team/>
53
55 Copyright © 2018 Free Software Foundation, Inc. License GPLv3+: GNU
56 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
57 This is free software: you are free to change and redistribute it.
58 There is NO WARRANTY, to the extent permitted by law.
59
61 dirname(1), readlink(1)
62
63 Full documentation at: <https://www.gnu.org/software/coreutils/base‐
64 name>
65 or available locally via: info '(coreutils) basename invocation'
66
67
68
69GNU coreutils 8.30 July 2018 BASENAME(1)