1TEST(1)                          User Commands                         TEST(1)
2
3
4

NAME

6       test - check file types and compare values
7

SYNOPSIS

9       test EXPRESSION
10       test
11
12       [ EXPRESSION ]
13       [ ]
14       [ OPTION
15

DESCRIPTION

17       Exit with the status determined by EXPRESSION.
18
19       --help display this help and exit
20
21       --version
22              output version information and exit
23
24       An omitted EXPRESSION defaults to false.  Otherwise, EXPRESSION is true
25       or false and sets exit status.  It is one of:
26
27       ( EXPRESSION )
28              EXPRESSION is true
29
30       ! EXPRESSION
31              EXPRESSION is false
32
33       EXPRESSION1 -a EXPRESSION2
34              both EXPRESSION1 and EXPRESSION2 are true
35
36       EXPRESSION1 -o EXPRESSION2
37              either EXPRESSION1 or EXPRESSION2 is true
38
39       -n STRING
40              the length of STRING is nonzero
41
42       STRING equivalent to -n STRING
43
44       -z STRING
45              the length of STRING is zero
46
47       STRING1 = STRING2
48              the strings are equal
49
50       STRING1 != STRING2
51              the strings are not equal
52
53       INTEGER1 -eq INTEGER2
54              INTEGER1 is equal to INTEGER2
55
56       INTEGER1 -ge INTEGER2
57              INTEGER1 is greater than or equal to INTEGER2
58
59       INTEGER1 -gt INTEGER2
60              INTEGER1 is greater than INTEGER2
61
62       INTEGER1 -le INTEGER2
63              INTEGER1 is less than or equal to INTEGER2
64
65       INTEGER1 -lt INTEGER2
66              INTEGER1 is less than INTEGER2
67
68       INTEGER1 -ne INTEGER2
69              INTEGER1 is not equal to INTEGER2
70
71       FILE1 -ef FILE2
72              FILE1 and FILE2 have the same device and inode numbers
73
74       FILE1 -nt FILE2
75              FILE1 is newer (modification date) than FILE2
76
77       FILE1 -ot FILE2
78              FILE1 is older than FILE2
79
80       -b FILE
81              FILE exists and is block special
82
83       -c FILE
84              FILE exists and is character special
85
86       -d FILE
87              FILE exists and is a directory
88
89       -e FILE
90              FILE exists
91
92       -f FILE
93              FILE exists and is a regular file
94
95       -g FILE
96              FILE exists and is set-group-ID
97
98       -G FILE
99              FILE exists and is owned by the effective group ID
100
101       -h FILE
102              FILE exists and is a symbolic link (same as -L)
103
104       -k FILE
105              FILE exists and has its sticky bit set
106
107       -L FILE
108              FILE exists and is a symbolic link (same as -h)
109
110       -O FILE
111              FILE exists and is owned by the effective user ID
112
113       -p FILE
114              FILE exists and is a named pipe
115
116       -r FILE
117              FILE exists and read permission is granted
118
119       -s FILE
120              FILE exists and has a size greater than zero
121
122       -S FILE
123              FILE exists and is a socket
124
125       -t FD  file descriptor FD is opened on a terminal
126
127       -u FILE
128              FILE exists and its set-user-ID bit is set
129
130       -w FILE
131              FILE exists and write permission is granted
132
133       -x FILE
134              FILE exists and execute (or search) permission is granted
135
136       Except for -h and  -L,  all  FILE-related  tests  dereference  symbolic
137       links.   Beware  that  parentheses  need  to be escaped (e.g., by back‐
138       slashes) for shells.  INTEGER may also be -l STRING, which evaluates to
139       the length of STRING.
140
141       NOTE:  [  honors  the  --help and --version options, but test does not.
142       test treats each of those as it treats any other nonempty STRING.
143
144       NOTE: your shell may have its own version of test and/or [, which  usu‐
145       ally  supersedes  the  version  described  here.   Please refer to your
146       shell's documentation for details about the options it supports.
147

AUTHOR

149       Written by Kevin Braunsdorf and Matthew Bradburn.
150

REPORTING BUGS

152       Report test bugs to bug-coreutils@gnu.org
153       GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
154       General help using GNU software: <http://www.gnu.org/gethelp/>
155       Report test translation bugs to <http://translationproject.org/team/>
156
158       Copyright © 2010 Free Software Foundation, Inc.   License  GPLv3+:  GNU
159       GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
160       This  is  free  software:  you  are free to change and redistribute it.
161       There is NO WARRANTY, to the extent permitted by law.
162

SEE ALSO

164       The full documentation for test is maintained as a Texinfo manual.   If
165       the  info  and  test  programs are properly installed at your site, the
166       command
167
168              info coreutils 'test invocation'
169
170       should give you access to the complete manual.
171
172
173
174GNU coreutils 8.4                  June 2018                           TEST(1)
Impressum