How to create an empty file in emacs


How can I create an empty file from emacs, ideally from within a dired buffer?

For example, I've just opened a Python module in dired mode, created a new directory, opened that in dired, and now need to add an empty file in the directory.

If I use C-x C-f RET C-x C-s then emacs doesn't create the file because no changes have been made to it. I would have to type in the file, save it, delete my typing and then save it again for that to work.


Best Solution

You can use the touch command:

M-! touch RET