Suppose you want to create a directory of your own?
I often keep one called "notes" in my home directory, which in turn contains some text files.
Suppose we want to add a hello.txt
to that directory?
touch
doesn't put anything inside that file. It just creates it.
There's one other thing to know about touch
: If you run it again a bit later on the same file...
...you'll update the timestamp. This might seem like a trivial thing, but it comes up surprisingly often.
Of course, this is obviously sort of a contrived example. If you're going to have text files, you probably want to put something in them. This is where an editor comes in.