ELI5: Explain Like I'm 5

Test (Unix)

In Unix, a test is like asking a question to see if something is true or false. Just like when you ask a question in class and the teacher says "yes" or "no", when you ask a test question in Unix, it will give you a result of either "true" or "false".

For example, you could ask Unix, "Is the file named 'story.txt' in this folder?" If it is, Unix will answer with "true" and if it's not, Unix will answer with "false".

Test can be used to check if a file exists, if it's readable or writeable, if it's a certain type of file, and many other things!

There are different types of tests you can use, like the "-e" test, which checks if a file exists, or the "-f" test, which checks if a file is a regular file (not a directory or device file).

Basically, test is a way to ask Unix a question about a file or directory and get a "true" or "false" answer back.
Related topics others have asked about: