test(1)
β¨ test(1) β the check-everything bestie β¨
okay so first things first, this is test from the General Commands Manual section 1, and she is that girl. π
She checks file types and compares values, and honestly? she's been carrying shell scripts on her back since forever. Let's get into it.
π NAME π
test β Check file types and compare values.
π¦ SYNOPSIS π¦
test [-h|--help] [-V|--version]
π DESCRIPTION π
Check file types and compare values.
that's it. that's the whole vibe. she looks at stuff and tells you yes or no. icon. π
πΈ OPTIONS πΈ
-h,--helpβ Print help π«Ά-V,--versionβ Print version β
π₯ EXTRA π₯
not me putting the actual main character behaviour in a section called EXTRA, but go off I guess
Exit with the status determined by EXPRESSION.
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 falseEXPRESSION1 -a EXPRESSION2β both EXPRESSION1 and EXPRESSION2 are trueEXPRESSION1 -o EXPRESSION2β either EXPRESSION1 or EXPRESSION2 is true
π String operations:
-n STRINGβ the length of STRING is nonzeroSTRINGβ equivalent to-n STRING-z STRINGβ the length of STRING is zeroSTRING1 = STRING2β the strings are equalSTRING1 != STRING2β the strings are not equalSTRING1 > STRING2β STRING1 is greater than STRING2 in the current localeSTRING1 < STRING2β STRING1 is less than STRING2 in the current locale
π Integer comparisons:
INTEGER1 -eq INTEGER2β INTEGER1 is equal to INTEGER2INTEGER1 -ge INTEGER2β INTEGER1 is greater than or equal to INTEGER2INTEGER1 -gt INTEGER2β INTEGER1 is greater than INTEGER2INTEGER1 -le INTEGER2β INTEGER1 is less than or equal to INTEGER2INTEGER1 -lt INTEGER2β INTEGER1 is less than INTEGER2INTEGER1 -ne INTEGER2β INTEGER1 is not equal to INTEGER2
π§ File operations:
FILE1 -ef FILE2β FILE1 and FILE2 have the same device and inode numbersFILE1 -nt FILE2β FILE1 is newer (modification date) than FILE2FILE1 -ot FILE2β FILE1 is older than FILE2-b FILEβ FILE exists and is block special-c FILEβ FILE exists and is character special-d FILEβ FILE exists and is a directory-e FILEβ FILE exists-f FILEβ FILE exists and is a regular file-g FILEβ FILE exists and is set-group-ID-G FILEβ FILE exists and is owned by the effective group ID-h FILEβ FILE exists and is a symbolic link (same as-L)-k FILEβ FILE exists and has its sticky bit set-L FILEβ FILE exists and is a symbolic link (same as-h)-N FILEβ FILE exists and has been modified since it was last read-O FILEβ FILE exists and is owned by the effective user ID-p FILEβ FILE exists and is a named pipe-r FILEβ FILE exists and read permission is granted-s FILEβ FILE exists and has a size greater than zero-S FILEβ FILE exists and is a socket-t FDβ file descriptor FD is opened on a terminal-u FILEβ FILE exists and its set-user-ID bit is set-w FILEβ FILE exists and write permission is granted-x FILEβ FILE exists and execute (or search) permission is granted
Except for -h and -L, all FILE-related tests dereference (follow) 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.
β οΈ NOTE: Binary-aand-oare inherently ambiguous. Usetest EXPR1 && test EXPR2ortest EXPR1 || test EXPR2instead. fr fr, don't be messy with it. π
β οΈ NOTE:[honors the--helpand--versionoptions, buttestdoes not.testtreats each of those as it treats any other nonempty STRING. the audacity, honestly. π
β οΈ NOTE: your shell may have its own version oftestand/or[, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports. she's not jealous, she's just saying. π
π VERSION π
v(uutils coreutils) 0.7.0
and that's the whole page bestie π«Ά this was test (uutils coreutils) 0.7.0, page test(1), living in the General Commands Manual β go forth and exit with the correct status, you absolute icon π
β¨
π¦ where this page comes from
- epel 10: rust-coreutils-devel 0.7.0-10.el10_3 Β· MIT
- epel 10: uutils-coreutils 0.7.0-10.el10_3 Β· (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND Zlib AND (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception) AND (Apache-2.0 OR GPL-2.0-only) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-2-Clause AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND CC0-1.0 AND ISC AND MIT AND (MIT OR Zlib OR Apache-2.0) AND (MIT-0 OR Apache-2.0) AND Unicode-3.0 AND (Unlicense OR MIT)
- fedora 43: rust-coreutils-devel 0.7.0-12.fc43 Β· MIT
- fedora 43: uutils-coreutils 0.7.0-12.fc43 Β· (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND Zlib AND (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception) AND (Apache-2.0 OR GPL-2.0-only) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-2-Clause AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND CC0-1.0 AND ISC AND MIT AND (MIT OR Zlib OR Apache-2.0) AND (MIT-0 OR Apache-2.0) AND Unicode-3.0 AND (Unlicense OR MIT)
- fedora 44: rust-coreutils-devel 0.7.0-4.fc44 Β· MIT
- fedora 44: uutils-coreutils 0.7.0-4.fc44 Β· (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND Zlib AND (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception) AND (Apache-2.0 OR GPL-2.0-only) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-2-Clause AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND CC0-1.0 AND ISC AND MIT AND (MIT OR Zlib OR Apache-2.0) AND (MIT-0 OR Apache-2.0) AND Unicode-3.0 AND (Unlicense OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms