Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
SERGIO RODRIGUEZ17,532 Points
How do I create a new text file with console?
Jim explains how to create a new directory with the mkdir command, but, how about creating a new text file?
There are a few ways to go about doing that. Some editors will allow you to open a file that doesn't exist and then create it when you save it. Another easy way would be with the touch command which will simply create a completely empty file with the name you give it:
gparsons at bolt in ~/example $ ls gparsons at bolt in ~/example $ touch my_file.txt gparsons at bolt in ~/example $ ls my_file.txt
SERGIO you can also do this:
This creates the file with .txt type and automatically open the file in nano text editor.
It's totally up to you what do you want to do at that specific moment.
But normally you would you my way 'cos you create the file to edit it and write something in.
I never used the touch much.
Just a hint from my side :)