Skip to main content
InterviewHubPRO
Section Overview
Q7

Question 7 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

14%
Bash & Shell Scripting (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

What are the primary File Test Operators in Bash?

junior Levelbash-shellBasic

In Simple Words: Used in conditional checks to inspect files and directories:

  • [[ -f "$path" ]]: True if path exists and is a regular file.
  • [[ -d "$path" ]]: True if path exists and is a directory.
  • [[ -e "$path" ]]: True if path exists (any type: file, dir, socket, symlink).
  • [[ -s "$path" ]]: True if file exists and has size greater than zero (not empty).
  • [[ -r "$path" ]] / [[ -w "$path" ]] / [[ -x "$path" ]]: True if readable / writable / executable.