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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.