Enter image description here

See the screen shot.

There is the '[' file at /bin.

What is the '[' file? What does it do?


This command is for comparing values, checking file types etc.

Here's a man page:

 test, [ -- condition evaluation utility

 test expression
 [ expression ]

It's usually used like this:

if [ -f /etc/passwd ] 
   echo "Yes"
   echo "No"  

For more info, please read the man page ( man [ ).

  • 6
    It's worth noting that the default shell likely has its own builtin version of the [ command that will run instead of the one in /bin. The one in /bin is likely only for compatibility and for particularly minimalist shells. – Muzer Dec 29 '16 at 11:32
  • Actually, the command, [ on the filesystem, exists for POSIX compliance (IEEE Std 1003.2 (``POSIX.2'')) and not for compatibility or particularly minimalist shells. – Christopher Feb 19 at 12:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .