File type tests (GNU Coreutils 9.0)
From Get docs
Coreutils/docs/latest/File-type-tests
Next: Access permission tests, Up: test invocation [Contents][Index]
16.3.1 File type tests
These options test for particular types of files. (Everything’s a file, but not all files are the same!)
- ‘
-b file’ True if
fileexists and is a block special device.- ‘
-c file’ True if
fileexists and is a character special device.- ‘
-d file’ True if
fileexists and is a directory.- ‘
-f file’ True if
fileexists and is a regular file.- ‘
-h file’
‘-L file’ True if
fileexists and is a symbolic link. Unlike all other file-related tests, this test does not dereferencefileif it is a symbolic link.- ‘
-p file’ True if
fileexists and is a named pipe.- ‘
-S file’ True if
fileexists and is a socket.- ‘
-t fd’ True if
fdis a file descriptor that is associated with a terminal.