| File type tests |
-b file |
True if file exists and is block special. |
-c file |
True if file exists and is character special. |
-d file |
True if file exists and is a directory. |
-f file |
True if file exists and is a regular file. |
-h file
or
-L file |
True if file exists and is a symbolic link. |
-p file |
True if file exists and is a named pipe. |
-S file |
True if file exists and is a socket. |
-T [fd] |
True if fd is opened on a terminal. If fd is omitted, it defaults to 1 (standard output). |
| Access permission tests |
-g file |
True if file exists and is set-group-id. |
-k file |
True if file has its ``sticky'' bit set. |
-r file |
True if file exists and is readable. |
-u file |
True if file exists and its set-user-id bit is set. |
-w file |
True if file exists and is writable. |
-x file |
True if file exists and is executable. |
-O file |
True if file exists and is owned by the effective user id. |
-G file |
True if file exists and is owned by the effective group id. |
| File characteristics tests |
-e file |
True if file exists |
-s file |
True if file exists and has a size greater than zero. |
file1 -nt file2 |
True if file1 is newer (according to modification date) than file2. |
file1 -ot file2 |
True if file1 is older than file2. |
file1 -ef file2 |
True if file1 and file2 have the same device and inode numbers. |