How to run a notebook using command line

Yes, you can directly run a notebook file from the command line. Two main ways I use are nbconvert and papermill. See the third paragraph here for links to documentation for each and some examples.

By the way since you mentioned .py files, jupytext can convert a script back to a notebook and run that notebook in one command, here. It also does the conversion from notebook to script on the command line, too.