touch
Shell (~bash) - Windows/OS X/Linux
Occasionally (okay, at least once a day) I find myself needing to create an empty file. Sometimes it’s to make sure I have write permissions in a particular directory, other times I want to create the file and then edit it in vim
.
It’s easy enough to right click in the folder and click create new file
, but if you’re already in the shell (and why aren’t you?), just try this command.
touch path/to/the/file/you/want/to/create
The touch
command creates an empty file. If the file already exists, it update the modified timestamp in the filesystem for that file.