Debian Codegraph @

upstream/debian-trixie/man1/test.1

raw
1 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.50.1.
2 .TH TEST "1" "June 2025" "GNU coreutils 9.7" "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 \fB\-\-help\fR
26 display this help and exit
27 .TP
28 \fB\-\-version\fR
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 \fB\-n\fR STRING
47 the length of STRING is nonzero
48 .TP
49 STRING
50 equivalent to \fB\-n\fR STRING
51 .TP
52 \fB\-z\fR STRING
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 INTEGER1 \fB\-eq\fR INTEGER2
68 INTEGER1 is equal to INTEGER2
69 .TP
70 INTEGER1 \fB\-ge\fR INTEGER2
71 INTEGER1 is greater than or equal to INTEGER2
72 .TP
73 INTEGER1 \fB\-gt\fR INTEGER2
74 INTEGER1 is greater than INTEGER2
75 .TP
76 INTEGER1 \fB\-le\fR INTEGER2
77 INTEGER1 is less than or equal to INTEGER2
78 .TP
79 INTEGER1 \fB\-lt\fR INTEGER2
80 INTEGER1 is less than INTEGER2
81 .TP
82 INTEGER1 \fB\-ne\fR INTEGER2
83 INTEGER1 is not equal to INTEGER2
84 .TP
85 FILE1 \fB\-ef\fR FILE2
86 FILE1 and FILE2 have the same device and inode numbers
87 .TP
88 FILE1 \fB\-nt\fR FILE2
89 FILE1 is newer (modification date) than FILE2
90 .TP
91 FILE1 \fB\-ot\fR FILE2
92 FILE1 is older than FILE2
93 .TP
94 \fB\-b\fR FILE
95 FILE exists and is block special
96 .TP
97 \fB\-c\fR FILE
98 FILE exists and is character special
99 .TP
100 \fB\-d\fR FILE
101 FILE exists and is a directory
102 .TP
103 \fB\-e\fR FILE
104 FILE exists
105 .TP
106 \fB\-f\fR FILE
107 FILE exists and is a regular file
108 .TP
109 \fB\-g\fR FILE
110 FILE exists and is set\-group\-ID
111 .TP
112 \fB\-G\fR FILE
113 FILE exists and is owned by the effective group ID
114 .TP
115 \fB\-h\fR FILE
116 FILE exists and is a symbolic link (same as \fB\-L\fR)
117 .TP
118 \fB\-k\fR FILE
119 FILE exists and has its sticky bit set
120 .TP
121 \fB\-L\fR FILE
122 FILE exists and is a symbolic link (same as \fB\-h\fR)
123 .TP
124 \fB\-N\fR FILE
125 FILE exists and has been modified since it was last read
126 .TP
127 \fB\-O\fR FILE
128 FILE exists and is owned by the effective user ID
129 .TP
130 \fB\-p\fR FILE
131 FILE exists and is a named pipe
132 .TP
133 \fB\-r\fR FILE
134 FILE exists and the user has read access
135 .TP
136 \fB\-s\fR FILE
137 FILE exists and has a size greater than zero
138 .TP
139 \fB\-S\fR FILE
140 FILE exists and is a socket
141 .TP
142 \fB\-t\fR FD
143 file descriptor FD is opened on a terminal
144 .TP
145 \fB\-u\fR FILE
146 FILE exists and its set\-user\-ID bit is set
147 .TP
148 \fB\-w\fR FILE
149 FILE exists and the user has write access
150 .TP
151 \fB\-x\fR FILE
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 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
170 .br
171 Report any translation bugs to <https://translationproject.org/team/>
172 .SH "SEE ALSO"
173 \fBaccess\fP(2)
174 .PP
175 .br
176 Full documentation <https://www.gnu.org/software/coreutils/test>
177 .br
178 or available locally via: info \(aq(coreutils) test invocation\(aq
179 .PP
180 .br
181 Packaged by Debian (9.7\-3)
182 .br
183 Copyright \(co 2025 Free Software Foundation, Inc.
184 .br
185 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
186 .br
187 This is free software: you are free to change and redistribute it.
188 .br
189 There is NO WARRANTY, to the extent permitted by law.