TEST(1)
π TEST(1) β the check-file-types-and-compare-values girlies β¨
ok so this is test from the General Commands Manual, and bestie, she is foundational. Every if you've ever written? She's behind it. Let's get into it π«Ά
β¨ NAME β¨
test β check file types and compare values. that's it. that's the whole job. and she does it flawlessly. π
π¦ SYNOPSIS π¦
test EXPRESSION
test
[ EXPRESSION ]
[ ]
[ OPTION
look at her four whole forms. main character energy fr fr π
πΈ DESCRIPTION πΈ
Check file types and compare values.
like... yes. that's the vibe. she checks file types. she compares values. she does not elaborate. iconique π
π OPTIONS π
-h,--helpβ Print help. your little "what do i do" moment π₯Ί-V,--versionβ Print version. so you know exactly which girl you're dealing with π
π₯ EXTRA π₯
Exit with the status determined by EXPRESSION. that's her whole thing β she doesn't print stuff, she just sets exit status and dips. lowkey the most powerful move honestly.
An omitted EXPRESSION defaults to false. so test with nothing? false. [ ]? also false. yes bestie, that's real, no cap.
Otherwise, EXPRESSION is true or false and sets exit status. It is one of:
π§ the logic-y ones
( EXPRESSION )β EXPRESSION is true. grouping!! but read the warning below about escaping, ok? π! EXPRESSIONβ EXPRESSION is false. the "not" girlie β¨EXPRESSION1 -a EXPRESSION2β both EXPRESSION1 and EXPRESSION2 are true. and!! both!! π«ΆEXPRESSION1 -o EXPRESSION2β either EXPRESSION1 or EXPRESSION2 is true. or!! either!! π
π String operations:
-n STRINGβ the length of STRING is nonzero. she has β¨contentβ¨STRINGβ equivalent to-n STRING. so you can just say the thing. so chill of her.-z STRINGβ the length of STRING is zero. empty. nothing. a void. πSTRING1 = STRING2β the strings are equal. twins!! π―STRING1 != STRING2β the strings are not equal. not twins. πSTRING1 > STRING2β STRING1 is greater than STRING2 in the current locale. yes, locale matters, it's giving "it depends" πSTRING1 < STRING2β STRING1 is less than STRING2 in the current locale. same deal, locale girlie π
π 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
six of them. all accounted for. math ate. π₯
π¦ File operations:
FILE1 -ef FILE2β FILE1 and FILE2 have the same device and inode numbers. literally the same file, spiritually and technically π«FILE1 -nt FILE2β FILE1 is newer (modification date) than FILE2. fresh out the oven πFILE1 -ot FILE2β FILE1 is older than FILE2. vintage. antique. π°οΈ-b FILEβ FILE exists and is block special-c FILEβ FILE exists and is character special-d FILEβ FILE exists and is a directory. folder energy π-e FILEβ FILE exists. she's there. she's real. π-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. she has substance π-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
okay and here's the fine print, and bestie you need to hear it:
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. your shell is gonna eat them otherwise and you'll be so confused. π
INTEGER may also be -l STRING, which evaluates to the length of STRING. sneaky but valid β¨
NOTE: Binary-aand-oare inherently ambiguous. Usetest EXPR1 && test EXPR2ortest EXPR1 || test EXPR2instead. no cap, the binary ones are a trap β do the split version, future you will thank you π
NOTE:[honors the--helpand--versionoptions, buttestdoes not.testtreats each of those as it treats any other nonempty STRING. sotest --versionis just... a string that exists. she said "not today" π
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. iykyk β check your shell's docs, bestie π§
And one more genuinely cute detail: Errors are reported with the expression echoed back and a caret under the argument at fault whenever stderr is a terminal. like she's pointing at it. she's literally going "this one. right here." π― anything else reading stderr gets the usual single-line message.
π VERSION π
v(uutils coreutils) 0.12.0
and that's the whole page, bestie!! π slay, go write some conditionals β and remember, this was v(uutils coreutils) 0.12.0, dated 2026-09-17, from your General Commands Manual. mwah π«Άβ¨ππΈ
π¦ where this page comes from
- arch rolling: uutils-coreutils 0.12.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms