mkdir

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.

touch

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.

This guide was first published on Jan 13, 2015. It was last updated on Jan 13, 2015.

This page (Creating Directories and Files: mkdir and touch) was last updated on Jan 04, 2015.

Text editor powered by tinymce.