File test options for the test command

The following are the various options for file-handling operations using the test command:

-c file_name

Check whether file is character special file

-d file_name

Check whether directory exists

-e file_name

Check whether file exists

-f file_name

Check whether file is a regular file and not a directory

-G file_name

Check whether file exists and is owned by the effective group ID

-g file_name

Check whether file has Set-group-ID set

-k file_name

Check whether file has Sticky bit set

-L file_name

Check whether file is symbolic link

-p file_name

Check whether file is a named pipe

-O file_name

Check whether file exists and is owned by the effective ...

Get Learning Linux Shell Scripting - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.