Some of the most common commands for iterating with the FS in Linux that we use in our day-to-day tasks are:

  • mkdir dir - Create a single directory
  • mkdir -p foo/bar/dir - Create a directory with parent directories
  • touch file - Create a new file
  • mkdir -p foo/bar && touch foo/bar/file - Create a file with parent directories

Not very complex. And all of us are actually used to this syntax.

But let me introduce you a script which allows you to deal with paths with use of just one single command which is even simpler.


Take a look at the following examples to get an idea of how the process of creating paths may look like when following just one convention:

I was actually inspired by the way how the Vim NERDTree plugin deals with paths following the same convention described above.

If you want to create a file, just provide a path to it:

$ tt foo/bar/file  # => Will create a file "/current/path/foo/bar/file"

If you want to create a directory, append a / to the path:

$ tt foo/bar/dir/ # => Will create a directory "/current/path/foo/bar/dir"

The same will also work for absolute paths:

$ tt /foo/bar/file  # => Will create a file at "/foo/bar/file"
$ tt /foo/bar/dir/  # => Will create a directory at "/foo/bar/dir/"


To install the script just copy one raw file from github to your search $PATH and make it executable.

For example:

wget -O /tmp/tt -- ;\
chmod +x /tmp/tt ;\
sudo mv -f /tmp/tt /usr/bin/tt

Source Code

That’s how the source code looks like: