Debian Codegraph @

upstream/debian-unstable/man1/test.1

raw
1 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.50.1.
2 .TH TEST "1" "February 2026" "GNU coreutils 9.10" "User Commands"
3 .SH NAME
4 test \- check file types and compare values
5 .SH SYNOPSIS
6 .B test
7 .I EXPRESSION
8 .br
9 .B test
10 .br
11 .\" \& tells doclifter the brackets are literal (Bug#31803).
12 .B [\&
13 .I EXPRESSION
14 .B ]\&
15 .br
16 .B "[\& ]\&"
17 .br
18 .B [\&
19 .I OPTION
20 .SH DESCRIPTION
21 .\" Add any additional description here
22 .PP
23 Exit with the status determined by EXPRESSION.
24 .TP
25 \X'tty: link https://www.gnu.org/software/coreutils/test#test--help'\fB\-\-help\fP\X'tty: link'
26 display this help and exit
27 .TP
28 \X'tty: link https://www.gnu.org/software/coreutils/test#test--version'\fB\-\-version\fP\X'tty: link'
29 output version information and exit
30 .PP
31 An omitted EXPRESSION defaults to false. Otherwise,
32 EXPRESSION is true or false and sets exit status. It is one of:
33 .TP
34 ( EXPRESSION )
35 EXPRESSION is true
36 .TP
37 ! EXPRESSION
38 EXPRESSION is false
39 .TP
40 EXPRESSION1 \fB\-a\fR EXPRESSION2
41 both EXPRESSION1 and EXPRESSION2 are true
42 .TP
43 EXPRESSION1 \fB\-o\fR EXPRESSION2
44 either EXPRESSION1 or EXPRESSION2 is true
45 .TP
46 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-n'\fB\-n STRING\fP\X'tty: link'
47 the length of STRING is nonzero
48 .TP
49 STRING
50 equivalent to \fB\-n\fR STRING
51 .TP
52 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-z'\fB\-z STRING\fP\X'tty: link'
53 the length of STRING is zero
54 .TP
55 STRING1 = STRING2
56 the strings are equal
57 .TP
58 STRING1 != STRING2
59 the strings are not equal
60 .TP
61 STRING1 > STRING2
62 STRING1 is greater than STRING2 in the current locale
63 .TP
64 STRING1 < STRING2
65 STRING1 is less than STRING2 in the current locale
66 .TP
67 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-eq'\fBINTEGER1 \-eq INTEGER2\fP\X'tty: link'
68 INTEGER1 is equal to INTEGER2
69 .TP
70 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-ge'\fBINTEGER1 \-ge INTEGER2\fP\X'tty: link'
71 INTEGER1 is greater than or equal to INTEGER2
72 .TP
73 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-gt'\fBINTEGER1 \-gt INTEGER2\fP\X'tty: link'
74 INTEGER1 is greater than INTEGER2
75 .TP
76 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-le'\fBINTEGER1 \-le INTEGER2\fP\X'tty: link'
77 INTEGER1 is less than or equal to INTEGER2
78 .TP
79 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-lt'\fBINTEGER1 \-lt INTEGER2\fP\X'tty: link'
80 INTEGER1 is less than INTEGER2
81 .TP
82 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-ne'\fBINTEGER1 \-ne INTEGER2\fP\X'tty: link'
83 INTEGER1 is not equal to INTEGER2
84 .TP
85 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-ef'\fBFILE1 \-ef FILE2\fP\X'tty: link'
86 FILE1 and FILE2 have the same device and inode numbers
87 .TP
88 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-nt'\fBFILE1 \-nt FILE2\fP\X'tty: link'
89 FILE1 is newer (modification date) than FILE2
90 .TP
91 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-ot'\fBFILE1 \-ot FILE2\fP\X'tty: link'
92 FILE1 is older than FILE2
93 .TP
94 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-b'\fB\-b FILE\fP\X'tty: link'
95 FILE exists and is block special
96 .TP
97 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-c'\fB\-c FILE\fP\X'tty: link'
98 FILE exists and is character special
99 .TP
100 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-d'\fB\-d FILE\fP\X'tty: link'
101 FILE exists and is a directory
102 .TP
103 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-e'\fB\-e FILE\fP\X'tty: link'
104 FILE exists
105 .TP
106 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-f'\fB\-f FILE\fP\X'tty: link'
107 FILE exists and is a regular file
108 .TP
109 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-g'\fB\-g FILE\fP\X'tty: link'
110 FILE exists and is set\-group\-ID
111 .TP
112 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-G'\fB\-G FILE\fP\X'tty: link'
113 FILE exists and is owned by the effective group ID
114 .TP
115 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-h'\fB\-h FILE\fP\X'tty: link'
116 FILE exists and is a symbolic link (same as \fB\-L\fR)
117 .TP
118 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-k'\fB\-k FILE\fP\X'tty: link'
119 FILE exists and has its sticky bit set
120 .TP
121 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-L'\fB\-L FILE\fP\X'tty: link'
122 FILE exists and is a symbolic link (same as \fB\-h\fR)
123 .TP
124 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-N'\fB\-N FILE\fP\X'tty: link'
125 FILE exists and has been modified since it was last read
126 .TP
127 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-O'\fB\-O FILE\fP\X'tty: link'
128 FILE exists and is owned by the effective user ID
129 .TP
130 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-p'\fB\-p FILE\fP\X'tty: link'
131 FILE exists and is a named pipe
132 .TP
133 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-r'\fB\-r FILE\fP\X'tty: link'
134 FILE exists and the user has read access
135 .TP
136 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-s'\fB\-s FILE\fP\X'tty: link'
137 FILE exists and has a size greater than zero
138 .TP
139 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-S'\fB\-S FILE\fP\X'tty: link'
140 FILE exists and is a socket
141 .TP
142 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-t'\fB\-t FD\fP\X'tty: link'
143 file descriptor FD is opened on a terminal
144 .TP
145 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-u'\fB\-u FILE\fP\X'tty: link'
146 FILE exists and its set\-user\-ID bit is set
147 .TP
148 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-w'\fB\-w FILE\fP\X'tty: link'
149 FILE exists and the user has write access
150 .TP
151 \X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-x'\fB\-x FILE\fP\X'tty: link'
152 FILE exists and the user has execute (or search) access
153 .PP
154 Except for \fB\-h\fR and \fB\-L\fR, all FILE\-related tests dereference symbolic links.
155 Beware that parentheses need to be escaped (e.g., by backslashes) for shells.
156 INTEGER may also be \fB\-l\fR STRING, which evaluates to the length of STRING.
157 .PP
158 Binary \fB\-a\fR and \fB\-o\fR are ambiguous. Use 'test EXPR1 && test EXPR2'
159 or 'test EXPR1 || test EXPR2' instead.
160 .PP
161 \&'[' honors \fB\-\-help\fR and \fB\-\-version\fR, but 'test' treats them as STRINGs.
162 .PP
163 Your shell may have its own version of test and/or [, which usually supersedes
164 the version described here. Please refer to your shell's documentation
165 for details about the options it supports.
166 .SH AUTHOR
167 Written by Kevin Braunsdorf and Matthew Bradburn.
168 .SH "REPORTING BUGS"
169 Report bugs to: bug\[email protected]
170 .br
171 GNU coreutils home page: <https://www.gnu.org/software/coreutils/>
172 .br
173 General help using GNU software: <https://www.gnu.org/gethelp/>
174 .br
175 Report any translation bugs to <https://translationproject.org/team/>
176 .SH "SEE ALSO"
177 \fBaccess\fP(2)
178 .PP
179 .br
180 Full documentation <https://www.gnu.org/software/coreutils/test>
181 .br
182 or available locally via: info \(aq(coreutils) test invocation\(aq
183 .PP
184 .br
185 Packaged by Debian (9.10\-1)
186 .br
187 Copyright \(co 2026 Free Software Foundation, Inc.
188 .br
189 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
190 .br
191 This is free software: you are free to change and redistribute it.
192 .br
193 There is NO WARRANTY, to the extent permitted by law.