We can use the find command of Linux to check if a file exists or not on Ubuntu.
Let’s say we need to check if a file exists at path /etc/nginx/ssl/mydomain.com.crt. We can run the following command to do that:
If the file exists on the server, the command will return the path of the file in response:
and if the file doesn’t exists, the command will return the following response:
find: ‘/etc/nginx/ssl/mydomain.com.crt’: No such file or directory