test(1)

πŸ“¦
version 0.7.0 Β· 3 versions
, in epel 10, fedora 43, fedora 44

✨ 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 false
  • EXPRESSION1 -a EXPRESSION2 β€” both EXPRESSION1 and EXPRESSION2 are true
  • EXPRESSION1 -o EXPRESSION2 β€” either EXPRESSION1 or EXPRESSION2 is true

πŸ“ String operations:

  • -n STRING β€” the length of STRING is nonzero
  • STRING β€” equivalent to -n STRING
  • -z STRING β€” 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

πŸ’œ Integer comparisons:

  • INTEGER1 -eq INTEGER2 β€” INTEGER1 is equal to INTEGER2
  • INTEGER1 -ge INTEGER2 β€” INTEGER1 is greater than or equal to INTEGER2
  • INTEGER1 -gt INTEGER2 β€” INTEGER1 is greater than INTEGER2
  • INTEGER1 -le INTEGER2 β€” INTEGER1 is less than or equal to INTEGER2
  • INTEGER1 -lt INTEGER2 β€” INTEGER1 is less than INTEGER2
  • INTEGER1 -ne INTEGER2 β€” INTEGER1 is not equal to INTEGER2

🧚 File operations:

  • FILE1 -ef FILE2 β€” FILE1 and FILE2 have the same device and inode numbers
  • FILE1 -nt FILE2 β€” FILE1 is newer (modification date) than FILE2
  • FILE1 -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 -a and -o are inherently ambiguous. Use test EXPR1 && test EXPR2 or test EXPR1 || test EXPR2 instead. fr fr, don't be messy with it. 😭
⚠️ NOTE: [ honors the --help and --version options, but test does not. test treats each of those as it treats any other nonempty STRING. the audacity, honestly. πŸ’€
⚠️ NOTE: 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. 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