Aug 17, 2011
tom

What is /usr/bin/[?

Question

I was just poking around in /usr/bin and I found an ELF binary file called [. /usr/bin/[. I have never heard of this file and my first thought was that it was a clever way of hiding a program, possibly a trojan. However it's present on all my CentOS servers and seems to have no manual entry. I can hazard a guess as to what it is but I was looking for a more authoritative answer...

Answer

It's an alternative form of the 'test' command. Mostly used in scripts.

i.e.

if [ $VAR ]
then
    echo $VAR exists!
fi

Related posts:

  1. Strangeness using /usr/xpg4/bin/tr and /usr/bin/tr on Solaris 9
  2. Can I place my script in /usr/bin?
  3. Differences between linux and Solaris /usr/bin/env
  4. How do I reset ownership of /usr/bin/sudo on Linux?
  5. why should I chmod 511 /usr/local/apache/bin/httpd?

Leave a comment