Multiple choice technology programming languages

Which file test can be done to see if a file exists and has a nonzero size?

  1. -s

  2. -l

  3. -S

  4. -k

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The -s file test operator returns true if the file exists AND has a size greater than zero. This combines both existence and non-empty checks. The -l operator tests for symbolic links, -S for sockets, and -k for the sticky bit.