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:  your shell may have its own version of test and/or [, which usu‐
142       ally supersedes the version  described  here.   Please  refer  to  your
143       shell's documentation for details about the options it supports.
144

AUTHOR

146       Written by Kevin Braunsdorf and Matthew Bradburn.
147

REPORTING BUGS

149       Report bugs to <bug-coreutils@gnu.org>.
150
152       Copyright © 2007 Free Software Foundation, Inc.
153       This  is  free  software.   You may redistribute copies of it under the
154       terms      of      the      GNU      General       Public       License
155       <http://www.gnu.org/licenses/gpl.html>.   There  is NO WARRANTY, to the
156       extent permitted by law.
157

SEE ALSO

159       The full documentation for test is maintained as a Texinfo manual.   If
160       the  info  and  test  programs are properly installed at your site, the
161       command
162
163              info test
164
165       should give you access to the complete manual.
166
167
168
169GNU coreutils 6.9                 March 2008                           TEST(1)
Impressum