touch
Let’s learn how to make some files. A very simple way is to use the touch command. Touch allows you to the create new empty files.
$ touch mysuperduperfile
And boom, new file!
Touch is also used to change timestamps on existing files and directories. Give it a try, do an ls -l on a file and note the timestamp, then touch that file and it will update the timestamp.
There are many other ways to create files that involve other things like redirection and text editors, but we’ll get to that in the Text Manipulation course.
Exercise
- Create a new file
- Note the timestamp
- Touch the file and check the timestamp once again
Quiz Question
How do you create a file called myfile?
Quiz Answer
touch myfile