Add/remove file on terminal command line

It’s all about SPEED, baby.

I’m always looking for ways to save time in my workflow. Here’s one terminal command that you’ll end up needing at some point. You may not use it all the time, but it will come in handy when you’re cranking through your command line and need to create a new document on the fly.

The TOUCH command

To create a new file, simply get yourself into the directory you want to add the file to and then…

touch <filename>

so, for example…
touch index.html

 

And if you’re not in the directory where you want to add the file, just give the path along with the filename, like so:

touch Documents/nerd_college/index.html

That’s it, you’ll have a new file named index.html ready for your using.

 

Remove that file

And if you want to remove that new file:

rm <filename>

so, for example…

rm index.html

 

Now go play around with it and become a terminal master!  And go read some of my other terminal posts, like how to create a directory or folder from terminal.

 

I also posted a short video so you can watch these commands in action.

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *