from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites:gentoo.linuxhowtos.org



Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs

words:

887

views:

209583

userrating:


May 25th. 2007:
Words

486

Views

258591

why adblockers are bad


Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

words:

161

views:

149881

userrating:


April, 26th. 2006:

Druckversion
You are here: manpages





TEST

Section: User Commands (1)
Updated: February 2026
Index Return to Main Contents
 

NAME

test - check file types and compare values  

SYNOPSIS

test EXPRESSION
test
[ EXPRESSION ]
[ ]
[ OPTION  

DESCRIPTION

Exit with the status determined by EXPRESSION.

X'tty: link https://www.gnu.org/software/coreutils/test#tes-help'--helpX'tty: link'
display this help and exit
X'tty: link https://www.gnu.org/software/coreutils/test#tes-version'--versionX'tty: link'
output version information and exit

An omitted EXPRESSION defaults to false. Otherwise, EXPRESSION is true or false and sets exit status. It is one of:

( EXPRESSION )
EXPRESSION is true
! EXPRESSION
EXPRESSION is false
EXPRESSION1 -a EXPRESSION2
both EXPRESSION1 and EXPRESSION2 are true
EXPRESSION1 -o EXPRESSION2
either EXPRESSION1 or EXPRESSION2 is true
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-n'-n STRINGX'tty: link'
the length of STRING is nonzero
STRING
equivalent to -n STRING
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-z'-z STRINGX'tty: link'
the length of STRING is zero
STRING1 = STRING2
the strings are equal
STRING1 != STRING2
the strings are not equal
STRING1 > STRING2
STRING1 is greater than STRING2 in the current locale
STRING1 < STRING2
STRING1 is less than STRING2 in the current locale
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-eq'INTEGER1 -eq INTEGER2X'tty: link'
INTEGER1 is equal to INTEGER2
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-ge'INTEGER1 -ge INTEGER2X'tty: link'
INTEGER1 is greater than or equal to INTEGER2
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-gt'INTEGER1 -gt INTEGER2X'tty: link'
INTEGER1 is greater than INTEGER2
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-le'INTEGER1 -le INTEGER2X'tty: link'
INTEGER1 is less than or equal to INTEGER2
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-lt'INTEGER1 -lt INTEGER2X'tty: link'
INTEGER1 is less than INTEGER2
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-ne'INTEGER1 -ne INTEGER2X'tty: link'
INTEGER1 is not equal to INTEGER2
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-ef'FILE1 -ef FILE2X'tty: link'
FILE1 and FILE2 have the same device and inode numbers
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-nt'FILE1 -nt FILE2X'tty: link'
FILE1 is newer (modification date) than FILE2
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-ot'FILE1 -ot FILE2X'tty: link'
FILE1 is older than FILE2
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-b'-b FILEX'tty: link'
FILE exists and is block special
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-c'-c FILEX'tty: link'
FILE exists and is character special
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-d'-d FILEX'tty: link'
FILE exists and is a directory
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-e'-e FILEX'tty: link'
FILE exists
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-f'-f FILEX'tty: link'
FILE exists and is a regular file
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-g'-g FILEX'tty: link'
FILE exists and is set-group-ID
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-G'-G FILEX'tty: link'
FILE exists and is owned by the effective group ID
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-h'-h FILEX'tty: link'
FILE exists and is a symbolic link (same as -L)
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-k'-k FILEX'tty: link'
FILE exists and has its sticky bit set
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-L'-L FILEX'tty: link'
FILE exists and is a symbolic link (same as -h)
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-N'-N FILEX'tty: link'
FILE exists and has been modified since it was last read
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-O'-O FILEX'tty: link'
FILE exists and is owned by the effective user ID
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-p'-p FILEX'tty: link'
FILE exists and is a named pipe
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-r'-r FILEX'tty: link'
FILE exists and the user has read access
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-s'-s FILEX'tty: link'
FILE exists and has a size greater than zero
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-S'-S FILEX'tty: link'
FILE exists and is a socket
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-t'-t FDX'tty: link'
file descriptor FD is opened on a terminal
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-u'-u FILEX'tty: link'
FILE exists and its set-user-ID bit is set
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-w'-w FILEX'tty: link'
FILE exists and the user has write access
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#tes-x'-x FILEX'tty: link'
FILE exists and the user has execute (or search) access

Except for -h and -L, all FILE-related tests dereference symbolic links. Beware that parentheses need to be escaped (e.g., by backslashes) for shells. INTEGER may also be -l STRING, which evaluates to the length of STRING.

Binary -a and -o are ambiguous. Use 'test EXPR1 && test EXPR2' or 'test EXPR1 || test EXPR2' instead.

'[' honors --help and --version, but 'test' treats them as STRINGs.

Your shell may have its own version of test and/or [, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports.  

AUTHOR

Written by Kevin Braunsdorf and Matthew Bradburn.  

REPORTING BUGS

Report bugs to: bug-coreutils@gnu.org


Report Gentoo bugs to: https://bugs.gentoo.org/
GNU coreutils home page: <https://www.gnu.org/software/coreutils/>
General help using GNU software: <https://www.gnu.org/gethelp/>
Report any translation bugs to <https://translationproject.org/team/>  

SEE ALSO

access(2)


Full documentation <https://www.gnu.org/software/coreutils/test>
or available locally via: info aq(coreutils) test invocationaq


Packaged by Gentoo (9.10 (p0))
Copyright © 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


 

Index

NAME
SYNOPSIS
DESCRIPTION
AUTHOR
REPORTING BUGS
SEE ALSO





Support us on Content Nation
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 14.0 ms