In system call open(), if I open with O_CREAT | O_EXCL, the system call ensures that the file will only be created if it does not exist. The atomic
open()
O_CREAT | O_EXCL
touch is the command you are looking for. It updates timestamps of the provided file if the file exists or creates it if it doesn't.
touch